aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
Diffstat (limited to 'arch')
-rw-r--r--arch/alpha/include/asm/spinlock.h3
-rw-r--r--arch/alpha/kernel/process.c2
-rw-r--r--arch/arm/boot/compressed/misc.c5
-rw-r--r--arch/arm/configs/omap_ldp_defconfig24
-rw-r--r--arch/arm/configs/pcm037_defconfig23
-rw-r--r--arch/arm/configs/realview-smp_defconfig24
-rw-r--r--arch/arm/configs/realview_defconfig24
-rw-r--r--arch/arm/include/asm/spinlock.h3
-rw-r--r--arch/arm/kernel/process.c2
-rw-r--r--arch/arm/mach-at91/pm.c8
-rw-r--r--arch/arm/mach-gemini/include/mach/system.h2
-rw-r--r--arch/arm/mach-mmp/include/mach/system.h2
-rw-r--r--arch/arm/mach-mx3/pcm037.c23
-rw-r--r--arch/arm/mach-netx/include/mach/netx-regs.h2
-rw-r--r--arch/arm/mach-omap1/Kconfig2
-rw-r--r--arch/arm/mach-omap2/Makefile2
-rw-r--r--arch/arm/mach-omap2/board-ldp.c47
-rw-r--r--arch/arm/mach-omap2/board-overo.c65
-rw-r--r--arch/arm/mach-realview/core.c17
-rw-r--r--arch/arm/mach-realview/localtimer.c1
-rw-r--r--arch/arm/mm/abort-ev6.S4
-rw-r--r--arch/arm/mm/cache-feroceon-l2.c9
-rw-r--r--arch/arm/vfp/entry.S23
-rw-r--r--arch/arm/vfp/vfphw.S12
-rw-r--r--arch/arm/vfp/vfpmodule.c6
-rw-r--r--arch/avr32/Kconfig6
-rw-r--r--arch/avr32/kernel/process.c2
-rw-r--r--arch/blackfin/Kconfig6
-rw-r--r--arch/blackfin/kernel/process.c2
-rw-r--r--arch/cris/Kconfig6
-rw-r--r--arch/cris/arch-v10/kernel/process.c2
-rw-r--r--arch/cris/arch-v32/Kconfig2
-rw-r--r--arch/cris/arch-v32/drivers/Kconfig2
-rw-r--r--arch/cris/arch-v32/kernel/process.c2
-rw-r--r--arch/cris/arch-v32/mach-fs/Kconfig2
-rw-r--r--arch/cris/include/arch-v32/arch/spinlock.h2
-rw-r--r--arch/cris/kernel/process.c1
-rw-r--r--arch/frv/kernel/process.c2
-rw-r--r--arch/h8300/kernel/process.c2
-rw-r--r--arch/h8300/kernel/timer/tpu.c2
-rw-r--r--arch/ia64/configs/generic_defconfig3
-rw-r--r--arch/ia64/include/asm/intrinsics.h6
-rw-r--r--arch/ia64/include/asm/mmu_context.h6
-rw-r--r--arch/ia64/include/asm/module.h6
-rw-r--r--arch/ia64/include/asm/native/inst.h13
-rw-r--r--arch/ia64/include/asm/native/patchlist.h38
-rw-r--r--arch/ia64/include/asm/native/pvchk_inst.h8
-rw-r--r--arch/ia64/include/asm/paravirt.h65
-rw-r--r--arch/ia64/include/asm/paravirt_patch.h143
-rw-r--r--arch/ia64/include/asm/paravirt_privop.h365
-rw-r--r--arch/ia64/include/asm/smp.h3
-rw-r--r--arch/ia64/include/asm/spinlock.h77
-rw-r--r--arch/ia64/include/asm/timex.h1
-rw-r--r--arch/ia64/include/asm/topology.h5
-rw-r--r--arch/ia64/include/asm/uv/uv_hub.h6
-rw-r--r--arch/ia64/include/asm/uv/uv_mmrs.h158
-rw-r--r--arch/ia64/include/asm/xen/hypervisor.h39
-rw-r--r--arch/ia64/include/asm/xen/inst.h28
-rw-r--r--arch/ia64/include/asm/xen/interface.h9
-rw-r--r--arch/ia64/include/asm/xen/minstate.h11
-rw-r--r--arch/ia64/include/asm/xen/patchlist.h38
-rw-r--r--arch/ia64/include/asm/xen/privop.h8
-rw-r--r--arch/ia64/kernel/Makefile39
-rw-r--r--arch/ia64/kernel/Makefile.gate27
-rw-r--r--arch/ia64/kernel/acpi.c8
-rw-r--r--arch/ia64/kernel/asm-offsets.c2
-rw-r--r--arch/ia64/kernel/efi.c1
-rw-r--r--arch/ia64/kernel/entry.S4
-rw-r--r--arch/ia64/kernel/fsys.S35
-rw-r--r--arch/ia64/kernel/gate.S171
-rw-r--r--arch/ia64/kernel/gate.lds.S17
-rw-r--r--arch/ia64/kernel/head.S10
-rw-r--r--arch/ia64/kernel/ivt.S2
-rw-r--r--arch/ia64/kernel/mca.c6
-rw-r--r--arch/ia64/kernel/module.c35
-rw-r--r--arch/ia64/kernel/paravirt.c539
-rw-r--r--arch/ia64/kernel/paravirt_patch.c514
-rw-r--r--arch/ia64/kernel/paravirt_patchlist.c79
-rw-r--r--arch/ia64/kernel/paravirt_patchlist.h28
-rw-r--r--arch/ia64/kernel/paravirtentry.S99
-rw-r--r--arch/ia64/kernel/patch.c40
-rw-r--r--arch/ia64/kernel/perfmon.c4
-rw-r--r--arch/ia64/kernel/process.c2
-rw-r--r--arch/ia64/kernel/salinfo.c6
-rw-r--r--arch/ia64/kernel/setup.c9
-rw-r--r--arch/ia64/kernel/smp.c6
-rw-r--r--arch/ia64/kernel/smpboot.c17
-rw-r--r--arch/ia64/kernel/time.c9
-rw-r--r--arch/ia64/kernel/vmlinux.lds.S30
-rw-r--r--arch/ia64/kvm/kvm-ia64.c2
-rw-r--r--arch/ia64/kvm/vcpu.c2
-rw-r--r--arch/ia64/kvm/vtlb.c2
-rw-r--r--arch/ia64/mm/init.c12
-rw-r--r--arch/ia64/mm/tlb.c2
-rw-r--r--arch/ia64/scripts/pvcheck.sed1
-rw-r--r--arch/ia64/sn/kernel/io_common.c15
-rw-r--r--arch/ia64/sn/kernel/io_init.c12
-rw-r--r--arch/ia64/sn/kernel/setup.c5
-rw-r--r--arch/ia64/sn/kernel/sn2/sn2_smp.c12
-rw-r--r--arch/ia64/sn/kernel/sn2/sn_hwperf.c8
-rw-r--r--arch/ia64/sn/pci/pcibr/pcibr_dma.c4
-rw-r--r--arch/ia64/xen/Makefile19
-rw-r--r--arch/ia64/xen/gate-data.S3
-rw-r--r--arch/ia64/xen/hypercall.S2
-rw-r--r--arch/ia64/xen/time.c48
-rw-r--r--arch/ia64/xen/xen_pv_ops.c800
-rw-r--r--arch/m32r/kernel/process.c2
-rw-r--r--arch/m68k/include/asm/bootinfo.h381
-rw-r--r--arch/m68k/include/asm/bootinfo_mm.h378
-rw-r--r--arch/m68k/include/asm/bootinfo_no.h2
-rw-r--r--arch/m68k/include/asm/bug.h31
-rw-r--r--arch/m68k/include/asm/bug_mm.h29
-rw-r--r--arch/m68k/include/asm/bug_no.h4
-rw-r--r--arch/m68k/include/asm/bugs.h21
-rw-r--r--arch/m68k/include/asm/bugs_mm.h14
-rw-r--r--arch/m68k/include/asm/bugs_no.h16
-rw-r--r--arch/m68k/include/asm/cache.h14
-rw-r--r--arch/m68k/include/asm/cache_mm.h11
-rw-r--r--arch/m68k/include/asm/cache_no.h12
-rw-r--r--arch/m68k/include/asm/current.h31
-rw-r--r--arch/m68k/include/asm/current_mm.h6
-rw-r--r--arch/m68k/include/asm/current_no.h24
-rw-r--r--arch/m68k/include/asm/div64.h37
-rw-r--r--arch/m68k/include/asm/div64_mm.h28
-rw-r--r--arch/m68k/include/asm/div64_no.h1
-rw-r--r--arch/m68k/include/asm/dma-mapping.h113
-rw-r--r--arch/m68k/include/asm/dma-mapping_mm.h112
-rw-r--r--arch/m68k/include/asm/dma-mapping_no.h6
-rw-r--r--arch/m68k/include/asm/elf.h120
-rw-r--r--arch/m68k/include/asm/elf_mm.h119
-rw-r--r--arch/m68k/include/asm/elf_no.h110
-rw-r--r--arch/m68k/include/asm/fb.h41
-rw-r--r--arch/m68k/include/asm/fb_mm.h34
-rw-r--r--arch/m68k/include/asm/fb_no.h12
-rw-r--r--arch/m68k/include/asm/fpu.h22
-rw-r--r--arch/m68k/include/asm/fpu_mm.h21
-rw-r--r--arch/m68k/include/asm/fpu_no.h21
-rw-r--r--arch/m68k/include/asm/hw_irq.h9
-rw-r--r--arch/m68k/include/asm/hw_irq_mm.h6
-rw-r--r--arch/m68k/include/asm/hw_irq_no.h4
-rw-r--r--arch/m68k/include/asm/kmap_types.h26
-rw-r--r--arch/m68k/include/asm/kmap_types_mm.h21
-rw-r--r--arch/m68k/include/asm/kmap_types_no.h21
-rw-r--r--arch/m68k/include/asm/m532xsim.h1
-rw-r--r--arch/m68k/include/asm/mc146818rtc.h31
-rw-r--r--arch/m68k/include/asm/mc146818rtc_mm.h26
-rw-r--r--arch/m68k/include/asm/mc146818rtc_no.h9
-rw-r--r--arch/m68k/include/asm/mcfpci.h119
-rw-r--r--arch/m68k/include/asm/mmu.h14
-rw-r--r--arch/m68k/include/asm/mmu_context.h176
-rw-r--r--arch/m68k/include/asm/mmu_context_mm.h154
-rw-r--r--arch/m68k/include/asm/mmu_context_no.h33
-rw-r--r--arch/m68k/include/asm/mmu_mm.h7
-rw-r--r--arch/m68k/include/asm/mmu_no.h10
-rw-r--r--arch/m68k/include/asm/module.h51
-rw-r--r--arch/m68k/include/asm/module_mm.h39
-rw-r--r--arch/m68k/include/asm/module_no.h11
-rw-r--r--arch/m68k/include/asm/page_offset.h12
-rw-r--r--arch/m68k/include/asm/page_offset_mm.h8
-rw-r--r--arch/m68k/include/asm/page_offset_no.h5
-rw-r--r--arch/m68k/include/asm/pci.h17
-rw-r--r--arch/m68k/include/asm/pci_mm.h12
-rw-r--r--arch/m68k/include/asm/pci_no.h29
-rw-r--r--arch/m68k/include/asm/pgalloc.h20
-rw-r--r--arch/m68k/include/asm/pgalloc_mm.h19
-rw-r--r--arch/m68k/include/asm/pgalloc_no.h8
-rw-r--r--arch/m68k/include/asm/pgtable_no.h2
-rw-r--r--arch/m68k/include/asm/rtc.h7
-rw-r--r--arch/m68k/include/asm/scatterlist.h26
-rw-r--r--arch/m68k/include/asm/scatterlist_mm.h23
-rw-r--r--arch/m68k/include/asm/scatterlist_no.h22
-rw-r--r--arch/m68k/include/asm/segment.h64
-rw-r--r--arch/m68k/include/asm/segment_mm.h57
-rw-r--r--arch/m68k/include/asm/segment_no.h51
-rw-r--r--arch/m68k/include/asm/timex.h21
-rw-r--r--arch/m68k/include/asm/timex_mm.h18
-rw-r--r--arch/m68k/include/asm/timex_no.h23
-rw-r--r--arch/m68k/include/asm/tlbflush.h268
-rw-r--r--arch/m68k/include/asm/tlbflush_mm.h219
-rw-r--r--arch/m68k/include/asm/tlbflush_no.h55
-rw-r--r--arch/m68k/include/asm/ucontext.h33
-rw-r--r--arch/m68k/include/asm/ucontext_mm.h30
-rw-r--r--arch/m68k/include/asm/ucontext_no.h32
-rw-r--r--arch/m68k/include/asm/unaligned.h26
-rw-r--r--arch/m68k/include/asm/unaligned_mm.h13
-rw-r--r--arch/m68k/include/asm/unaligned_no.h25
-rw-r--r--arch/m68k/kernel/process.c2
-rw-r--r--arch/m68k/kernel/time.c18
-rw-r--r--arch/m68knommu/Makefile14
-rw-r--r--arch/m68knommu/kernel/dma.c8
-rw-r--r--arch/m68knommu/kernel/irq.c2
-rw-r--r--arch/m68knommu/kernel/process.c2
-rw-r--r--arch/m68knommu/mm/init.c6
-rw-r--r--arch/m68knommu/platform/5249/config.c11
-rw-r--r--arch/m68knommu/platform/5307/config.c8
-rw-r--r--arch/m68knommu/platform/5407/config.c8
-rw-r--r--arch/m68knommu/platform/coldfire/Makefile2
-rw-r--r--arch/m68knommu/platform/coldfire/clk.c40
-rw-r--r--arch/mips/Kconfig2
-rw-r--r--arch/mips/include/asm/spinlock.h2
-rw-r--r--arch/mips/include/asm/unistd.h18
-rw-r--r--arch/mips/kernel/process.c2
-rw-r--r--arch/mips/kernel/scall32-o32.S2
-rw-r--r--arch/mips/kernel/scall64-64.S2
-rw-r--r--arch/mips/kernel/scall64-n32.S2
-rw-r--r--arch/mips/kernel/scall64-o32.S2
-rw-r--r--arch/mips/sgi-ip27/ip27-smp.c2
-rw-r--r--arch/mn10300/kernel/process.c2
-rw-r--r--arch/parisc/Kconfig12
-rw-r--r--arch/parisc/Makefile4
-rw-r--r--arch/parisc/include/asm/atomic.h18
-rw-r--r--arch/parisc/include/asm/cacheflush.h3
-rw-r--r--arch/parisc/include/asm/elf.h10
-rw-r--r--arch/parisc/include/asm/ftrace.h26
-rw-r--r--arch/parisc/include/asm/page.h13
-rw-r--r--arch/parisc/include/asm/pdc.h4
-rw-r--r--arch/parisc/include/asm/pgtable.h15
-rw-r--r--arch/parisc/include/asm/smp.h3
-rw-r--r--arch/parisc/include/asm/spinlock.h3
-rw-r--r--arch/parisc/kernel/Makefile15
-rw-r--r--arch/parisc/kernel/entry.S60
-rw-r--r--arch/parisc/kernel/firmware.c6
-rw-r--r--arch/parisc/kernel/ftrace.c185
-rw-r--r--arch/parisc/kernel/irq.c4
-rw-r--r--arch/parisc/kernel/module.c18
-rw-r--r--arch/parisc/kernel/parisc_ksyms.c5
-rw-r--r--arch/parisc/kernel/process.c31
-rw-r--r--arch/parisc/kernel/processor.c13
-rw-r--r--arch/parisc/kernel/smp.c21
-rw-r--r--arch/parisc/kernel/stacktrace.c63
-rw-r--r--arch/parisc/kernel/syscall.S58
-rw-r--r--arch/parisc/kernel/time.c9
-rw-r--r--arch/parisc/kernel/traps.c5
-rw-r--r--arch/parisc/kernel/vmlinux.lds.S2
-rw-r--r--arch/parisc/mm/init.c7
-rw-r--r--arch/powerpc/Kconfig2
-rw-r--r--arch/powerpc/Kconfig.debug10
-rw-r--r--arch/powerpc/include/asm/mmzone.h1
-rw-r--r--arch/powerpc/include/asm/ps3.h3
-rw-r--r--arch/powerpc/include/asm/spinlock.h3
-rw-r--r--arch/powerpc/kernel/process.c2
-rw-r--r--arch/powerpc/kernel/time.c16
-rw-r--r--arch/powerpc/kernel/vio.c2
-rw-r--r--arch/powerpc/platforms/Kconfig2
-rw-r--r--arch/powerpc/platforms/cell/spufs/inode.c2
-rw-r--r--arch/powerpc/platforms/ps3/os-area.c2
-rw-r--r--arch/powerpc/platforms/ps3/platform.h2
-rw-r--r--arch/powerpc/platforms/ps3/setup.c2
-rw-r--r--arch/powerpc/platforms/ps3/time.c26
-rw-r--r--arch/powerpc/sysdev/bestcomm/Kconfig4
-rw-r--r--arch/s390/Kconfig.debug9
-rw-r--r--arch/s390/include/asm/smp.h6
-rw-r--r--arch/s390/include/asm/spinlock.h3
-rw-r--r--arch/s390/kernel/process.c2
-rw-r--r--arch/sh/Kconfig4
-rw-r--r--arch/sh/include/asm/spinlock.h3
-rw-r--r--arch/sh/kernel/process_32.c2
-rw-r--r--arch/sh/kernel/process_64.c2
-rw-r--r--arch/sparc/Kconfig.debug9
-rw-r--r--arch/sparc/include/asm/mmzone.h2
-rw-r--r--arch/sparc/include/asm/spinlock_32.h2
-rw-r--r--arch/sparc/include/asm/spinlock_64.h2
-rw-r--r--arch/sparc/kernel/head_64.S2
-rw-r--r--arch/sparc/kernel/process_32.c2
-rw-r--r--arch/sparc/kernel/process_64.c2
-rw-r--r--arch/um/drivers/net_kern.c2
-rw-r--r--arch/um/drivers/ubd_kern.c12
-rw-r--r--arch/um/kernel/process.c2
-rw-r--r--arch/um/kernel/syscall.c3
-rw-r--r--arch/um/sys-i386/sys_call_table.S11
-rw-r--r--arch/x86/Kconfig8
-rw-r--r--arch/x86/Kconfig.debug9
-rw-r--r--arch/x86/boot/Makefile3
-rw-r--r--arch/x86/boot/compressed/Makefile1
-rw-r--r--arch/x86/boot/memory.c39
-rw-r--r--arch/x86/ia32/ia32entry.S2
-rw-r--r--arch/x86/include/asm/cpumask.h18
-rw-r--r--arch/x86/include/asm/pci.h41
-rw-r--r--arch/x86/include/asm/pci_32.h34
-rw-r--r--arch/x86/include/asm/pci_64.h22
-rw-r--r--arch/x86/include/asm/processor.h3
-rw-r--r--arch/x86/include/asm/smp.h13
-rw-r--r--arch/x86/include/asm/spinlock.h3
-rw-r--r--arch/x86/include/asm/topology.h87
-rw-r--r--arch/x86/include/asm/unistd_32.h2
-rw-r--r--arch/x86/include/asm/unistd_64.h4
-rw-r--r--arch/x86/include/asm/uv/uv_hub.h14
-rw-r--r--arch/x86/include/asm/uv/uv_mmrs.h153
-rw-r--r--arch/x86/kernel/amd_iommu.c7
-rw-r--r--arch/x86/kernel/apic/bigsmp_32.c16
-rw-r--r--arch/x86/kernel/apic/es7000_32.c17
-rw-r--r--arch/x86/kernel/apic/nmi.c11
-rw-r--r--arch/x86/kernel/apic/numaq_32.c11
-rw-r--r--arch/x86/kernel/apic/probe_32.c3
-rw-r--r--arch/x86/kernel/apic/summit_32.c21
-rw-r--r--arch/x86/kernel/apic/x2apic_uv_x.c9
-rw-r--r--arch/x86/kernel/apm_32.c248
-rw-r--r--arch/x86/kernel/cpu/common.c13
-rw-r--r--arch/x86/kernel/cpu/cpufreq/p4-clockmod.c2
-rw-r--r--arch/x86/kernel/cpu/cpufreq/powernow-k8.c13
-rw-r--r--arch/x86/kernel/cpu/cpufreq/speedstep-ich.c2
-rw-r--r--arch/x86/kernel/cpu/intel_cacheinfo.c24
-rw-r--r--arch/x86/kernel/cpu/mcheck/mce_64.c10
-rw-r--r--arch/x86/kernel/cpu/mcheck/mce_amd_64.c6
-rw-r--r--arch/x86/kernel/cpu/mcheck/mce_intel_64.c2
-rw-r--r--arch/x86/kernel/cpu/mtrr/generic.c3
-rw-r--r--arch/x86/kernel/cpu/proc.c6
-rw-r--r--arch/x86/kernel/microcode_amd.c43
-rw-r--r--arch/x86/kernel/microcode_core.c160
-rw-r--r--arch/x86/kernel/microcode_intel.c83
-rw-r--r--arch/x86/kernel/process.c20
-rw-r--r--arch/x86/kernel/process_32.c2
-rw-r--r--arch/x86/kernel/process_64.c2
-rw-r--r--arch/x86/kernel/ptrace.c2
-rw-r--r--arch/x86/kernel/setup_percpu.c16
-rw-r--r--arch/x86/kernel/signal.c2
-rw-r--r--arch/x86/kernel/smpboot.c70
-rw-r--r--arch/x86/kernel/syscall_table_32.S2
-rw-r--r--arch/x86/kernel/tlb_uv.c9
-rw-r--r--arch/x86/mm/Makefile2
-rw-r--r--arch/x86/mm/highmem_32.c1
-rw-r--r--arch/x86/mm/iomap_32.c4
-rw-r--r--arch/x86/mm/mmio-mod.c19
-rw-r--r--arch/x86/mm/numa.c67
-rw-r--r--arch/x86/mm/numa_64.c111
-rw-r--r--arch/x86/oprofile/op_model_p4.c2
-rw-r--r--arch/x86/pci/i386.c46
-rw-r--r--arch/x86/power/Makefile5
-rw-r--r--arch/x86/xen/smp.c6
-rw-r--r--arch/xtensa/Kconfig184
-rw-r--r--arch/xtensa/Makefile15
-rw-r--r--arch/xtensa/configs/s6105_defconfig530
-rw-r--r--arch/xtensa/include/asm/cacheflush.h10
-rw-r--r--arch/xtensa/include/asm/dma.h3
-rw-r--r--arch/xtensa/include/asm/flat.h12
-rw-r--r--arch/xtensa/include/asm/gpio.h56
-rw-r--r--arch/xtensa/include/asm/io.h9
-rw-r--r--arch/xtensa/include/asm/irq.h7
-rw-r--r--arch/xtensa/include/asm/mmu.h5
-rw-r--r--arch/xtensa/include/asm/mmu_context.h9
-rw-r--r--arch/xtensa/include/asm/nommu.h3
-rw-r--r--arch/xtensa/include/asm/nommu_context.h25
-rw-r--r--arch/xtensa/include/asm/page.h14
-rw-r--r--arch/xtensa/include/asm/pgtable.h13
-rw-r--r--arch/xtensa/include/asm/platform.h11
-rw-r--r--arch/xtensa/include/asm/processor.h8
-rw-r--r--arch/xtensa/kernel/entry.S3
-rw-r--r--arch/xtensa/kernel/head.S5
-rw-r--r--arch/xtensa/kernel/irq.c14
-rw-r--r--arch/xtensa/kernel/platform.c2
-rw-r--r--arch/xtensa/kernel/process.c2
-rw-r--r--arch/xtensa/kernel/setup.c7
-rw-r--r--arch/xtensa/kernel/time.c131
-rw-r--r--arch/xtensa/kernel/traps.c16
-rw-r--r--arch/xtensa/kernel/vectors.S4
-rw-r--r--arch/xtensa/kernel/vmlinux.lds.S3
-rw-r--r--arch/xtensa/mm/Makefile3
-rw-r--r--arch/xtensa/mm/init.c78
-rw-r--r--arch/xtensa/mm/misc.S2
-rw-r--r--arch/xtensa/mm/mmu.c70
-rw-r--r--arch/xtensa/platforms/s6105/Makefile3
-rw-r--r--arch/xtensa/platforms/s6105/device.c67
-rw-r--r--arch/xtensa/platforms/s6105/include/platform/gpio.h27
-rw-r--r--arch/xtensa/platforms/s6105/include/platform/hardware.h11
-rw-r--r--arch/xtensa/platforms/s6105/include/platform/serial.h8
-rw-r--r--arch/xtensa/platforms/s6105/setup.c61
-rw-r--r--arch/xtensa/platforms/xt2000/include/platform/hardware.h1
-rw-r--r--arch/xtensa/variants/s6000/Makefile3
-rw-r--r--arch/xtensa/variants/s6000/gpio.c71
-rw-r--r--arch/xtensa/variants/s6000/include/variant/core.h431
-rw-r--r--arch/xtensa/variants/s6000/include/variant/hardware.h259
-rw-r--r--arch/xtensa/variants/s6000/include/variant/irq.h9
-rw-r--r--arch/xtensa/variants/s6000/include/variant/tie-asm.h304
-rw-r--r--arch/xtensa/variants/s6000/include/variant/tie.h191
-rw-r--r--arch/xtensa/variants/s6000/irq.c74
375 files changed, 9236 insertions, 3809 deletions
diff --git a/arch/alpha/include/asm/spinlock.h b/arch/alpha/include/asm/spinlock.h
index aeeb125f6851..e38fb95cb335 100644
--- a/arch/alpha/include/asm/spinlock.h
+++ b/arch/alpha/include/asm/spinlock.h
@@ -166,6 +166,9 @@ static inline void __raw_write_unlock(raw_rwlock_t * lock)
166 lock->lock = 0; 166 lock->lock = 0;
167} 167}
168 168
169#define __raw_read_lock_flags(lock, flags) __raw_read_lock(lock)
170#define __raw_write_lock_flags(lock, flags) __raw_write_lock(lock)
171
169#define _raw_spin_relax(lock) cpu_relax() 172#define _raw_spin_relax(lock) cpu_relax()
170#define _raw_read_relax(lock) cpu_relax() 173#define _raw_read_relax(lock) cpu_relax()
171#define _raw_write_relax(lock) cpu_relax() 174#define _raw_write_relax(lock) cpu_relax()
diff --git a/arch/alpha/kernel/process.c b/arch/alpha/kernel/process.c
index 8d0097f10208..3a2fb7a02db4 100644
--- a/arch/alpha/kernel/process.c
+++ b/arch/alpha/kernel/process.c
@@ -272,7 +272,7 @@ alpha_vfork(struct pt_regs *regs)
272 */ 272 */
273 273
274int 274int
275copy_thread(int nr, unsigned long clone_flags, unsigned long usp, 275copy_thread(unsigned long clone_flags, unsigned long usp,
276 unsigned long unused, 276 unsigned long unused,
277 struct task_struct * p, struct pt_regs * regs) 277 struct task_struct * p, struct pt_regs * regs)
278{ 278{
diff --git a/arch/arm/boot/compressed/misc.c b/arch/arm/boot/compressed/misc.c
index 393c81641314..9e6e512f0117 100644
--- a/arch/arm/boot/compressed/misc.c
+++ b/arch/arm/boot/compressed/misc.c
@@ -18,7 +18,10 @@
18 18
19unsigned int __machine_arch_type; 19unsigned int __machine_arch_type;
20 20
21#include <linux/string.h> 21#include <linux/compiler.h> /* for inline */
22#include <linux/types.h> /* for size_t */
23#include <linux/stddef.h> /* for NULL */
24#include <asm/string.h>
22 25
23#ifdef STANDALONE_DEBUG 26#ifdef STANDALONE_DEBUG
24#define putstr printf 27#define putstr printf
diff --git a/arch/arm/configs/omap_ldp_defconfig b/arch/arm/configs/omap_ldp_defconfig
index aa9d34feddc6..679a4a3e265e 100644
--- a/arch/arm/configs/omap_ldp_defconfig
+++ b/arch/arm/configs/omap_ldp_defconfig
@@ -474,14 +474,34 @@ CONFIG_NETDEVICES=y
474# CONFIG_EQUALIZER is not set 474# CONFIG_EQUALIZER is not set
475# CONFIG_TUN is not set 475# CONFIG_TUN is not set
476# CONFIG_VETH is not set 476# CONFIG_VETH is not set
477# CONFIG_PHYLIB is not set 477CONFIG_PHYLIB=y
478
479#
480# MII PHY device drivers
481#
482# CONFIG_MARVELL_PHY is not set
483# CONFIG_DAVICOM_PHY is not set
484# CONFIG_QSEMI_PHY is not set
485# CONFIG_LXT_PHY is not set
486# CONFIG_CICADA_PHY is not set
487# CONFIG_VITESSE_PHY is not set
488CONFIG_SMSC_PHY=y
489# CONFIG_BROADCOM_PHY is not set
490# CONFIG_ICPLUS_PHY is not set
491# CONFIG_REALTEK_PHY is not set
492# CONFIG_NATIONAL_PHY is not set
493# CONFIG_STE10XP is not set
494# CONFIG_LSI_ET1011C_PHY is not set
495# CONFIG_FIXED_PHY is not set
496# CONFIG_MDIO_BITBANG is not set
478CONFIG_NET_ETHERNET=y 497CONFIG_NET_ETHERNET=y
479CONFIG_MII=y 498CONFIG_MII=y
480# CONFIG_AX88796 is not set 499# CONFIG_AX88796 is not set
481# CONFIG_SMC91X is not set 500# CONFIG_SMC91X is not set
482# CONFIG_DM9000 is not set 501# CONFIG_DM9000 is not set
483# CONFIG_ENC28J60 is not set 502# CONFIG_ENC28J60 is not set
484CONFIG_SMC911X=y 503# CONFIG_SMC911X is not set
504CONFIG_SMSC911X=y
485# CONFIG_IBM_NEW_EMAC_ZMII is not set 505# CONFIG_IBM_NEW_EMAC_ZMII is not set
486# CONFIG_IBM_NEW_EMAC_RGMII is not set 506# CONFIG_IBM_NEW_EMAC_RGMII is not set
487# CONFIG_IBM_NEW_EMAC_TAH is not set 507# CONFIG_IBM_NEW_EMAC_TAH is not set
diff --git a/arch/arm/configs/pcm037_defconfig b/arch/arm/configs/pcm037_defconfig
index 627474586470..6e37c77c4760 100644
--- a/arch/arm/configs/pcm037_defconfig
+++ b/arch/arm/configs/pcm037_defconfig
@@ -465,12 +465,33 @@ CONFIG_NETDEVICES=y
465# CONFIG_EQUALIZER is not set 465# CONFIG_EQUALIZER is not set
466# CONFIG_TUN is not set 466# CONFIG_TUN is not set
467# CONFIG_VETH is not set 467# CONFIG_VETH is not set
468# CONFIG_PHYLIB is not set 468CONFIG_PHYLIB=y
469
470#
471# MII PHY device drivers
472#
473# CONFIG_MARVELL_PHY is not set
474# CONFIG_DAVICOM_PHY is not set
475# CONFIG_QSEMI_PHY is not set
476# CONFIG_LXT_PHY is not set
477# CONFIG_CICADA_PHY is not set
478# CONFIG_VITESSE_PHY is not set
479CONFIG_SMSC_PHY=y
480# CONFIG_BROADCOM_PHY is not set
481# CONFIG_ICPLUS_PHY is not set
482# CONFIG_REALTEK_PHY is not set
483# CONFIG_NATIONAL_PHY is not set
484# CONFIG_STE10XP is not set
485# CONFIG_LSI_ET1011C_PHY is not set
486# CONFIG_FIXED_PHY is not set
487# CONFIG_MDIO_BITBANG is not set
469CONFIG_NET_ETHERNET=y 488CONFIG_NET_ETHERNET=y
470CONFIG_MII=y 489CONFIG_MII=y
471# CONFIG_AX88796 is not set 490# CONFIG_AX88796 is not set
472CONFIG_SMC91X=y 491CONFIG_SMC91X=y
473# CONFIG_DM9000 is not set 492# CONFIG_DM9000 is not set
493# CONFIG_SMC911X is not set
494CONFIG_SMSC911X=y
474# CONFIG_IBM_NEW_EMAC_ZMII is not set 495# CONFIG_IBM_NEW_EMAC_ZMII is not set
475# CONFIG_IBM_NEW_EMAC_RGMII is not set 496# CONFIG_IBM_NEW_EMAC_RGMII is not set
476# CONFIG_IBM_NEW_EMAC_TAH is not set 497# CONFIG_IBM_NEW_EMAC_TAH is not set
diff --git a/arch/arm/configs/realview-smp_defconfig b/arch/arm/configs/realview-smp_defconfig
index cd29824d791c..21db4b3ec8ff 100644
--- a/arch/arm/configs/realview-smp_defconfig
+++ b/arch/arm/configs/realview-smp_defconfig
@@ -496,13 +496,33 @@ CONFIG_NETDEVICES=y
496# CONFIG_EQUALIZER is not set 496# CONFIG_EQUALIZER is not set
497# CONFIG_TUN is not set 497# CONFIG_TUN is not set
498# CONFIG_VETH is not set 498# CONFIG_VETH is not set
499# CONFIG_PHYLIB is not set 499CONFIG_PHYLIB=y
500
501#
502# MII PHY device drivers
503#
504# CONFIG_MARVELL_PHY is not set
505# CONFIG_DAVICOM_PHY is not set
506# CONFIG_QSEMI_PHY is not set
507# CONFIG_LXT_PHY is not set
508# CONFIG_CICADA_PHY is not set
509# CONFIG_VITESSE_PHY is not set
510CONFIG_SMSC_PHY=y
511# CONFIG_BROADCOM_PHY is not set
512# CONFIG_ICPLUS_PHY is not set
513# CONFIG_REALTEK_PHY is not set
514# CONFIG_NATIONAL_PHY is not set
515# CONFIG_STE10XP is not set
516# CONFIG_LSI_ET1011C_PHY is not set
517# CONFIG_FIXED_PHY is not set
518# CONFIG_MDIO_BITBANG is not set
500CONFIG_NET_ETHERNET=y 519CONFIG_NET_ETHERNET=y
501CONFIG_MII=y 520CONFIG_MII=y
502# CONFIG_AX88796 is not set 521# CONFIG_AX88796 is not set
503CONFIG_SMC91X=y 522CONFIG_SMC91X=y
504# CONFIG_DM9000 is not set 523# CONFIG_DM9000 is not set
505CONFIG_SMC911X=y 524# CONFIG_SMC911X is not set
525CONFIG_SMSC911X=y
506# CONFIG_IBM_NEW_EMAC_ZMII is not set 526# CONFIG_IBM_NEW_EMAC_ZMII is not set
507# CONFIG_IBM_NEW_EMAC_RGMII is not set 527# CONFIG_IBM_NEW_EMAC_RGMII is not set
508# CONFIG_IBM_NEW_EMAC_TAH is not set 528# CONFIG_IBM_NEW_EMAC_TAH is not set
diff --git a/arch/arm/configs/realview_defconfig b/arch/arm/configs/realview_defconfig
index 7e253f58ed18..9a75c30b910d 100644
--- a/arch/arm/configs/realview_defconfig
+++ b/arch/arm/configs/realview_defconfig
@@ -490,13 +490,33 @@ CONFIG_NETDEVICES=y
490# CONFIG_EQUALIZER is not set 490# CONFIG_EQUALIZER is not set
491# CONFIG_TUN is not set 491# CONFIG_TUN is not set
492# CONFIG_VETH is not set 492# CONFIG_VETH is not set
493# CONFIG_PHYLIB is not set 493CONFIG_PHYLIB=y
494
495#
496# MII PHY device drivers
497#
498# CONFIG_MARVELL_PHY is not set
499# CONFIG_DAVICOM_PHY is not set
500# CONFIG_QSEMI_PHY is not set
501# CONFIG_LXT_PHY is not set
502# CONFIG_CICADA_PHY is not set
503# CONFIG_VITESSE_PHY is not set
504CONFIG_SMSC_PHY=y
505# CONFIG_BROADCOM_PHY is not set
506# CONFIG_ICPLUS_PHY is not set
507# CONFIG_REALTEK_PHY is not set
508# CONFIG_NATIONAL_PHY is not set
509# CONFIG_STE10XP is not set
510# CONFIG_LSI_ET1011C_PHY is not set
511# CONFIG_FIXED_PHY is not set
512# CONFIG_MDIO_BITBANG is not set
494CONFIG_NET_ETHERNET=y 513CONFIG_NET_ETHERNET=y
495CONFIG_MII=y 514CONFIG_MII=y
496# CONFIG_AX88796 is not set 515# CONFIG_AX88796 is not set
497CONFIG_SMC91X=y 516CONFIG_SMC91X=y
498# CONFIG_DM9000 is not set 517# CONFIG_DM9000 is not set
499CONFIG_SMC911X=y 518# CONFIG_SMC911X is not set
519CONFIG_SMSC911X=y
500# CONFIG_IBM_NEW_EMAC_ZMII is not set 520# CONFIG_IBM_NEW_EMAC_ZMII is not set
501# CONFIG_IBM_NEW_EMAC_RGMII is not set 521# CONFIG_IBM_NEW_EMAC_RGMII is not set
502# CONFIG_IBM_NEW_EMAC_TAH is not set 522# CONFIG_IBM_NEW_EMAC_TAH is not set
diff --git a/arch/arm/include/asm/spinlock.h b/arch/arm/include/asm/spinlock.h
index 2b41ebbfa7ff..c13681ac1ede 100644
--- a/arch/arm/include/asm/spinlock.h
+++ b/arch/arm/include/asm/spinlock.h
@@ -217,6 +217,9 @@ static inline int __raw_read_trylock(raw_rwlock_t *rw)
217/* read_can_lock - would read_trylock() succeed? */ 217/* read_can_lock - would read_trylock() succeed? */
218#define __raw_read_can_lock(x) ((x)->lock < 0x80000000) 218#define __raw_read_can_lock(x) ((x)->lock < 0x80000000)
219 219
220#define __raw_read_lock_flags(lock, flags) __raw_read_lock(lock)
221#define __raw_write_lock_flags(lock, flags) __raw_write_lock(lock)
222
220#define _raw_spin_relax(lock) cpu_relax() 223#define _raw_spin_relax(lock) cpu_relax()
221#define _raw_read_relax(lock) cpu_relax() 224#define _raw_read_relax(lock) cpu_relax()
222#define _raw_write_relax(lock) cpu_relax() 225#define _raw_write_relax(lock) cpu_relax()
diff --git a/arch/arm/kernel/process.c b/arch/arm/kernel/process.c
index 2de14e2afdc5..c3265a2e7cd4 100644
--- a/arch/arm/kernel/process.c
+++ b/arch/arm/kernel/process.c
@@ -301,7 +301,7 @@ void release_thread(struct task_struct *dead_task)
301asmlinkage void ret_from_fork(void) __asm__("ret_from_fork"); 301asmlinkage void ret_from_fork(void) __asm__("ret_from_fork");
302 302
303int 303int
304copy_thread(int nr, unsigned long clone_flags, unsigned long stack_start, 304copy_thread(unsigned long clone_flags, unsigned long stack_start,
305 unsigned long stk_sz, struct task_struct *p, struct pt_regs *regs) 305 unsigned long stk_sz, struct task_struct *p, struct pt_regs *regs)
306{ 306{
307 struct thread_info *thread = task_thread_info(p); 307 struct thread_info *thread = task_thread_info(p);
diff --git a/arch/arm/mach-at91/pm.c b/arch/arm/mach-at91/pm.c
index 7ac812dc055a..e26c4fe61fae 100644
--- a/arch/arm/mach-at91/pm.c
+++ b/arch/arm/mach-at91/pm.c
@@ -198,17 +198,17 @@ static int at91_pm_verify_clocks(void)
198 /* USB must not be using PLLB */ 198 /* USB must not be using PLLB */
199 if (cpu_is_at91rm9200()) { 199 if (cpu_is_at91rm9200()) {
200 if ((scsr & (AT91RM9200_PMC_UHP | AT91RM9200_PMC_UDP)) != 0) { 200 if ((scsr & (AT91RM9200_PMC_UHP | AT91RM9200_PMC_UDP)) != 0) {
201 pr_debug("AT91: PM - Suspend-to-RAM with USB still active\n"); 201 pr_err("AT91: PM - Suspend-to-RAM with USB still active\n");
202 return 0; 202 return 0;
203 } 203 }
204 } else if (cpu_is_at91sam9260() || cpu_is_at91sam9261() || cpu_is_at91sam9263() || cpu_is_at91sam9g20()) { 204 } else if (cpu_is_at91sam9260() || cpu_is_at91sam9261() || cpu_is_at91sam9263() || cpu_is_at91sam9g20()) {
205 if ((scsr & (AT91SAM926x_PMC_UHP | AT91SAM926x_PMC_UDP)) != 0) { 205 if ((scsr & (AT91SAM926x_PMC_UHP | AT91SAM926x_PMC_UDP)) != 0) {
206 pr_debug("AT91: PM - Suspend-to-RAM with USB still active\n"); 206 pr_err("AT91: PM - Suspend-to-RAM with USB still active\n");
207 return 0; 207 return 0;
208 } 208 }
209 } else if (cpu_is_at91cap9()) { 209 } else if (cpu_is_at91cap9()) {
210 if ((scsr & AT91CAP9_PMC_UHP) != 0) { 210 if ((scsr & AT91CAP9_PMC_UHP) != 0) {
211 pr_debug("AT91: PM - Suspend-to-RAM with USB still active\n"); 211 pr_err("AT91: PM - Suspend-to-RAM with USB still active\n");
212 return 0; 212 return 0;
213 } 213 }
214 } 214 }
@@ -223,7 +223,7 @@ static int at91_pm_verify_clocks(void)
223 223
224 css = at91_sys_read(AT91_PMC_PCKR(i)) & AT91_PMC_CSS; 224 css = at91_sys_read(AT91_PMC_PCKR(i)) & AT91_PMC_CSS;
225 if (css != AT91_PMC_CSS_SLOW) { 225 if (css != AT91_PMC_CSS_SLOW) {
226 pr_debug("AT91: PM - Suspend-to-RAM with PCK%d src %d\n", i, css); 226 pr_err("AT91: PM - Suspend-to-RAM with PCK%d src %d\n", i, css);
227 return 0; 227 return 0;
228 } 228 }
229 } 229 }
diff --git a/arch/arm/mach-gemini/include/mach/system.h b/arch/arm/mach-gemini/include/mach/system.h
index bbbd72767a02..4d9c1f872472 100644
--- a/arch/arm/mach-gemini/include/mach/system.h
+++ b/arch/arm/mach-gemini/include/mach/system.h
@@ -28,7 +28,7 @@ static inline void arch_idle(void)
28 cpu_do_idle(); 28 cpu_do_idle();
29} 29}
30 30
31static inline void arch_reset(char mode) 31static inline void arch_reset(char mode, const char *cmd)
32{ 32{
33 __raw_writel(RESET_GLOBAL | RESET_CPU1, 33 __raw_writel(RESET_GLOBAL | RESET_CPU1,
34 IO_ADDRESS(GEMINI_GLOBAL_BASE) + GLOBAL_RESET); 34 IO_ADDRESS(GEMINI_GLOBAL_BASE) + GLOBAL_RESET);
diff --git a/arch/arm/mach-mmp/include/mach/system.h b/arch/arm/mach-mmp/include/mach/system.h
index 001edfefec19..4f5b0e0ce6cf 100644
--- a/arch/arm/mach-mmp/include/mach/system.h
+++ b/arch/arm/mach-mmp/include/mach/system.h
@@ -14,7 +14,7 @@ static inline void arch_idle(void)
14 cpu_do_idle(); 14 cpu_do_idle();
15} 15}
16 16
17static inline void arch_reset(char mode) 17static inline void arch_reset(char mode, const char *cmd)
18{ 18{
19 cpu_reset(0); 19 cpu_reset(0);
20} 20}
diff --git a/arch/arm/mach-mx3/pcm037.c b/arch/arm/mach-mx3/pcm037.c
index 5fce022114de..c3648eff5137 100644
--- a/arch/arm/mach-mx3/pcm037.c
+++ b/arch/arm/mach-mx3/pcm037.c
@@ -24,7 +24,7 @@
24#include <linux/mtd/plat-ram.h> 24#include <linux/mtd/plat-ram.h>
25#include <linux/memory.h> 25#include <linux/memory.h>
26#include <linux/gpio.h> 26#include <linux/gpio.h>
27#include <linux/smc911x.h> 27#include <linux/smsc911x.h>
28#include <linux/interrupt.h> 28#include <linux/interrupt.h>
29#include <linux/i2c.h> 29#include <linux/i2c.h>
30#include <linux/i2c/at24.h> 30#include <linux/i2c/at24.h>
@@ -70,7 +70,7 @@ static struct imxuart_platform_data uart_pdata = {
70 .flags = IMXUART_HAVE_RTSCTS, 70 .flags = IMXUART_HAVE_RTSCTS,
71}; 71};
72 72
73static struct resource smc911x_resources[] = { 73static struct resource smsc911x_resources[] = {
74 [0] = { 74 [0] = {
75 .start = CS1_BASE_ADDR + 0x300, 75 .start = CS1_BASE_ADDR + 0x300,
76 .end = CS1_BASE_ADDR + 0x300 + SZ_64K - 1, 76 .end = CS1_BASE_ADDR + 0x300 + SZ_64K - 1,
@@ -79,22 +79,25 @@ static struct resource smc911x_resources[] = {
79 [1] = { 79 [1] = {
80 .start = IOMUX_TO_IRQ(MX31_PIN_GPIO3_1), 80 .start = IOMUX_TO_IRQ(MX31_PIN_GPIO3_1),
81 .end = IOMUX_TO_IRQ(MX31_PIN_GPIO3_1), 81 .end = IOMUX_TO_IRQ(MX31_PIN_GPIO3_1),
82 .flags = IORESOURCE_IRQ, 82 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWLEVEL,
83 }, 83 },
84}; 84};
85 85
86static struct smc911x_platdata smc911x_info = { 86static struct smsc911x_platform_config smsc911x_info = {
87 .flags = SMC911X_USE_32BIT, 87 .flags = SMSC911X_USE_32BIT | SMSC911X_FORCE_INTERNAL_PHY |
88 .irq_flags = IRQF_SHARED | IRQF_TRIGGER_LOW, 88 SMSC911X_SAVE_MAC_ADDRESS,
89 .irq_polarity = SMSC911X_IRQ_POLARITY_ACTIVE_LOW,
90 .irq_type = SMSC911X_IRQ_TYPE_OPEN_DRAIN,
91 .phy_interface = PHY_INTERFACE_MODE_MII,
89}; 92};
90 93
91static struct platform_device pcm037_eth = { 94static struct platform_device pcm037_eth = {
92 .name = "smc911x", 95 .name = "smsc911x",
93 .id = -1, 96 .id = -1,
94 .num_resources = ARRAY_SIZE(smc911x_resources), 97 .num_resources = ARRAY_SIZE(smsc911x_resources),
95 .resource = smc911x_resources, 98 .resource = smsc911x_resources,
96 .dev = { 99 .dev = {
97 .platform_data = &smc911x_info, 100 .platform_data = &smsc911x_info,
98 }, 101 },
99}; 102};
100 103
diff --git a/arch/arm/mach-netx/include/mach/netx-regs.h b/arch/arm/mach-netx/include/mach/netx-regs.h
index 08c60ff227be..5a03e7ccb01a 100644
--- a/arch/arm/mach-netx/include/mach/netx-regs.h
+++ b/arch/arm/mach-netx/include/mach/netx-regs.h
@@ -80,7 +80,7 @@
80#define NETX_PA_XPEC(no) (NETX_IO_PHYS + NETX_OFS_XPEC(no)) 80#define NETX_PA_XPEC(no) (NETX_IO_PHYS + NETX_OFS_XPEC(no))
81#define NETX_PA_VIC (NETX_IO_PHYS + NETX_OFS_VIC) 81#define NETX_PA_VIC (NETX_IO_PHYS + NETX_OFS_VIC)
82 82
83/* virual addresses */ 83/* virtual addresses */
84#define NETX_VA_SYSTEM (NETX_IO_VIRT + NETX_OFS_SYSTEM) 84#define NETX_VA_SYSTEM (NETX_IO_VIRT + NETX_OFS_SYSTEM)
85#define NETX_VA_MEMCR (NETX_IO_VIRT + NETX_OFS_MEMCR) 85#define NETX_VA_MEMCR (NETX_IO_VIRT + NETX_OFS_MEMCR)
86#define NETX_VA_DPMAS (NETX_IO_VIRT + NETX_OFS_DPMAS) 86#define NETX_VA_DPMAS (NETX_IO_VIRT + NETX_OFS_DPMAS)
diff --git a/arch/arm/mach-omap1/Kconfig b/arch/arm/mach-omap1/Kconfig
index 3f325d3718a9..cd8de89c5fad 100644
--- a/arch/arm/mach-omap1/Kconfig
+++ b/arch/arm/mach-omap1/Kconfig
@@ -109,7 +109,7 @@ config MACH_OMAP_PALMZ71
109 help 109 help
110 Support for the Palm Zire71 PDA. To boot the kernel, 110 Support for the Palm Zire71 PDA. To boot the kernel,
111 you'll need a PalmOS compatible bootloader; check out 111 you'll need a PalmOS compatible bootloader; check out
112 http://hackndev.com/palm/z71 for more informations. 112 http://hackndev.com/palm/z71 for more information.
113 Say Y here if you have such a PDA, say N otherwise. 113 Say Y here if you have such a PDA, say N otherwise.
114 114
115config MACH_OMAP_PALMTT 115config MACH_OMAP_PALMTT
diff --git a/arch/arm/mach-omap2/Makefile b/arch/arm/mach-omap2/Makefile
index a2c3fcc27a22..c49d9bfa3abd 100644
--- a/arch/arm/mach-omap2/Makefile
+++ b/arch/arm/mach-omap2/Makefile
@@ -47,6 +47,8 @@ obj-$(CONFIG_MACH_OMAP_3430SDP) += board-3430sdp.o \
47 47
48obj-$(CONFIG_MACH_NOKIA_RX51) += board-rx51.o \ 48obj-$(CONFIG_MACH_NOKIA_RX51) += board-rx51.o \
49 board-rx51-peripherals.o \ 49 board-rx51-peripherals.o \
50 mmc-twl4030.o
51
50# Platform specific device init code 52# Platform specific device init code
51ifeq ($(CONFIG_USB_MUSB_SOC),y) 53ifeq ($(CONFIG_USB_MUSB_SOC),y)
52obj-y += usb-musb.o 54obj-y += usb-musb.o
diff --git a/arch/arm/mach-omap2/board-ldp.c b/arch/arm/mach-omap2/board-ldp.c
index e096f776f996..da57b0fcda14 100644
--- a/arch/arm/mach-omap2/board-ldp.c
+++ b/arch/arm/mach-omap2/board-ldp.c
@@ -23,6 +23,7 @@
23#include <linux/spi/ads7846.h> 23#include <linux/spi/ads7846.h>
24#include <linux/i2c/twl4030.h> 24#include <linux/i2c/twl4030.h>
25#include <linux/io.h> 25#include <linux/io.h>
26#include <linux/smsc911x.h>
26 27
27#include <mach/hardware.h> 28#include <mach/hardware.h>
28#include <asm/mach-types.h> 29#include <asm/mach-types.h>
@@ -41,12 +42,12 @@
41 42
42#include "mmc-twl4030.h" 43#include "mmc-twl4030.h"
43 44
44#define LDP_SMC911X_CS 1 45#define LDP_SMSC911X_CS 1
45#define LDP_SMC911X_GPIO 152 46#define LDP_SMSC911X_GPIO 152
46#define DEBUG_BASE 0x08000000 47#define DEBUG_BASE 0x08000000
47#define LDP_ETHR_START DEBUG_BASE 48#define LDP_ETHR_START DEBUG_BASE
48 49
49static struct resource ldp_smc911x_resources[] = { 50static struct resource ldp_smsc911x_resources[] = {
50 [0] = { 51 [0] = {
51 .start = LDP_ETHR_START, 52 .start = LDP_ETHR_START,
52 .end = LDP_ETHR_START + SZ_4K, 53 .end = LDP_ETHR_START + SZ_4K,
@@ -59,40 +60,50 @@ static struct resource ldp_smc911x_resources[] = {
59 }, 60 },
60}; 61};
61 62
62static struct platform_device ldp_smc911x_device = { 63static struct smsc911x_platform_config ldp_smsc911x_config = {
63 .name = "smc911x", 64 .irq_polarity = SMSC911X_IRQ_POLARITY_ACTIVE_LOW,
65 .irq_type = SMSC911X_IRQ_TYPE_OPEN_DRAIN,
66 .flags = SMSC911X_USE_32BIT,
67 .phy_interface = PHY_INTERFACE_MODE_MII,
68};
69
70static struct platform_device ldp_smsc911x_device = {
71 .name = "smsc911x",
64 .id = -1, 72 .id = -1,
65 .num_resources = ARRAY_SIZE(ldp_smc911x_resources), 73 .num_resources = ARRAY_SIZE(ldp_smsc911x_resources),
66 .resource = ldp_smc911x_resources, 74 .resource = ldp_smsc911x_resources,
75 .dev = {
76 .platform_data = &ldp_smsc911x_config,
77 },
67}; 78};
68 79
69static struct platform_device *ldp_devices[] __initdata = { 80static struct platform_device *ldp_devices[] __initdata = {
70 &ldp_smc911x_device, 81 &ldp_smsc911x_device,
71}; 82};
72 83
73static inline void __init ldp_init_smc911x(void) 84static inline void __init ldp_init_smsc911x(void)
74{ 85{
75 int eth_cs; 86 int eth_cs;
76 unsigned long cs_mem_base; 87 unsigned long cs_mem_base;
77 int eth_gpio = 0; 88 int eth_gpio = 0;
78 89
79 eth_cs = LDP_SMC911X_CS; 90 eth_cs = LDP_SMSC911X_CS;
80 91
81 if (gpmc_cs_request(eth_cs, SZ_16M, &cs_mem_base) < 0) { 92 if (gpmc_cs_request(eth_cs, SZ_16M, &cs_mem_base) < 0) {
82 printk(KERN_ERR "Failed to request GPMC mem for smc911x\n"); 93 printk(KERN_ERR "Failed to request GPMC mem for smsc911x\n");
83 return; 94 return;
84 } 95 }
85 96
86 ldp_smc911x_resources[0].start = cs_mem_base + 0x0; 97 ldp_smsc911x_resources[0].start = cs_mem_base + 0x0;
87 ldp_smc911x_resources[0].end = cs_mem_base + 0xff; 98 ldp_smsc911x_resources[0].end = cs_mem_base + 0xff;
88 udelay(100); 99 udelay(100);
89 100
90 eth_gpio = LDP_SMC911X_GPIO; 101 eth_gpio = LDP_SMSC911X_GPIO;
91 102
92 ldp_smc911x_resources[1].start = OMAP_GPIO_IRQ(eth_gpio); 103 ldp_smsc911x_resources[1].start = OMAP_GPIO_IRQ(eth_gpio);
93 104
94 if (gpio_request(eth_gpio, "smc911x irq") < 0) { 105 if (gpio_request(eth_gpio, "smsc911x irq") < 0) {
95 printk(KERN_ERR "Failed to request GPIO%d for smc911x IRQ\n", 106 printk(KERN_ERR "Failed to request GPIO%d for smsc911x IRQ\n",
96 eth_gpio); 107 eth_gpio);
97 return; 108 return;
98 } 109 }
@@ -104,7 +115,7 @@ static void __init omap_ldp_init_irq(void)
104 omap2_init_common_hw(NULL); 115 omap2_init_common_hw(NULL);
105 omap_init_irq(); 116 omap_init_irq();
106 omap_gpio_init(); 117 omap_gpio_init();
107 ldp_init_smc911x(); 118 ldp_init_smsc911x();
108} 119}
109 120
110static struct omap_uart_config ldp_uart_config __initdata = { 121static struct omap_uart_config ldp_uart_config __initdata = {
diff --git a/arch/arm/mach-omap2/board-overo.c b/arch/arm/mach-omap2/board-overo.c
index b3f6e9d81807..b1f23bea863f 100644
--- a/arch/arm/mach-omap2/board-overo.c
+++ b/arch/arm/mach-omap2/board-overo.c
@@ -57,6 +57,9 @@
57#define GPMC_CS0_BASE 0x60 57#define GPMC_CS0_BASE 0x60
58#define GPMC_CS_SIZE 0x30 58#define GPMC_CS_SIZE 0x30
59 59
60#define OVERO_SMSC911X_CS 5
61#define OVERO_SMSC911X_GPIO 176
62
60#if defined(CONFIG_TOUCHSCREEN_ADS7846) || \ 63#if defined(CONFIG_TOUCHSCREEN_ADS7846) || \
61 defined(CONFIG_TOUCHSCREEN_ADS7846_MODULE) 64 defined(CONFIG_TOUCHSCREEN_ADS7846_MODULE)
62 65
@@ -116,6 +119,67 @@ static void __init overo_ads7846_init(void)
116static inline void __init overo_ads7846_init(void) { return; } 119static inline void __init overo_ads7846_init(void) { return; }
117#endif 120#endif
118 121
122#if defined(CONFIG_SMSC911X) || defined(CONFIG_SMSC911X_MODULE)
123
124#include <linux/smsc911x.h>
125
126static struct resource overo_smsc911x_resources[] = {
127 {
128 .name = "smsc911x-memory",
129 .flags = IORESOURCE_MEM,
130 },
131 {
132 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWLEVEL,
133 },
134};
135
136static struct smsc911x_platform_config overo_smsc911x_config = {
137 .irq_polarity = SMSC911X_IRQ_POLARITY_ACTIVE_LOW,
138 .irq_type = SMSC911X_IRQ_TYPE_OPEN_DRAIN,
139 .flags = SMSC911X_USE_32BIT ,
140 .phy_interface = PHY_INTERFACE_MODE_MII,
141};
142
143static struct platform_device overo_smsc911x_device = {
144 .name = "smsc911x",
145 .id = -1,
146 .num_resources = ARRAY_SIZE(overo_smsc911x_resources),
147 .resource = &overo_smsc911x_resources,
148 .dev = {
149 .platform_data = &overo_smsc911x_config,
150 },
151};
152
153static inline void __init overo_init_smsc911x(void)
154{
155 unsigned long cs_mem_base;
156
157 if (gpmc_cs_request(OVERO_SMSC911X_CS, SZ_16M, &cs_mem_base) < 0) {
158 printk(KERN_ERR "Failed request for GPMC mem for smsc911x\n");
159 return;
160 }
161
162 overo_smsc911x_resources[0].start = cs_mem_base + 0x0;
163 overo_smsc911x_resources[0].end = cs_mem_base + 0xff;
164
165 if ((gpio_request(OVERO_SMSC911X_GPIO, "SMSC911X IRQ") == 0) &&
166 (gpio_direction_input(OVERO_SMSC911X_GPIO) == 0)) {
167 gpio_export(OVERO_SMSC911X_GPIO, 0);
168 } else {
169 printk(KERN_ERR "could not obtain gpio for SMSC911X IRQ\n");
170 return;
171 }
172
173 overo_smsc911x_resources[1].start = OMAP_GPIO_IRQ(OVERO_SMSC911X_GPIO);
174 overo_smsc911x_resources[1].end = 0;
175
176 platform_device_register(&overo_smsc911x_device);
177}
178
179#else
180static inline void __init overo_init_smsc911x(void) { return; }
181#endif
182
119static struct mtd_partition overo_nand_partitions[] = { 183static struct mtd_partition overo_nand_partitions[] = {
120 { 184 {
121 .name = "xloader", 185 .name = "xloader",
@@ -290,6 +354,7 @@ static void __init overo_init(void)
290 overo_flash_init(); 354 overo_flash_init();
291 usb_musb_init(); 355 usb_musb_init();
292 overo_ads7846_init(); 356 overo_ads7846_init();
357 overo_init_smsc911x();
293 358
294 if ((gpio_request(OVERO_GPIO_W2W_NRESET, 359 if ((gpio_request(OVERO_GPIO_W2W_NRESET,
295 "OVERO_GPIO_W2W_NRESET") == 0) && 360 "OVERO_GPIO_W2W_NRESET") == 0) &&
diff --git a/arch/arm/mach-realview/core.c b/arch/arm/mach-realview/core.c
index d6766685cfc7..9ab947c14f26 100644
--- a/arch/arm/mach-realview/core.c
+++ b/arch/arm/mach-realview/core.c
@@ -28,7 +28,7 @@
28#include <linux/clocksource.h> 28#include <linux/clocksource.h>
29#include <linux/clockchips.h> 29#include <linux/clockchips.h>
30#include <linux/io.h> 30#include <linux/io.h>
31#include <linux/smc911x.h> 31#include <linux/smsc911x.h>
32#include <linux/ata_platform.h> 32#include <linux/ata_platform.h>
33 33
34#include <asm/clkdev.h> 34#include <asm/clkdev.h>
@@ -128,14 +128,15 @@ int realview_flash_register(struct resource *res, u32 num)
128 return platform_device_register(&realview_flash_device); 128 return platform_device_register(&realview_flash_device);
129} 129}
130 130
131static struct smc911x_platdata realview_smc911x_platdata = { 131static struct smsc911x_platform_config smsc911x_config = {
132 .flags = SMC911X_USE_32BIT, 132 .flags = SMSC911X_USE_32BIT,
133 .irq_flags = IRQF_SHARED, 133 .irq_polarity = SMSC911X_IRQ_POLARITY_ACTIVE_HIGH,
134 .irq_polarity = 1, 134 .irq_type = SMSC911X_IRQ_TYPE_PUSH_PULL,
135 .phy_interface = PHY_INTERFACE_MODE_MII,
135}; 136};
136 137
137static struct platform_device realview_eth_device = { 138static struct platform_device realview_eth_device = {
138 .name = "smc911x", 139 .name = "smsc911x",
139 .id = 0, 140 .id = 0,
140 .num_resources = 2, 141 .num_resources = 2,
141}; 142};
@@ -145,8 +146,8 @@ int realview_eth_register(const char *name, struct resource *res)
145 if (name) 146 if (name)
146 realview_eth_device.name = name; 147 realview_eth_device.name = name;
147 realview_eth_device.resource = res; 148 realview_eth_device.resource = res;
148 if (strcmp(realview_eth_device.name, "smc911x") == 0) 149 if (strcmp(realview_eth_device.name, "smsc911x") == 0)
149 realview_eth_device.dev.platform_data = &realview_smc911x_platdata; 150 realview_eth_device.dev.platform_data = &smsc911x_config;
150 151
151 return platform_device_register(&realview_eth_device); 152 return platform_device_register(&realview_eth_device);
152} 153}
diff --git a/arch/arm/mach-realview/localtimer.c b/arch/arm/mach-realview/localtimer.c
index 67d6d9cc68b2..d0d39adf6407 100644
--- a/arch/arm/mach-realview/localtimer.c
+++ b/arch/arm/mach-realview/localtimer.c
@@ -191,6 +191,7 @@ void __cpuinit local_timer_setup(void)
191 clk->name = "dummy_timer"; 191 clk->name = "dummy_timer";
192 clk->features = CLOCK_EVT_FEAT_DUMMY; 192 clk->features = CLOCK_EVT_FEAT_DUMMY;
193 clk->rating = 200; 193 clk->rating = 200;
194 clk->mult = 1;
194 clk->set_mode = dummy_timer_set_mode; 195 clk->set_mode = dummy_timer_set_mode;
195 clk->broadcast = smp_timer_broadcast; 196 clk->broadcast = smp_timer_broadcast;
196 clk->cpumask = cpumask_of(cpu); 197 clk->cpumask = cpumask_of(cpu);
diff --git a/arch/arm/mm/abort-ev6.S b/arch/arm/mm/abort-ev6.S
index 94077fbd96b7..6f7e70907e44 100644
--- a/arch/arm/mm/abort-ev6.S
+++ b/arch/arm/mm/abort-ev6.S
@@ -29,10 +29,10 @@ ENTRY(v6_early_abort)
29 mrc p15, 0, r1, c5, c0, 0 @ get FSR 29 mrc p15, 0, r1, c5, c0, 0 @ get FSR
30 mrc p15, 0, r0, c6, c0, 0 @ get FAR 30 mrc p15, 0, r0, c6, c0, 0 @ get FAR
31/* 31/*
32 * Faulty SWP instruction on 1136 doesn't set bit 11 in DFSR. 32 * Faulty SWP instruction on 1136 doesn't set bit 11 in DFSR (erratum 326103).
33 * The test below covers all the write situations, including Java bytecodes 33 * The test below covers all the write situations, including Java bytecodes
34 */ 34 */
35 bic r1, r1, #1 << 11 | 1 << 10 @ clear bits 11 and 10 of FSR 35 bic r1, r1, #1 << 11 @ clear bit 11 of FSR
36 tst r3, #PSR_J_BIT @ Java? 36 tst r3, #PSR_J_BIT @ Java?
37 movne pc, lr 37 movne pc, lr
38 do_thumb_abort 38 do_thumb_abort
diff --git a/arch/arm/mm/cache-feroceon-l2.c b/arch/arm/mm/cache-feroceon-l2.c
index d6dd83826f8a..6e77c042d8e9 100644
--- a/arch/arm/mm/cache-feroceon-l2.c
+++ b/arch/arm/mm/cache-feroceon-l2.c
@@ -115,6 +115,10 @@ static inline void l2_inv_pa_range(unsigned long start, unsigned long end)
115 raw_local_irq_restore(flags); 115 raw_local_irq_restore(flags);
116} 116}
117 117
118static inline void l2_inv_all(void)
119{
120 __asm__("mcr p15, 1, %0, c15, c11, 0" : : "r" (0));
121}
118 122
119/* 123/*
120 * Linux primitives. 124 * Linux primitives.
@@ -254,9 +258,7 @@ static void __init enable_dcache(void)
254 258
255static void __init __invalidate_icache(void) 259static void __init __invalidate_icache(void)
256{ 260{
257 int dummy; 261 __asm__("mcr p15, 0, %0, c7, c5, 0" : : "r" (0));
258
259 __asm__ __volatile__("mcr p15, 0, %0, c7, c5, 0" : "=r" (dummy));
260} 262}
261 263
262static int __init invalidate_and_disable_icache(void) 264static int __init invalidate_and_disable_icache(void)
@@ -321,6 +323,7 @@ static void __init enable_l2(void)
321 323
322 d = flush_and_disable_dcache(); 324 d = flush_and_disable_dcache();
323 i = invalidate_and_disable_icache(); 325 i = invalidate_and_disable_icache();
326 l2_inv_all();
324 write_extra_features(u | 0x00400000); 327 write_extra_features(u | 0x00400000);
325 if (i) 328 if (i)
326 enable_icache(); 329 enable_icache();
diff --git a/arch/arm/vfp/entry.S b/arch/arm/vfp/entry.S
index ba592a9e6fb3..a2bed62aec21 100644
--- a/arch/arm/vfp/entry.S
+++ b/arch/arm/vfp/entry.S
@@ -15,13 +15,16 @@
15 * r10 = thread_info structure 15 * r10 = thread_info structure
16 * lr = failure return 16 * lr = failure return
17 */ 17 */
18#include <linux/linkage.h> 18#include <asm/thread_info.h>
19#include <linux/init.h>
20#include <asm/asm-offsets.h>
21#include <asm/assembler.h>
22#include <asm/vfpmacros.h> 19#include <asm/vfpmacros.h>
20#include "../kernel/entry-header.S"
23 21
24ENTRY(do_vfp) 22ENTRY(do_vfp)
23#ifdef CONFIG_PREEMPT
24 ldr r4, [r10, #TI_PREEMPT] @ get preempt count
25 add r11, r4, #1 @ increment it
26 str r11, [r10, #TI_PREEMPT]
27#endif
25 enable_irq 28 enable_irq
26 ldr r4, .LCvfp 29 ldr r4, .LCvfp
27 ldr r11, [r10, #TI_CPU] @ CPU number 30 ldr r11, [r10, #TI_CPU] @ CPU number
@@ -30,6 +33,12 @@ ENTRY(do_vfp)
30ENDPROC(do_vfp) 33ENDPROC(do_vfp)
31 34
32ENTRY(vfp_null_entry) 35ENTRY(vfp_null_entry)
36#ifdef CONFIG_PREEMPT
37 get_thread_info r10
38 ldr r4, [r10, #TI_PREEMPT] @ get preempt count
39 sub r11, r4, #1 @ decrement it
40 str r11, [r10, #TI_PREEMPT]
41#endif
33 mov pc, lr 42 mov pc, lr
34ENDPROC(vfp_null_entry) 43ENDPROC(vfp_null_entry)
35 44
@@ -41,6 +50,12 @@ ENDPROC(vfp_null_entry)
41 50
42 __INIT 51 __INIT
43ENTRY(vfp_testing_entry) 52ENTRY(vfp_testing_entry)
53#ifdef CONFIG_PREEMPT
54 get_thread_info r10
55 ldr r4, [r10, #TI_PREEMPT] @ get preempt count
56 sub r11, r4, #1 @ decrement it
57 str r11, [r10, #TI_PREEMPT]
58#endif
44 ldr r0, VFP_arch_address 59 ldr r0, VFP_arch_address
45 str r5, [r0] @ known non-zero value 60 str r5, [r0] @ known non-zero value
46 mov pc, r9 @ we have handled the fault 61 mov pc, r9 @ we have handled the fault
diff --git a/arch/arm/vfp/vfphw.S b/arch/arm/vfp/vfphw.S
index a5a4e57763c3..83c4e384b16d 100644
--- a/arch/arm/vfp/vfphw.S
+++ b/arch/arm/vfp/vfphw.S
@@ -137,6 +137,12 @@ check_for_exception:
137 VFPFMXR FPEXC, r1 @ restore FPEXC last 137 VFPFMXR FPEXC, r1 @ restore FPEXC last
138 sub r2, r2, #4 138 sub r2, r2, #4
139 str r2, [sp, #S_PC] @ retry the instruction 139 str r2, [sp, #S_PC] @ retry the instruction
140#ifdef CONFIG_PREEMPT
141 get_thread_info r10
142 ldr r4, [r10, #TI_PREEMPT] @ get preempt count
143 sub r11, r4, #1 @ decrement it
144 str r11, [r10, #TI_PREEMPT]
145#endif
140 mov pc, r9 @ we think we have handled things 146 mov pc, r9 @ we think we have handled things
141 147
142 148
@@ -155,6 +161,12 @@ look_for_VFP_exceptions:
155 @ not recognised by VFP 161 @ not recognised by VFP
156 162
157 DBGSTR "not VFP" 163 DBGSTR "not VFP"
164#ifdef CONFIG_PREEMPT
165 get_thread_info r10
166 ldr r4, [r10, #TI_PREEMPT] @ get preempt count
167 sub r11, r4, #1 @ decrement it
168 str r11, [r10, #TI_PREEMPT]
169#endif
158 mov pc, lr 170 mov pc, lr
159 171
160process_exception: 172process_exception:
diff --git a/arch/arm/vfp/vfpmodule.c b/arch/arm/vfp/vfpmodule.c
index 75457b30d813..01599c4ef726 100644
--- a/arch/arm/vfp/vfpmodule.c
+++ b/arch/arm/vfp/vfpmodule.c
@@ -266,7 +266,7 @@ void VFP_bounce(u32 trigger, u32 fpexc, struct pt_regs *regs)
266 * on VFP subarch 1. 266 * on VFP subarch 1.
267 */ 267 */
268 vfp_raise_exceptions(VFP_EXCEPTION_ERROR, trigger, fpscr, regs); 268 vfp_raise_exceptions(VFP_EXCEPTION_ERROR, trigger, fpscr, regs);
269 return; 269 goto exit;
270 } 270 }
271 271
272 /* 272 /*
@@ -297,7 +297,7 @@ void VFP_bounce(u32 trigger, u32 fpexc, struct pt_regs *regs)
297 * the FPEXC.FP2V bit is valid only if FPEXC.EX is 1. 297 * the FPEXC.FP2V bit is valid only if FPEXC.EX is 1.
298 */ 298 */
299 if (fpexc ^ (FPEXC_EX | FPEXC_FP2V)) 299 if (fpexc ^ (FPEXC_EX | FPEXC_FP2V))
300 return; 300 goto exit;
301 301
302 /* 302 /*
303 * The barrier() here prevents fpinst2 being read 303 * The barrier() here prevents fpinst2 being read
@@ -310,6 +310,8 @@ void VFP_bounce(u32 trigger, u32 fpexc, struct pt_regs *regs)
310 exceptions = vfp_emulate_instruction(trigger, orig_fpscr, regs); 310 exceptions = vfp_emulate_instruction(trigger, orig_fpscr, regs);
311 if (exceptions) 311 if (exceptions)
312 vfp_raise_exceptions(exceptions, trigger, orig_fpscr, regs); 312 vfp_raise_exceptions(exceptions, trigger, orig_fpscr, regs);
313 exit:
314 preempt_enable();
313} 315}
314 316
315static void vfp_enable(void *unused) 317static void vfp_enable(void *unused)
diff --git a/arch/avr32/Kconfig b/arch/avr32/Kconfig
index 05fe3053dcae..414a8ad97f52 100644
--- a/arch/avr32/Kconfig
+++ b/arch/avr32/Kconfig
@@ -127,13 +127,13 @@ config BOARD_HAMMERHEAD
127 select CPU_AT32AP7000 127 select CPU_AT32AP7000
128 select USB_ARCH_HAS_HCD 128 select USB_ARCH_HAS_HCD
129 help 129 help
130 The Hammerhead platform is built around a AVR32 32-bit microcontroller from Atmel. 130 The Hammerhead platform is built around an AVR32 32-bit microcontroller from Atmel.
131 It offers versatile peripherals, such as ethernet, usb device, usb host etc. 131 It offers versatile peripherals, such as ethernet, usb device, usb host etc.
132 132
133 The board also incooperates a power supply and is a Power over Ethernet (PoE) Powered 133 The board also incorporates a power supply and is a Power over Ethernet (PoE) Powered
134 Device (PD). 134 Device (PD).
135 135
136 Additonally, a Cyclone III FPGA from Altera is integrated on the board. The FPGA is 136 Additionally, a Cyclone III FPGA from Altera is integrated on the board. The FPGA is
137 mapped into the 32-bit AVR memory bus. The FPGA offers two DDR2 SDRAM interfaces, which 137 mapped into the 32-bit AVR memory bus. The FPGA offers two DDR2 SDRAM interfaces, which
138 will cover even the most exceptional need of memory bandwidth. Together with the onboard 138 will cover even the most exceptional need of memory bandwidth. Together with the onboard
139 video decoder the board is ready for video processing. 139 video decoder the board is ready for video processing.
diff --git a/arch/avr32/kernel/process.c b/arch/avr32/kernel/process.c
index 43ae555ecb33..1bbe1da54869 100644
--- a/arch/avr32/kernel/process.c
+++ b/arch/avr32/kernel/process.c
@@ -332,7 +332,7 @@ int dump_fpu(struct pt_regs *regs, elf_fpregset_t *fpu)
332 332
333asmlinkage void ret_from_fork(void); 333asmlinkage void ret_from_fork(void);
334 334
335int copy_thread(int nr, unsigned long clone_flags, unsigned long usp, 335int copy_thread(unsigned long clone_flags, unsigned long usp,
336 unsigned long unused, 336 unsigned long unused,
337 struct task_struct *p, struct pt_regs *regs) 337 struct task_struct *p, struct pt_regs *regs)
338{ 338{
diff --git a/arch/blackfin/Kconfig b/arch/blackfin/Kconfig
index 0c1f86e3e44a..3640cdc38aac 100644
--- a/arch/blackfin/Kconfig
+++ b/arch/blackfin/Kconfig
@@ -777,7 +777,7 @@ config CACHELINE_ALIGNED_L1
777 default n if BF54x 777 default n if BF54x
778 depends on !BF531 778 depends on !BF531
779 help 779 help
780 If enabled, cacheline_anligned data is linked 780 If enabled, cacheline_aligned data is linked
781 into L1 data memory. (less latency) 781 into L1 data memory. (less latency)
782 782
783config SYSCALL_TAB_L1 783config SYSCALL_TAB_L1
@@ -957,7 +957,7 @@ config MPU
957 memory they do not own. This comes at a performance penalty 957 memory they do not own. This comes at a performance penalty
958 and is recommended only for debugging. 958 and is recommended only for debugging.
959 959
960comment "Asynchonous Memory Configuration" 960comment "Asynchronous Memory Configuration"
961 961
962menu "EBIU_AMGCTL Global Control" 962menu "EBIU_AMGCTL Global Control"
963config C_AMCKEN 963config C_AMCKEN
@@ -989,7 +989,7 @@ config C_B3PEN
989 default n 989 default n
990 990
991choice 991choice
992 prompt"Enable Asynchonous Memory Banks" 992 prompt "Enable Asynchronous Memory Banks"
993 default C_AMBEN_ALL 993 default C_AMBEN_ALL
994 994
995config C_AMBEN 995config C_AMBEN
diff --git a/arch/blackfin/kernel/process.c b/arch/blackfin/kernel/process.c
index 33e2e8993f7f..f49427293ca1 100644
--- a/arch/blackfin/kernel/process.c
+++ b/arch/blackfin/kernel/process.c
@@ -193,7 +193,7 @@ asmlinkage int bfin_clone(struct pt_regs *regs)
193} 193}
194 194
195int 195int
196copy_thread(int nr, unsigned long clone_flags, 196copy_thread(unsigned long clone_flags,
197 unsigned long usp, unsigned long topstk, 197 unsigned long usp, unsigned long topstk,
198 struct task_struct *p, struct pt_regs *regs) 198 struct task_struct *p, struct pt_regs *regs)
199{ 199{
diff --git a/arch/cris/Kconfig b/arch/cris/Kconfig
index 3462245fe9fb..7adac388a771 100644
--- a/arch/cris/Kconfig
+++ b/arch/cris/Kconfig
@@ -438,7 +438,7 @@ config ETRAX_SERIAL_PORT0_DMA1_IN
438 help 438 help
439 Enables the DMA1 input channel for ser0 (ttyS0). 439 Enables the DMA1 input channel for ser0 (ttyS0).
440 If you do not enable DMA, an interrupt for each character will be 440 If you do not enable DMA, an interrupt for each character will be
441 used when receiveing data. 441 used when receiving data.
442 Normally you want to use DMA, unless you use the DMA channel for 442 Normally you want to use DMA, unless you use the DMA channel for
443 something else. 443 something else.
444 444
@@ -565,7 +565,7 @@ config ETRAX_SERIAL_PORT2_DMA7_IN
565 help 565 help
566 Enables the DMA7 input channel for ser2 (ttyS2). 566 Enables the DMA7 input channel for ser2 (ttyS2).
567 If you do not enable DMA, an interrupt for each character will be 567 If you do not enable DMA, an interrupt for each character will be
568 used when receiveing data. 568 used when receiving data.
569 Normally you want to use DMA, unless you use the DMA channel for 569 Normally you want to use DMA, unless you use the DMA channel for
570 something else. 570 something else.
571 571
@@ -604,7 +604,7 @@ config ETRAX_SERIAL_PORT3_DMA3_IN
604 help 604 help
605 Enables the DMA3 input channel for ser3 (ttyS3). 605 Enables the DMA3 input channel for ser3 (ttyS3).
606 If you do not enable DMA, an interrupt for each character will be 606 If you do not enable DMA, an interrupt for each character will be
607 used when receiveing data. 607 used when receiving data.
608 Normally you want to use DMA, unless you use the DMA channel for 608 Normally you want to use DMA, unless you use the DMA channel for
609 something else. 609 something else.
610 610
diff --git a/arch/cris/arch-v10/kernel/process.c b/arch/cris/arch-v10/kernel/process.c
index bd9b3ff63f6c..c4c69cf721e5 100644
--- a/arch/cris/arch-v10/kernel/process.c
+++ b/arch/cris/arch-v10/kernel/process.c
@@ -115,7 +115,7 @@ int kernel_thread(int (*fn)(void *), void * arg, unsigned long flags)
115 */ 115 */
116asmlinkage void ret_from_fork(void); 116asmlinkage void ret_from_fork(void);
117 117
118int copy_thread(int nr, unsigned long clone_flags, unsigned long usp, 118int copy_thread(unsigned long clone_flags, unsigned long usp,
119 unsigned long unused, 119 unsigned long unused,
120 struct task_struct *p, struct pt_regs *regs) 120 struct task_struct *p, struct pt_regs *regs)
121{ 121{
diff --git a/arch/cris/arch-v32/Kconfig b/arch/cris/arch-v32/Kconfig
index 005ed2b3f7f4..21bbd93be34f 100644
--- a/arch/cris/arch-v32/Kconfig
+++ b/arch/cris/arch-v32/Kconfig
@@ -28,7 +28,7 @@ config ETRAX_NBR_LED_GRP_ONE
28 help 28 help
29 Select this if you want one Ethernet LED group. This LED group 29 Select this if you want one Ethernet LED group. This LED group
30 can be used for one or more Ethernet interfaces. However, it is 30 can be used for one or more Ethernet interfaces. However, it is
31 recomended that each Ethernet interface use a dedicated LED group. 31 recommended that each Ethernet interface use a dedicated LED group.
32 32
33config ETRAX_NBR_LED_GRP_TWO 33config ETRAX_NBR_LED_GRP_TWO
34 bool "Use two LED groups" 34 bool "Use two LED groups"
diff --git a/arch/cris/arch-v32/drivers/Kconfig b/arch/cris/arch-v32/drivers/Kconfig
index 7a64fcef9d07..b9e328e688be 100644
--- a/arch/cris/arch-v32/drivers/Kconfig
+++ b/arch/cris/arch-v32/drivers/Kconfig
@@ -342,7 +342,7 @@ config ETRAX_SERIAL_PORT4_DMA9_IN
342 help 342 help
343 Enables the DMA9 input channel for ser4 (ttyS4). 343 Enables the DMA9 input channel for ser4 (ttyS4).
344 If you do not enable DMA, an interrupt for each character will be 344 If you do not enable DMA, an interrupt for each character will be
345 used when receiveing data. 345 used when receiving data.
346 Normally you want to use DMA, unless you use the DMA channel for 346 Normally you want to use DMA, unless you use the DMA channel for
347 something else. 347 something else.
348 348
diff --git a/arch/cris/arch-v32/kernel/process.c b/arch/cris/arch-v32/kernel/process.c
index ced5b725d9bd..120e7f796fea 100644
--- a/arch/cris/arch-v32/kernel/process.c
+++ b/arch/cris/arch-v32/kernel/process.c
@@ -131,7 +131,7 @@ kernel_thread(int (*fn)(void *), void * arg, unsigned long flags)
131extern asmlinkage void ret_from_fork(void); 131extern asmlinkage void ret_from_fork(void);
132 132
133int 133int
134copy_thread(int nr, unsigned long clone_flags, unsigned long usp, 134copy_thread(unsigned long clone_flags, unsigned long usp,
135 unsigned long unused, 135 unsigned long unused,
136 struct task_struct *p, struct pt_regs *regs) 136 struct task_struct *p, struct pt_regs *regs)
137{ 137{
diff --git a/arch/cris/arch-v32/mach-fs/Kconfig b/arch/cris/arch-v32/mach-fs/Kconfig
index f6d74475f1c6..774de82abef6 100644
--- a/arch/cris/arch-v32/mach-fs/Kconfig
+++ b/arch/cris/arch-v32/mach-fs/Kconfig
@@ -59,7 +59,7 @@ config ETRAX_SDRAM_GRP1_CONFIG
59 depends on ETRAX_ARCH_V32 59 depends on ETRAX_ARCH_V32
60 default "0" 60 default "0"
61 help 61 help
62 SDRAM configuration for group 1. The defult value is 0 62 SDRAM configuration for group 1. The default value is 0
63 because group 1 is not used in the default configuration, 63 because group 1 is not used in the default configuration,
64 described in the help for SDRAM_GRP0_CONFIG. 64 described in the help for SDRAM_GRP0_CONFIG.
65 65
diff --git a/arch/cris/include/arch-v32/arch/spinlock.h b/arch/cris/include/arch-v32/arch/spinlock.h
index 0d5709b983a1..129756b96661 100644
--- a/arch/cris/include/arch-v32/arch/spinlock.h
+++ b/arch/cris/include/arch-v32/arch/spinlock.h
@@ -121,6 +121,8 @@ static inline int __raw_write_trylock(raw_rwlock_t *rw)
121 return 1; 121 return 1;
122} 122}
123 123
124#define _raw_read_lock_flags(lock, flags) _raw_read_lock(lock)
125#define _raw_write_lock_flags(lock, flags) _raw_write_lock(lock)
124 126
125#define _raw_spin_relax(lock) cpu_relax() 127#define _raw_spin_relax(lock) cpu_relax()
126#define _raw_read_relax(lock) cpu_relax() 128#define _raw_read_relax(lock) cpu_relax()
diff --git a/arch/cris/kernel/process.c b/arch/cris/kernel/process.c
index 60816e876455..4df0b320d524 100644
--- a/arch/cris/kernel/process.c
+++ b/arch/cris/kernel/process.c
@@ -19,7 +19,6 @@
19#include <asm/system.h> 19#include <asm/system.h>
20#include <linux/module.h> 20#include <linux/module.h>
21#include <linux/spinlock.h> 21#include <linux/spinlock.h>
22#include <linux/fs_struct.h>
23#include <linux/init_task.h> 22#include <linux/init_task.h>
24#include <linux/sched.h> 23#include <linux/sched.h>
25#include <linux/fs.h> 24#include <linux/fs.h>
diff --git a/arch/frv/kernel/process.c b/arch/frv/kernel/process.c
index 9583a338e9d6..0de50df74970 100644
--- a/arch/frv/kernel/process.c
+++ b/arch/frv/kernel/process.c
@@ -204,7 +204,7 @@ void prepare_to_copy(struct task_struct *tsk)
204/* 204/*
205 * set up the kernel stack and exception frames for a new process 205 * set up the kernel stack and exception frames for a new process
206 */ 206 */
207int copy_thread(int nr, unsigned long clone_flags, 207int copy_thread(unsigned long clone_flags,
208 unsigned long usp, unsigned long topstk, 208 unsigned long usp, unsigned long topstk,
209 struct task_struct *p, struct pt_regs *regs) 209 struct task_struct *p, struct pt_regs *regs)
210{ 210{
diff --git a/arch/h8300/kernel/process.c b/arch/h8300/kernel/process.c
index a8ef654a5a0b..e2f33d0f9969 100644
--- a/arch/h8300/kernel/process.c
+++ b/arch/h8300/kernel/process.c
@@ -191,7 +191,7 @@ asmlinkage int h8300_clone(struct pt_regs *regs)
191 191
192} 192}
193 193
194int copy_thread(int nr, unsigned long clone_flags, 194int copy_thread(unsigned long clone_flags,
195 unsigned long usp, unsigned long topstk, 195 unsigned long usp, unsigned long topstk,
196 struct task_struct * p, struct pt_regs * regs) 196 struct task_struct * p, struct pt_regs * regs)
197{ 197{
diff --git a/arch/h8300/kernel/timer/tpu.c b/arch/h8300/kernel/timer/tpu.c
index ad383caae196..e7c6e614a758 100644
--- a/arch/h8300/kernel/timer/tpu.c
+++ b/arch/h8300/kernel/timer/tpu.c
@@ -67,7 +67,7 @@ static struct irqaction tpu_irq = {
67 .flags = IRQF_DISABLED | IRQF_TIMER, 67 .flags = IRQF_DISABLED | IRQF_TIMER,
68}; 68};
69 69
70const static int __initdata divide_rate[] = { 70static const int __initdata divide_rate[] = {
71#if CONFIG_H8300_TPU_CH == 0 71#if CONFIG_H8300_TPU_CH == 0
72 1,4,16,64,0,0,0,0, 72 1,4,16,64,0,0,0,0,
73#elif (CONFIG_H8300_TPU_CH == 1) || (CONFIG_H8300_TPU_CH == 5) 73#elif (CONFIG_H8300_TPU_CH == 1) || (CONFIG_H8300_TPU_CH == 5)
diff --git a/arch/ia64/configs/generic_defconfig b/arch/ia64/configs/generic_defconfig
index a109db30ce55..75645495c2dd 100644
--- a/arch/ia64/configs/generic_defconfig
+++ b/arch/ia64/configs/generic_defconfig
@@ -193,7 +193,6 @@ CONFIG_BOUNCE=y
193CONFIG_NR_QUICK=1 193CONFIG_NR_QUICK=1
194CONFIG_VIRT_TO_BUS=y 194CONFIG_VIRT_TO_BUS=y
195CONFIG_UNEVICTABLE_LRU=y 195CONFIG_UNEVICTABLE_LRU=y
196CONFIG_MMU_NOTIFIER=y
197CONFIG_ARCH_SELECT_MEMORY_MODEL=y 196CONFIG_ARCH_SELECT_MEMORY_MODEL=y
198CONFIG_ARCH_DISCONTIGMEM_ENABLE=y 197CONFIG_ARCH_DISCONTIGMEM_ENABLE=y
199CONFIG_ARCH_FLATMEM_ENABLE=y 198CONFIG_ARCH_FLATMEM_ENABLE=y
@@ -416,8 +415,6 @@ CONFIG_SGI_IOC4=y
416# CONFIG_ENCLOSURE_SERVICES is not set 415# CONFIG_ENCLOSURE_SERVICES is not set
417CONFIG_SGI_XP=m 416CONFIG_SGI_XP=m
418# CONFIG_HP_ILO is not set 417# CONFIG_HP_ILO is not set
419CONFIG_SGI_GRU=m
420# CONFIG_SGI_GRU_DEBUG is not set
421# CONFIG_C2PORT is not set 418# CONFIG_C2PORT is not set
422CONFIG_HAVE_IDE=y 419CONFIG_HAVE_IDE=y
423CONFIG_IDE=y 420CONFIG_IDE=y
diff --git a/arch/ia64/include/asm/intrinsics.h b/arch/ia64/include/asm/intrinsics.h
index c47830e26cb7..111ed5222892 100644
--- a/arch/ia64/include/asm/intrinsics.h
+++ b/arch/ia64/include/asm/intrinsics.h
@@ -202,7 +202,11 @@ extern long ia64_cmpxchg_called_with_bad_pointer (void);
202 202
203#ifndef __ASSEMBLY__ 203#ifndef __ASSEMBLY__
204#if defined(CONFIG_PARAVIRT) && defined(__KERNEL__) 204#if defined(CONFIG_PARAVIRT) && defined(__KERNEL__)
205#define IA64_INTRINSIC_API(name) pv_cpu_ops.name 205#ifdef ASM_SUPPORTED
206# define IA64_INTRINSIC_API(name) paravirt_ ## name
207#else
208# define IA64_INTRINSIC_API(name) pv_cpu_ops.name
209#endif
206#define IA64_INTRINSIC_MACRO(name) paravirt_ ## name 210#define IA64_INTRINSIC_MACRO(name) paravirt_ ## name
207#else 211#else
208#define IA64_INTRINSIC_API(name) ia64_native_ ## name 212#define IA64_INTRINSIC_API(name) ia64_native_ ## name
diff --git a/arch/ia64/include/asm/mmu_context.h b/arch/ia64/include/asm/mmu_context.h
index 040bc87db930..7f2a456603cb 100644
--- a/arch/ia64/include/asm/mmu_context.h
+++ b/arch/ia64/include/asm/mmu_context.h
@@ -87,7 +87,7 @@ get_mmu_context (struct mm_struct *mm)
87 /* re-check, now that we've got the lock: */ 87 /* re-check, now that we've got the lock: */
88 context = mm->context; 88 context = mm->context;
89 if (context == 0) { 89 if (context == 0) {
90 cpus_clear(mm->cpu_vm_mask); 90 cpumask_clear(mm_cpumask(mm));
91 if (ia64_ctx.next >= ia64_ctx.limit) { 91 if (ia64_ctx.next >= ia64_ctx.limit) {
92 ia64_ctx.next = find_next_zero_bit(ia64_ctx.bitmap, 92 ia64_ctx.next = find_next_zero_bit(ia64_ctx.bitmap,
93 ia64_ctx.max_ctx, ia64_ctx.next); 93 ia64_ctx.max_ctx, ia64_ctx.next);
@@ -166,8 +166,8 @@ activate_context (struct mm_struct *mm)
166 166
167 do { 167 do {
168 context = get_mmu_context(mm); 168 context = get_mmu_context(mm);
169 if (!cpu_isset(smp_processor_id(), mm->cpu_vm_mask)) 169 if (!cpumask_test_cpu(smp_processor_id(), mm_cpumask(mm)))
170 cpu_set(smp_processor_id(), mm->cpu_vm_mask); 170 cpumask_set_cpu(smp_processor_id(), mm_cpumask(mm));
171 reload_context(context); 171 reload_context(context);
172 /* 172 /*
173 * in the unlikely event of a TLB-flush by another thread, 173 * in the unlikely event of a TLB-flush by another thread,
diff --git a/arch/ia64/include/asm/module.h b/arch/ia64/include/asm/module.h
index d2da61e4c49b..908eaef42a08 100644
--- a/arch/ia64/include/asm/module.h
+++ b/arch/ia64/include/asm/module.h
@@ -16,6 +16,12 @@ struct mod_arch_specific {
16 struct elf64_shdr *got; /* global offset table */ 16 struct elf64_shdr *got; /* global offset table */
17 struct elf64_shdr *opd; /* official procedure descriptors */ 17 struct elf64_shdr *opd; /* official procedure descriptors */
18 struct elf64_shdr *unwind; /* unwind-table section */ 18 struct elf64_shdr *unwind; /* unwind-table section */
19#ifdef CONFIG_PARAVIRT
20 struct elf64_shdr *paravirt_bundles;
21 /* paravirt_alt_bundle_patch table */
22 struct elf64_shdr *paravirt_insts;
23 /* paravirt_alt_inst_patch table */
24#endif
19 unsigned long gp; /* global-pointer for module */ 25 unsigned long gp; /* global-pointer for module */
20 26
21 void *core_unw_table; /* core unwind-table cookie returned by unwinder */ 27 void *core_unw_table; /* core unwind-table cookie returned by unwinder */
diff --git a/arch/ia64/include/asm/native/inst.h b/arch/ia64/include/asm/native/inst.h
index 0a1026cca4fa..d2d46efb3e6e 100644
--- a/arch/ia64/include/asm/native/inst.h
+++ b/arch/ia64/include/asm/native/inst.h
@@ -30,6 +30,9 @@
30#define __paravirt_work_processed_syscall_target \ 30#define __paravirt_work_processed_syscall_target \
31 ia64_work_processed_syscall 31 ia64_work_processed_syscall
32 32
33#define paravirt_fsyscall_table ia64_native_fsyscall_table
34#define paravirt_fsys_bubble_down ia64_native_fsys_bubble_down
35
33#ifdef CONFIG_PARAVIRT_GUEST_ASM_CLOBBER_CHECK 36#ifdef CONFIG_PARAVIRT_GUEST_ASM_CLOBBER_CHECK
34# define PARAVIRT_POISON 0xdeadbeefbaadf00d 37# define PARAVIRT_POISON 0xdeadbeefbaadf00d
35# define CLOBBER(clob) \ 38# define CLOBBER(clob) \
@@ -74,6 +77,11 @@
74(pred) mov reg = psr \ 77(pred) mov reg = psr \
75 CLOBBER(clob) 78 CLOBBER(clob)
76 79
80#define MOV_FROM_ITC(pred, pred_clob, reg, clob) \
81(pred) mov reg = ar.itc \
82 CLOBBER(clob) \
83 CLOBBER_PRED(pred_clob)
84
77#define MOV_TO_IFA(reg, clob) \ 85#define MOV_TO_IFA(reg, clob) \
78 mov cr.ifa = reg \ 86 mov cr.ifa = reg \
79 CLOBBER(clob) 87 CLOBBER(clob)
@@ -158,6 +166,11 @@
158#define RSM_PSR_DT \ 166#define RSM_PSR_DT \
159 rsm psr.dt 167 rsm psr.dt
160 168
169#define RSM_PSR_BE_I(clob0, clob1) \
170 rsm psr.be | psr.i \
171 CLOBBER(clob0) \
172 CLOBBER(clob1)
173
161#define SSM_PSR_DT_AND_SRLZ_I \ 174#define SSM_PSR_DT_AND_SRLZ_I \
162 ssm psr.dt \ 175 ssm psr.dt \
163 ;; \ 176 ;; \
diff --git a/arch/ia64/include/asm/native/patchlist.h b/arch/ia64/include/asm/native/patchlist.h
new file mode 100644
index 000000000000..be16ca9311bf
--- /dev/null
+++ b/arch/ia64/include/asm/native/patchlist.h
@@ -0,0 +1,38 @@
1/******************************************************************************
2 * arch/ia64/include/asm/native/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#define __paravirt_start_gate_fsyscall_patchlist \
24 __ia64_native_start_gate_fsyscall_patchlist
25#define __paravirt_end_gate_fsyscall_patchlist \
26 __ia64_native_end_gate_fsyscall_patchlist
27#define __paravirt_start_gate_brl_fsys_bubble_down_patchlist \
28 __ia64_native_start_gate_brl_fsys_bubble_down_patchlist
29#define __paravirt_end_gate_brl_fsys_bubble_down_patchlist \
30 __ia64_native_end_gate_brl_fsys_bubble_down_patchlist
31#define __paravirt_start_gate_vtop_patchlist \
32 __ia64_native_start_gate_vtop_patchlist
33#define __paravirt_end_gate_vtop_patchlist \
34 __ia64_native_end_gate_vtop_patchlist
35#define __paravirt_start_gate_mckinley_e9_patchlist \
36 __ia64_native_start_gate_mckinley_e9_patchlist
37#define __paravirt_end_gate_mckinley_e9_patchlist \
38 __ia64_native_end_gate_mckinley_e9_patchlist
diff --git a/arch/ia64/include/asm/native/pvchk_inst.h b/arch/ia64/include/asm/native/pvchk_inst.h
index b8e6eb1090d7..8d72962ec838 100644
--- a/arch/ia64/include/asm/native/pvchk_inst.h
+++ b/arch/ia64/include/asm/native/pvchk_inst.h
@@ -180,6 +180,11 @@
180 IS_PRED_IN(pred) \ 180 IS_PRED_IN(pred) \
181 IS_RREG_OUT(reg) \ 181 IS_RREG_OUT(reg) \
182 IS_RREG_CLOB(clob) 182 IS_RREG_CLOB(clob)
183#define MOV_FROM_ITC(pred, pred_clob, reg, clob) \
184 IS_PRED_IN(pred) \
185 IS_PRED_CLOB(pred_clob) \
186 IS_RREG_OUT(reg) \
187 IS_RREG_CLOB(clob)
183#define MOV_TO_IFA(reg, clob) \ 188#define MOV_TO_IFA(reg, clob) \
184 IS_RREG_IN(reg) \ 189 IS_RREG_IN(reg) \
185 IS_RREG_CLOB(clob) 190 IS_RREG_CLOB(clob)
@@ -246,6 +251,9 @@
246 IS_RREG_CLOB(clob2) 251 IS_RREG_CLOB(clob2)
247#define RSM_PSR_DT \ 252#define RSM_PSR_DT \
248 nop 0 253 nop 0
254#define RSM_PSR_BE_I(clob0, clob1) \
255 IS_RREG_CLOB(clob0) \
256 IS_RREG_CLOB(clob1)
249#define SSM_PSR_DT_AND_SRLZ_I \ 257#define SSM_PSR_DT_AND_SRLZ_I \
250 nop 0 258 nop 0
251#define BSW_0(clob0, clob1, clob2) \ 259#define BSW_0(clob0, clob1, clob2) \
diff --git a/arch/ia64/include/asm/paravirt.h b/arch/ia64/include/asm/paravirt.h
index 2bf3636473fe..2eb0a981a09a 100644
--- a/arch/ia64/include/asm/paravirt.h
+++ b/arch/ia64/include/asm/paravirt.h
@@ -22,6 +22,56 @@
22#ifndef __ASM_PARAVIRT_H 22#ifndef __ASM_PARAVIRT_H
23#define __ASM_PARAVIRT_H 23#define __ASM_PARAVIRT_H
24 24
25#ifndef __ASSEMBLY__
26/******************************************************************************
27 * fsys related addresses
28 */
29struct pv_fsys_data {
30 unsigned long *fsyscall_table;
31 void *fsys_bubble_down;
32};
33
34extern struct pv_fsys_data pv_fsys_data;
35
36unsigned long *paravirt_get_fsyscall_table(void);
37char *paravirt_get_fsys_bubble_down(void);
38
39/******************************************************************************
40 * patchlist addresses for gate page
41 */
42enum pv_gate_patchlist {
43 PV_GATE_START_FSYSCALL,
44 PV_GATE_END_FSYSCALL,
45
46 PV_GATE_START_BRL_FSYS_BUBBLE_DOWN,
47 PV_GATE_END_BRL_FSYS_BUBBLE_DOWN,
48
49 PV_GATE_START_VTOP,
50 PV_GATE_END_VTOP,
51
52 PV_GATE_START_MCKINLEY_E9,
53 PV_GATE_END_MCKINLEY_E9,
54};
55
56struct pv_patchdata {
57 unsigned long start_fsyscall_patchlist;
58 unsigned long end_fsyscall_patchlist;
59 unsigned long start_brl_fsys_bubble_down_patchlist;
60 unsigned long end_brl_fsys_bubble_down_patchlist;
61 unsigned long start_vtop_patchlist;
62 unsigned long end_vtop_patchlist;
63 unsigned long start_mckinley_e9_patchlist;
64 unsigned long end_mckinley_e9_patchlist;
65
66 void *gate_section;
67};
68
69extern struct pv_patchdata pv_patchdata;
70
71unsigned long paravirt_get_gate_patchlist(enum pv_gate_patchlist type);
72void *paravirt_get_gate_section(void);
73#endif
74
25#ifdef CONFIG_PARAVIRT_GUEST 75#ifdef CONFIG_PARAVIRT_GUEST
26 76
27#define PARAVIRT_HYPERVISOR_TYPE_DEFAULT 0 77#define PARAVIRT_HYPERVISOR_TYPE_DEFAULT 0
@@ -68,6 +118,14 @@ struct pv_init_ops {
68 int (*arch_setup_nomca)(void); 118 int (*arch_setup_nomca)(void);
69 119
70 void (*post_smp_prepare_boot_cpu)(void); 120 void (*post_smp_prepare_boot_cpu)(void);
121
122#ifdef ASM_SUPPORTED
123 unsigned long (*patch_bundle)(void *sbundle, void *ebundle,
124 unsigned long type);
125 unsigned long (*patch_inst)(unsigned long stag, unsigned long etag,
126 unsigned long type);
127#endif
128 void (*patch_branch)(unsigned long tag, unsigned long type);
71}; 129};
72 130
73extern struct pv_init_ops pv_init_ops; 131extern struct pv_init_ops pv_init_ops;
@@ -210,6 +268,8 @@ struct pv_time_ops {
210 int (*do_steal_accounting)(unsigned long *new_itm); 268 int (*do_steal_accounting)(unsigned long *new_itm);
211 269
212 void (*clocksource_resume)(void); 270 void (*clocksource_resume)(void);
271
272 unsigned long long (*sched_clock)(void);
213}; 273};
214 274
215extern struct pv_time_ops pv_time_ops; 275extern struct pv_time_ops pv_time_ops;
@@ -227,6 +287,11 @@ paravirt_do_steal_accounting(unsigned long *new_itm)
227 return pv_time_ops.do_steal_accounting(new_itm); 287 return pv_time_ops.do_steal_accounting(new_itm);
228} 288}
229 289
290static inline unsigned long long paravirt_sched_clock(void)
291{
292 return pv_time_ops.sched_clock();
293}
294
230#endif /* !__ASSEMBLY__ */ 295#endif /* !__ASSEMBLY__ */
231 296
232#else 297#else
diff --git a/arch/ia64/include/asm/paravirt_patch.h b/arch/ia64/include/asm/paravirt_patch.h
new file mode 100644
index 000000000000..128ff5db6e67
--- /dev/null
+++ b/arch/ia64/include/asm/paravirt_patch.h
@@ -0,0 +1,143 @@
1/******************************************************************************
2 * Copyright (c) 2008 Isaku Yamahata <yamahata at valinux co jp>
3 * VA Linux Systems Japan K.K.
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 *
19 */
20
21#ifndef __ASM_PARAVIRT_PATCH_H
22#define __ASM_PARAVIRT_PATCH_H
23
24#ifdef __ASSEMBLY__
25
26 .section .paravirt_branches, "a"
27 .previous
28#define PARAVIRT_PATCH_SITE_BR(type) \
29 { \
30 [1:] ; \
31 br.cond.sptk.many 2f ; \
32 nop.b 0 ; \
33 nop.b 0;; ; \
34 } ; \
35 2: \
36 .xdata8 ".paravirt_branches", 1b, type
37
38#else
39
40#include <linux/stringify.h>
41#include <asm/intrinsics.h>
42
43/* for binary patch */
44struct paravirt_patch_site_bundle {
45 void *sbundle;
46 void *ebundle;
47 unsigned long type;
48};
49
50/* label means the beginning of new bundle */
51#define paravirt_alt_bundle(instr, privop) \
52 "\t998:\n" \
53 "\t" instr "\n" \
54 "\t999:\n" \
55 "\t.pushsection .paravirt_bundles, \"a\"\n" \
56 "\t.popsection\n" \
57 "\t.xdata8 \".paravirt_bundles\", 998b, 999b, " \
58 __stringify(privop) "\n"
59
60
61struct paravirt_patch_bundle_elem {
62 const void *sbundle;
63 const void *ebundle;
64 unsigned long type;
65};
66
67
68struct paravirt_patch_site_inst {
69 unsigned long stag;
70 unsigned long etag;
71 unsigned long type;
72};
73
74#define paravirt_alt_inst(instr, privop) \
75 "\t[998:]\n" \
76 "\t" instr "\n" \
77 "\t[999:]\n" \
78 "\t.pushsection .paravirt_insts, \"a\"\n" \
79 "\t.popsection\n" \
80 "\t.xdata8 \".paravirt_insts\", 998b, 999b, " \
81 __stringify(privop) "\n"
82
83struct paravirt_patch_site_branch {
84 unsigned long tag;
85 unsigned long type;
86};
87
88struct paravirt_patch_branch_target {
89 const void *entry;
90 unsigned long type;
91};
92
93void
94__paravirt_patch_apply_branch(
95 unsigned long tag, unsigned long type,
96 const struct paravirt_patch_branch_target *entries,
97 unsigned int nr_entries);
98
99void
100paravirt_patch_reloc_br(unsigned long tag, const void *target);
101
102void
103paravirt_patch_reloc_brl(unsigned long tag, const void *target);
104
105
106#if defined(ASM_SUPPORTED) && defined(CONFIG_PARAVIRT)
107unsigned long
108ia64_native_patch_bundle(void *sbundle, void *ebundle, unsigned long type);
109
110unsigned long
111__paravirt_patch_apply_bundle(void *sbundle, void *ebundle, unsigned long type,
112 const struct paravirt_patch_bundle_elem *elems,
113 unsigned long nelems,
114 const struct paravirt_patch_bundle_elem **found);
115
116void
117paravirt_patch_apply_bundle(const struct paravirt_patch_site_bundle *start,
118 const struct paravirt_patch_site_bundle *end);
119
120void
121paravirt_patch_apply_inst(const struct paravirt_patch_site_inst *start,
122 const struct paravirt_patch_site_inst *end);
123
124void paravirt_patch_apply(void);
125#else
126#define paravirt_patch_apply_bundle(start, end) do { } while (0)
127#define paravirt_patch_apply_inst(start, end) do { } while (0)
128#define paravirt_patch_apply() do { } while (0)
129#endif
130
131#endif /* !__ASSEMBLEY__ */
132
133#endif /* __ASM_PARAVIRT_PATCH_H */
134
135/*
136 * Local variables:
137 * mode: C
138 * c-set-style: "linux"
139 * c-basic-offset: 8
140 * tab-width: 8
141 * indent-tabs-mode: t
142 * End:
143 */
diff --git a/arch/ia64/include/asm/paravirt_privop.h b/arch/ia64/include/asm/paravirt_privop.h
index 33c8e55f5775..3d2951130b5f 100644
--- a/arch/ia64/include/asm/paravirt_privop.h
+++ b/arch/ia64/include/asm/paravirt_privop.h
@@ -33,7 +33,7 @@
33 */ 33 */
34 34
35struct pv_cpu_ops { 35struct pv_cpu_ops {
36 void (*fc)(unsigned long addr); 36 void (*fc)(void *addr);
37 unsigned long (*thash)(unsigned long addr); 37 unsigned long (*thash)(unsigned long addr);
38 unsigned long (*get_cpuid)(int index); 38 unsigned long (*get_cpuid)(int index);
39 unsigned long (*get_pmd)(int index); 39 unsigned long (*get_pmd)(int index);
@@ -60,12 +60,18 @@ extern unsigned long ia64_native_getreg_func(int regnum);
60/* Instructions paravirtualized for performance */ 60/* Instructions paravirtualized for performance */
61/************************************************/ 61/************************************************/
62 62
63#ifndef ASM_SUPPORTED
64#define paravirt_ssm_i() pv_cpu_ops.ssm_i()
65#define paravirt_rsm_i() pv_cpu_ops.rsm_i()
66#define __paravirt_getreg() pv_cpu_ops.getreg()
67#endif
68
63/* mask for ia64_native_ssm/rsm() must be constant.("i" constraing). 69/* mask for ia64_native_ssm/rsm() must be constant.("i" constraing).
64 * static inline function doesn't satisfy it. */ 70 * static inline function doesn't satisfy it. */
65#define paravirt_ssm(mask) \ 71#define paravirt_ssm(mask) \
66 do { \ 72 do { \
67 if ((mask) == IA64_PSR_I) \ 73 if ((mask) == IA64_PSR_I) \
68 pv_cpu_ops.ssm_i(); \ 74 paravirt_ssm_i(); \
69 else \ 75 else \
70 ia64_native_ssm(mask); \ 76 ia64_native_ssm(mask); \
71 } while (0) 77 } while (0)
@@ -73,7 +79,7 @@ extern unsigned long ia64_native_getreg_func(int regnum);
73#define paravirt_rsm(mask) \ 79#define paravirt_rsm(mask) \
74 do { \ 80 do { \
75 if ((mask) == IA64_PSR_I) \ 81 if ((mask) == IA64_PSR_I) \
76 pv_cpu_ops.rsm_i(); \ 82 paravirt_rsm_i(); \
77 else \ 83 else \
78 ia64_native_rsm(mask); \ 84 ia64_native_rsm(mask); \
79 } while (0) 85 } while (0)
@@ -86,7 +92,7 @@ extern unsigned long ia64_native_getreg_func(int regnum);
86 if ((reg) == _IA64_REG_IP) \ 92 if ((reg) == _IA64_REG_IP) \
87 res = ia64_native_getreg(_IA64_REG_IP); \ 93 res = ia64_native_getreg(_IA64_REG_IP); \
88 else \ 94 else \
89 res = pv_cpu_ops.getreg(reg); \ 95 res = __paravirt_getreg(reg); \
90 res; \ 96 res; \
91 }) 97 })
92 98
@@ -112,6 +118,12 @@ void paravirt_cpu_asm_init(const struct pv_cpu_asm_switch *cpu_asm_switch);
112 118
113#endif /* CONFIG_PARAVIRT */ 119#endif /* CONFIG_PARAVIRT */
114 120
121#if defined(CONFIG_PARAVIRT) && defined(ASM_SUPPORTED)
122#define paravirt_dv_serialize_data() ia64_dv_serialize_data()
123#else
124#define paravirt_dv_serialize_data() /* nothing */
125#endif
126
115/* these routines utilize privilege-sensitive or performance-sensitive 127/* these routines utilize privilege-sensitive or performance-sensitive
116 * privileged instructions so the code must be replaced with 128 * privileged instructions so the code must be replaced with
117 * paravirtualized versions */ 129 * paravirtualized versions */
@@ -121,4 +133,349 @@ void paravirt_cpu_asm_init(const struct pv_cpu_asm_switch *cpu_asm_switch);
121 IA64_PARAVIRT_ASM_FUNC(work_processed_syscall) 133 IA64_PARAVIRT_ASM_FUNC(work_processed_syscall)
122#define ia64_leave_kernel IA64_PARAVIRT_ASM_FUNC(leave_kernel) 134#define ia64_leave_kernel IA64_PARAVIRT_ASM_FUNC(leave_kernel)
123 135
136
137#if defined(CONFIG_PARAVIRT)
138/******************************************************************************
139 * binary patching infrastructure
140 */
141#define PARAVIRT_PATCH_TYPE_FC 1
142#define PARAVIRT_PATCH_TYPE_THASH 2
143#define PARAVIRT_PATCH_TYPE_GET_CPUID 3
144#define PARAVIRT_PATCH_TYPE_GET_PMD 4
145#define PARAVIRT_PATCH_TYPE_PTCGA 5
146#define PARAVIRT_PATCH_TYPE_GET_RR 6
147#define PARAVIRT_PATCH_TYPE_SET_RR 7
148#define PARAVIRT_PATCH_TYPE_SET_RR0_TO_RR4 8
149#define PARAVIRT_PATCH_TYPE_SSM_I 9
150#define PARAVIRT_PATCH_TYPE_RSM_I 10
151#define PARAVIRT_PATCH_TYPE_GET_PSR_I 11
152#define PARAVIRT_PATCH_TYPE_INTRIN_LOCAL_IRQ_RESTORE 12
153
154/* PARAVIRT_PATY_TYPE_[GS]ETREG + _IA64_REG_xxx */
155#define PARAVIRT_PATCH_TYPE_GETREG 0x10000000
156#define PARAVIRT_PATCH_TYPE_SETREG 0x20000000
157
158/*
159 * struct task_struct* (*ia64_switch_to)(void* next_task);
160 * void *ia64_leave_syscall;
161 * void *ia64_work_processed_syscall
162 * void *ia64_leave_kernel;
163 */
164
165#define PARAVIRT_PATCH_TYPE_BR_START 0x30000000
166#define PARAVIRT_PATCH_TYPE_BR_SWITCH_TO \
167 (PARAVIRT_PATCH_TYPE_BR_START + 0)
168#define PARAVIRT_PATCH_TYPE_BR_LEAVE_SYSCALL \
169 (PARAVIRT_PATCH_TYPE_BR_START + 1)
170#define PARAVIRT_PATCH_TYPE_BR_WORK_PROCESSED_SYSCALL \
171 (PARAVIRT_PATCH_TYPE_BR_START + 2)
172#define PARAVIRT_PATCH_TYPE_BR_LEAVE_KERNEL \
173 (PARAVIRT_PATCH_TYPE_BR_START + 3)
174
175#ifdef ASM_SUPPORTED
176#include <asm/paravirt_patch.h>
177
178/*
179 * pv_cpu_ops calling stub.
180 * normal function call convension can't be written by gcc
181 * inline assembly.
182 *
183 * from the caller's point of view,
184 * the following registers will be clobbered.
185 * r2, r3
186 * r8-r15
187 * r16, r17
188 * b6, b7
189 * p6-p15
190 * ar.ccv
191 *
192 * from the callee's point of view ,
193 * the following registers can be used.
194 * r2, r3: scratch
195 * r8: scratch, input argument0 and return value
196 * r0-r15: scratch, input argument1-5
197 * b6: return pointer
198 * b7: scratch
199 * p6-p15: scratch
200 * ar.ccv: scratch
201 *
202 * other registers must not be changed. especially
203 * b0: rp: preserved. gcc ignores b0 in clobbered register.
204 * r16: saved gp
205 */
206/* 5 bundles */
207#define __PARAVIRT_BR \
208 ";;\n" \
209 "{ .mlx\n" \
210 "nop 0\n" \
211 "movl r2 = %[op_addr]\n"/* get function pointer address */ \
212 ";;\n" \
213 "}\n" \
214 "1:\n" \
215 "{ .mii\n" \
216 "ld8 r2 = [r2]\n" /* load function descriptor address */ \
217 "mov r17 = ip\n" /* get ip to calc return address */ \
218 "mov r16 = gp\n" /* save gp */ \
219 ";;\n" \
220 "}\n" \
221 "{ .mii\n" \
222 "ld8 r3 = [r2], 8\n" /* load entry address */ \
223 "adds r17 = 1f - 1b, r17\n" /* calculate return address */ \
224 ";;\n" \
225 "mov b7 = r3\n" /* set entry address */ \
226 "}\n" \
227 "{ .mib\n" \
228 "ld8 gp = [r2]\n" /* load gp value */ \
229 "mov b6 = r17\n" /* set return address */ \
230 "br.cond.sptk.few b7\n" /* intrinsics are very short isns */ \
231 "}\n" \
232 "1:\n" \
233 "{ .mii\n" \
234 "mov gp = r16\n" /* restore gp value */ \
235 "nop 0\n" \
236 "nop 0\n" \
237 ";;\n" \
238 "}\n"
239
240#define PARAVIRT_OP(op) \
241 [op_addr] "i"(&pv_cpu_ops.op)
242
243#define PARAVIRT_TYPE(type) \
244 PARAVIRT_PATCH_TYPE_ ## type
245
246#define PARAVIRT_REG_CLOBBERS0 \
247 "r2", "r3", /*"r8",*/ "r9", "r10", "r11", "r14", \
248 "r15", "r16", "r17"
249
250#define PARAVIRT_REG_CLOBBERS1 \
251 "r2","r3", /*"r8",*/ "r9", "r10", "r11", "r14", \
252 "r15", "r16", "r17"
253
254#define PARAVIRT_REG_CLOBBERS2 \
255 "r2", "r3", /*"r8", "r9",*/ "r10", "r11", "r14", \
256 "r15", "r16", "r17"
257
258#define PARAVIRT_REG_CLOBBERS5 \
259 "r2", "r3", /*"r8", "r9", "r10", "r11", "r14",*/ \
260 "r15", "r16", "r17"
261
262#define PARAVIRT_BR_CLOBBERS \
263 "b6", "b7"
264
265#define PARAVIRT_PR_CLOBBERS \
266 "p6", "p7", "p8", "p9", "p10", "p11", "p12", "p13", "p14", "p15"
267
268#define PARAVIRT_AR_CLOBBERS \
269 "ar.ccv"
270
271#define PARAVIRT_CLOBBERS0 \
272 PARAVIRT_REG_CLOBBERS0, \
273 PARAVIRT_BR_CLOBBERS, \
274 PARAVIRT_PR_CLOBBERS, \
275 PARAVIRT_AR_CLOBBERS, \
276 "memory"
277
278#define PARAVIRT_CLOBBERS1 \
279 PARAVIRT_REG_CLOBBERS1, \
280 PARAVIRT_BR_CLOBBERS, \
281 PARAVIRT_PR_CLOBBERS, \
282 PARAVIRT_AR_CLOBBERS, \
283 "memory"
284
285#define PARAVIRT_CLOBBERS2 \
286 PARAVIRT_REG_CLOBBERS2, \
287 PARAVIRT_BR_CLOBBERS, \
288 PARAVIRT_PR_CLOBBERS, \
289 PARAVIRT_AR_CLOBBERS, \
290 "memory"
291
292#define PARAVIRT_CLOBBERS5 \
293 PARAVIRT_REG_CLOBBERS5, \
294 PARAVIRT_BR_CLOBBERS, \
295 PARAVIRT_PR_CLOBBERS, \
296 PARAVIRT_AR_CLOBBERS, \
297 "memory"
298
299#define PARAVIRT_BR0(op, type) \
300 register unsigned long ia64_clobber asm ("r8"); \
301 asm volatile (paravirt_alt_bundle(__PARAVIRT_BR, \
302 PARAVIRT_TYPE(type)) \
303 : "=r"(ia64_clobber) \
304 : PARAVIRT_OP(op) \
305 : PARAVIRT_CLOBBERS0)
306
307#define PARAVIRT_BR0_RET(op, type) \
308 register unsigned long ia64_intri_res asm ("r8"); \
309 asm volatile (paravirt_alt_bundle(__PARAVIRT_BR, \
310 PARAVIRT_TYPE(type)) \
311 : "=r"(ia64_intri_res) \
312 : PARAVIRT_OP(op) \
313 : PARAVIRT_CLOBBERS0)
314
315#define PARAVIRT_BR1(op, type, arg1) \
316 register unsigned long __##arg1 asm ("r8") = arg1; \
317 register unsigned long ia64_clobber asm ("r8"); \
318 asm volatile (paravirt_alt_bundle(__PARAVIRT_BR, \
319 PARAVIRT_TYPE(type)) \
320 : "=r"(ia64_clobber) \
321 : PARAVIRT_OP(op), "0"(__##arg1) \
322 : PARAVIRT_CLOBBERS1)
323
324#define PARAVIRT_BR1_RET(op, type, arg1) \
325 register unsigned long ia64_intri_res asm ("r8"); \
326 register unsigned long __##arg1 asm ("r8") = arg1; \
327 asm volatile (paravirt_alt_bundle(__PARAVIRT_BR, \
328 PARAVIRT_TYPE(type)) \
329 : "=r"(ia64_intri_res) \
330 : PARAVIRT_OP(op), "0"(__##arg1) \
331 : PARAVIRT_CLOBBERS1)
332
333#define PARAVIRT_BR1_VOID(op, type, arg1) \
334 register void *__##arg1 asm ("r8") = arg1; \
335 register unsigned long ia64_clobber asm ("r8"); \
336 asm volatile (paravirt_alt_bundle(__PARAVIRT_BR, \
337 PARAVIRT_TYPE(type)) \
338 : "=r"(ia64_clobber) \
339 : PARAVIRT_OP(op), "0"(__##arg1) \
340 : PARAVIRT_CLOBBERS1)
341
342#define PARAVIRT_BR2(op, type, arg1, arg2) \
343 register unsigned long __##arg1 asm ("r8") = arg1; \
344 register unsigned long __##arg2 asm ("r9") = arg2; \
345 register unsigned long ia64_clobber1 asm ("r8"); \
346 register unsigned long ia64_clobber2 asm ("r9"); \
347 asm volatile (paravirt_alt_bundle(__PARAVIRT_BR, \
348 PARAVIRT_TYPE(type)) \
349 : "=r"(ia64_clobber1), "=r"(ia64_clobber2) \
350 : PARAVIRT_OP(op), "0"(__##arg1), "1"(__##arg2) \
351 : PARAVIRT_CLOBBERS2)
352
353
354#define PARAVIRT_DEFINE_CPU_OP0(op, type) \
355 static inline void \
356 paravirt_ ## op (void) \
357 { \
358 PARAVIRT_BR0(op, type); \
359 }
360
361#define PARAVIRT_DEFINE_CPU_OP0_RET(op, type) \
362 static inline unsigned long \
363 paravirt_ ## op (void) \
364 { \
365 PARAVIRT_BR0_RET(op, type); \
366 return ia64_intri_res; \
367 }
368
369#define PARAVIRT_DEFINE_CPU_OP1_VOID(op, type) \
370 static inline void \
371 paravirt_ ## op (void *arg1) \
372 { \
373 PARAVIRT_BR1_VOID(op, type, arg1); \
374 }
375
376#define PARAVIRT_DEFINE_CPU_OP1(op, type) \
377 static inline void \
378 paravirt_ ## op (unsigned long arg1) \
379 { \
380 PARAVIRT_BR1(op, type, arg1); \
381 }
382
383#define PARAVIRT_DEFINE_CPU_OP1_RET(op, type) \
384 static inline unsigned long \
385 paravirt_ ## op (unsigned long arg1) \
386 { \
387 PARAVIRT_BR1_RET(op, type, arg1); \
388 return ia64_intri_res; \
389 }
390
391#define PARAVIRT_DEFINE_CPU_OP2(op, type) \
392 static inline void \
393 paravirt_ ## op (unsigned long arg1, \
394 unsigned long arg2) \
395 { \
396 PARAVIRT_BR2(op, type, arg1, arg2); \
397 }
398
399
400PARAVIRT_DEFINE_CPU_OP1_VOID(fc, FC);
401PARAVIRT_DEFINE_CPU_OP1_RET(thash, THASH)
402PARAVIRT_DEFINE_CPU_OP1_RET(get_cpuid, GET_CPUID)
403PARAVIRT_DEFINE_CPU_OP1_RET(get_pmd, GET_PMD)
404PARAVIRT_DEFINE_CPU_OP2(ptcga, PTCGA)
405PARAVIRT_DEFINE_CPU_OP1_RET(get_rr, GET_RR)
406PARAVIRT_DEFINE_CPU_OP2(set_rr, SET_RR)
407PARAVIRT_DEFINE_CPU_OP0(ssm_i, SSM_I)
408PARAVIRT_DEFINE_CPU_OP0(rsm_i, RSM_I)
409PARAVIRT_DEFINE_CPU_OP0_RET(get_psr_i, GET_PSR_I)
410PARAVIRT_DEFINE_CPU_OP1(intrin_local_irq_restore, INTRIN_LOCAL_IRQ_RESTORE)
411
412static inline void
413paravirt_set_rr0_to_rr4(unsigned long val0, unsigned long val1,
414 unsigned long val2, unsigned long val3,
415 unsigned long val4)
416{
417 register unsigned long __val0 asm ("r8") = val0;
418 register unsigned long __val1 asm ("r9") = val1;
419 register unsigned long __val2 asm ("r10") = val2;
420 register unsigned long __val3 asm ("r11") = val3;
421 register unsigned long __val4 asm ("r14") = val4;
422
423 register unsigned long ia64_clobber0 asm ("r8");
424 register unsigned long ia64_clobber1 asm ("r9");
425 register unsigned long ia64_clobber2 asm ("r10");
426 register unsigned long ia64_clobber3 asm ("r11");
427 register unsigned long ia64_clobber4 asm ("r14");
428
429 asm volatile (paravirt_alt_bundle(__PARAVIRT_BR,
430 PARAVIRT_TYPE(SET_RR0_TO_RR4))
431 : "=r"(ia64_clobber0),
432 "=r"(ia64_clobber1),
433 "=r"(ia64_clobber2),
434 "=r"(ia64_clobber3),
435 "=r"(ia64_clobber4)
436 : PARAVIRT_OP(set_rr0_to_rr4),
437 "0"(__val0), "1"(__val1), "2"(__val2),
438 "3"(__val3), "4"(__val4)
439 : PARAVIRT_CLOBBERS5);
440}
441
442/* unsigned long paravirt_getreg(int reg) */
443#define __paravirt_getreg(reg) \
444 ({ \
445 register unsigned long ia64_intri_res asm ("r8"); \
446 register unsigned long __reg asm ("r8") = (reg); \
447 \
448 BUILD_BUG_ON(!__builtin_constant_p(reg)); \
449 asm volatile (paravirt_alt_bundle(__PARAVIRT_BR, \
450 PARAVIRT_TYPE(GETREG) \
451 + (reg)) \
452 : "=r"(ia64_intri_res) \
453 : PARAVIRT_OP(getreg), "0"(__reg) \
454 : PARAVIRT_CLOBBERS1); \
455 \
456 ia64_intri_res; \
457 })
458
459/* void paravirt_setreg(int reg, unsigned long val) */
460#define paravirt_setreg(reg, val) \
461 do { \
462 register unsigned long __val asm ("r8") = val; \
463 register unsigned long __reg asm ("r9") = reg; \
464 register unsigned long ia64_clobber1 asm ("r8"); \
465 register unsigned long ia64_clobber2 asm ("r9"); \
466 \
467 BUILD_BUG_ON(!__builtin_constant_p(reg)); \
468 asm volatile (paravirt_alt_bundle(__PARAVIRT_BR, \
469 PARAVIRT_TYPE(SETREG) \
470 + (reg)) \
471 : "=r"(ia64_clobber1), \
472 "=r"(ia64_clobber2) \
473 : PARAVIRT_OP(setreg), \
474 "1"(__reg), "0"(__val) \
475 : PARAVIRT_CLOBBERS2); \
476 } while (0)
477
478#endif /* ASM_SUPPORTED */
479#endif /* CONFIG_PARAVIRT && ASM_SUPPOTED */
480
124#endif /* _ASM_IA64_PARAVIRT_PRIVOP_H */ 481#endif /* _ASM_IA64_PARAVIRT_PRIVOP_H */
diff --git a/arch/ia64/include/asm/smp.h b/arch/ia64/include/asm/smp.h
index 21c402365d0e..598408336251 100644
--- a/arch/ia64/include/asm/smp.h
+++ b/arch/ia64/include/asm/smp.h
@@ -126,7 +126,8 @@ extern void identify_siblings (struct cpuinfo_ia64 *);
126extern int is_multithreading_enabled(void); 126extern int is_multithreading_enabled(void);
127 127
128extern void arch_send_call_function_single_ipi(int cpu); 128extern void arch_send_call_function_single_ipi(int cpu);
129extern void arch_send_call_function_ipi(cpumask_t mask); 129extern void arch_send_call_function_ipi_mask(const struct cpumask *mask);
130#define arch_send_call_function_ipi_mask arch_send_call_function_ipi_mask
130 131
131#else /* CONFIG_SMP */ 132#else /* CONFIG_SMP */
132 133
diff --git a/arch/ia64/include/asm/spinlock.h b/arch/ia64/include/asm/spinlock.h
index 0229fb95fb38..13ab71576bc7 100644
--- a/arch/ia64/include/asm/spinlock.h
+++ b/arch/ia64/include/asm/spinlock.h
@@ -120,6 +120,38 @@ do { \
120#define __raw_read_can_lock(rw) (*(volatile int *)(rw) >= 0) 120#define __raw_read_can_lock(rw) (*(volatile int *)(rw) >= 0)
121#define __raw_write_can_lock(rw) (*(volatile int *)(rw) == 0) 121#define __raw_write_can_lock(rw) (*(volatile int *)(rw) == 0)
122 122
123#ifdef ASM_SUPPORTED
124
125static __always_inline void
126__raw_read_lock_flags(raw_rwlock_t *lock, unsigned long flags)
127{
128 __asm__ __volatile__ (
129 "tbit.nz p6, p0 = %1,%2\n"
130 "br.few 3f\n"
131 "1:\n"
132 "fetchadd4.rel r2 = [%0], -1;;\n"
133 "(p6) ssm psr.i\n"
134 "2:\n"
135 "hint @pause\n"
136 "ld4 r2 = [%0];;\n"
137 "cmp4.lt p7,p0 = r2, r0\n"
138 "(p7) br.cond.spnt.few 2b\n"
139 "(p6) rsm psr.i\n"
140 ";;\n"
141 "3:\n"
142 "fetchadd4.acq r2 = [%0], 1;;\n"
143 "cmp4.lt p7,p0 = r2, r0\n"
144 "(p7) br.cond.spnt.few 1b\n"
145 : : "r"(lock), "r"(flags), "i"(IA64_PSR_I_BIT)
146 : "p6", "p7", "r2", "memory");
147}
148
149#define __raw_read_lock(lock) __raw_read_lock_flags(lock, 0)
150
151#else /* !ASM_SUPPORTED */
152
153#define __raw_read_lock_flags(rw, flags) __raw_read_lock(rw)
154
123#define __raw_read_lock(rw) \ 155#define __raw_read_lock(rw) \
124do { \ 156do { \
125 raw_rwlock_t *__read_lock_ptr = (rw); \ 157 raw_rwlock_t *__read_lock_ptr = (rw); \
@@ -131,6 +163,8 @@ do { \
131 } \ 163 } \
132} while (0) 164} while (0)
133 165
166#endif /* !ASM_SUPPORTED */
167
134#define __raw_read_unlock(rw) \ 168#define __raw_read_unlock(rw) \
135do { \ 169do { \
136 raw_rwlock_t *__read_lock_ptr = (rw); \ 170 raw_rwlock_t *__read_lock_ptr = (rw); \
@@ -138,20 +172,33 @@ do { \
138} while (0) 172} while (0)
139 173
140#ifdef ASM_SUPPORTED 174#ifdef ASM_SUPPORTED
141#define __raw_write_lock(rw) \ 175
142do { \ 176static __always_inline void
143 __asm__ __volatile__ ( \ 177__raw_write_lock_flags(raw_rwlock_t *lock, unsigned long flags)
144 "mov ar.ccv = r0\n" \ 178{
145 "dep r29 = -1, r0, 31, 1;;\n" \ 179 __asm__ __volatile__ (
146 "1:\n" \ 180 "tbit.nz p6, p0 = %1, %2\n"
147 "ld4 r2 = [%0];;\n" \ 181 "mov ar.ccv = r0\n"
148 "cmp4.eq p0,p7 = r0,r2\n" \ 182 "dep r29 = -1, r0, 31, 1\n"
149 "(p7) br.cond.spnt.few 1b \n" \ 183 "br.few 3f;;\n"
150 "cmpxchg4.acq r2 = [%0], r29, ar.ccv;;\n" \ 184 "1:\n"
151 "cmp4.eq p0,p7 = r0, r2\n" \ 185 "(p6) ssm psr.i\n"
152 "(p7) br.cond.spnt.few 1b;;\n" \ 186 "2:\n"
153 :: "r"(rw) : "ar.ccv", "p7", "r2", "r29", "memory"); \ 187 "hint @pause\n"
154} while(0) 188 "ld4 r2 = [%0];;\n"
189 "cmp4.eq p0,p7 = r0, r2\n"
190 "(p7) br.cond.spnt.few 2b\n"
191 "(p6) rsm psr.i\n"
192 ";;\n"
193 "3:\n"
194 "cmpxchg4.acq r2 = [%0], r29, ar.ccv;;\n"
195 "cmp4.eq p0,p7 = r0, r2\n"
196 "(p7) br.cond.spnt.few 1b;;\n"
197 : : "r"(lock), "r"(flags), "i"(IA64_PSR_I_BIT)
198 : "ar.ccv", "p6", "p7", "r2", "r29", "memory");
199}
200
201#define __raw_write_lock(rw) __raw_write_lock_flags(rw, 0)
155 202
156#define __raw_write_trylock(rw) \ 203#define __raw_write_trylock(rw) \
157({ \ 204({ \
@@ -174,6 +221,8 @@ static inline void __raw_write_unlock(raw_rwlock_t *x)
174 221
175#else /* !ASM_SUPPORTED */ 222#else /* !ASM_SUPPORTED */
176 223
224#define __raw_write_lock_flags(l, flags) __raw_write_lock(l)
225
177#define __raw_write_lock(l) \ 226#define __raw_write_lock(l) \
178({ \ 227({ \
179 __u64 ia64_val, ia64_set_val = ia64_dep_mi(-1, 0, 31, 1); \ 228 __u64 ia64_val, ia64_set_val = ia64_dep_mi(-1, 0, 31, 1); \
diff --git a/arch/ia64/include/asm/timex.h b/arch/ia64/include/asm/timex.h
index 4e03cfe74a0c..86c7db861180 100644
--- a/arch/ia64/include/asm/timex.h
+++ b/arch/ia64/include/asm/timex.h
@@ -40,5 +40,6 @@ get_cycles (void)
40} 40}
41 41
42extern void ia64_cpu_local_tick (void); 42extern void ia64_cpu_local_tick (void);
43extern unsigned long long ia64_native_sched_clock (void);
43 44
44#endif /* _ASM_IA64_TIMEX_H */ 45#endif /* _ASM_IA64_TIMEX_H */
diff --git a/arch/ia64/include/asm/topology.h b/arch/ia64/include/asm/topology.h
index f260dcf21515..7b4c8c70b2d1 100644
--- a/arch/ia64/include/asm/topology.h
+++ b/arch/ia64/include/asm/topology.h
@@ -112,11 +112,6 @@ void build_cpu_to_node_map(void);
112 112
113extern void arch_fix_phys_package_id(int num, u32 slot); 113extern void arch_fix_phys_package_id(int num, u32 slot);
114 114
115#define pcibus_to_cpumask(bus) (pcibus_to_node(bus) == -1 ? \
116 CPU_MASK_ALL : \
117 node_to_cpumask(pcibus_to_node(bus)) \
118 )
119
120#define cpumask_of_pcibus(bus) (pcibus_to_node(bus) == -1 ? \ 115#define cpumask_of_pcibus(bus) (pcibus_to_node(bus) == -1 ? \
121 cpu_all_mask : \ 116 cpu_all_mask : \
122 cpumask_of_node(pcibus_to_node(bus))) 117 cpumask_of_node(pcibus_to_node(bus)))
diff --git a/arch/ia64/include/asm/uv/uv_hub.h b/arch/ia64/include/asm/uv/uv_hub.h
index f607018af4a1..53e9dfacd073 100644
--- a/arch/ia64/include/asm/uv/uv_hub.h
+++ b/arch/ia64/include/asm/uv/uv_hub.h
@@ -305,5 +305,11 @@ static inline int uv_num_possible_blades(void)
305 return 1; 305 return 1;
306} 306}
307 307
308static inline void uv_hub_send_ipi(int pnode, int apicid, int vector)
309{
310 /* not currently needed on ia64 */
311}
312
313
308#endif /* __ASM_IA64_UV_HUB__ */ 314#endif /* __ASM_IA64_UV_HUB__ */
309 315
diff --git a/arch/ia64/include/asm/uv/uv_mmrs.h b/arch/ia64/include/asm/uv/uv_mmrs.h
index c149ef085437..fe0b8f05e1a8 100644
--- a/arch/ia64/include/asm/uv/uv_mmrs.h
+++ b/arch/ia64/include/asm/uv/uv_mmrs.h
@@ -8,8 +8,8 @@
8 * Copyright (C) 2007-2008 Silicon Graphics, Inc. All rights reserved. 8 * Copyright (C) 2007-2008 Silicon Graphics, Inc. All rights reserved.
9 */ 9 */
10 10
11#ifndef __ASM_IA64_UV_MMRS__ 11#ifndef _ASM_IA64_UV_UV_MMRS_H
12#define __ASM_IA64_UV_MMRS__ 12#define _ASM_IA64_UV_UV_MMRS_H
13 13
14#define UV_MMR_ENABLE (1UL << 63) 14#define UV_MMR_ENABLE (1UL << 63)
15 15
@@ -243,6 +243,158 @@ union uvh_event_occurred0_u {
243#define UVH_EVENT_OCCURRED0_ALIAS_32 0x005f0 243#define UVH_EVENT_OCCURRED0_ALIAS_32 0x005f0
244 244
245/* ========================================================================= */ 245/* ========================================================================= */
246/* UVH_GR0_TLB_INT0_CONFIG */
247/* ========================================================================= */
248#define UVH_GR0_TLB_INT0_CONFIG 0x61b00UL
249
250#define UVH_GR0_TLB_INT0_CONFIG_VECTOR_SHFT 0
251#define UVH_GR0_TLB_INT0_CONFIG_VECTOR_MASK 0x00000000000000ffUL
252#define UVH_GR0_TLB_INT0_CONFIG_DM_SHFT 8
253#define UVH_GR0_TLB_INT0_CONFIG_DM_MASK 0x0000000000000700UL
254#define UVH_GR0_TLB_INT0_CONFIG_DESTMODE_SHFT 11
255#define UVH_GR0_TLB_INT0_CONFIG_DESTMODE_MASK 0x0000000000000800UL
256#define UVH_GR0_TLB_INT0_CONFIG_STATUS_SHFT 12
257#define UVH_GR0_TLB_INT0_CONFIG_STATUS_MASK 0x0000000000001000UL
258#define UVH_GR0_TLB_INT0_CONFIG_P_SHFT 13
259#define UVH_GR0_TLB_INT0_CONFIG_P_MASK 0x0000000000002000UL
260#define UVH_GR0_TLB_INT0_CONFIG_T_SHFT 15
261#define UVH_GR0_TLB_INT0_CONFIG_T_MASK 0x0000000000008000UL
262#define UVH_GR0_TLB_INT0_CONFIG_M_SHFT 16
263#define UVH_GR0_TLB_INT0_CONFIG_M_MASK 0x0000000000010000UL
264#define UVH_GR0_TLB_INT0_CONFIG_APIC_ID_SHFT 32
265#define UVH_GR0_TLB_INT0_CONFIG_APIC_ID_MASK 0xffffffff00000000UL
266
267union uvh_gr0_tlb_int0_config_u {
268 unsigned long v;
269 struct uvh_gr0_tlb_int0_config_s {
270 unsigned long vector_ : 8; /* RW */
271 unsigned long dm : 3; /* RW */
272 unsigned long destmode : 1; /* RW */
273 unsigned long status : 1; /* RO */
274 unsigned long p : 1; /* RO */
275 unsigned long rsvd_14 : 1; /* */
276 unsigned long t : 1; /* RO */
277 unsigned long m : 1; /* RW */
278 unsigned long rsvd_17_31: 15; /* */
279 unsigned long apic_id : 32; /* RW */
280 } s;
281};
282
283/* ========================================================================= */
284/* UVH_GR0_TLB_INT1_CONFIG */
285/* ========================================================================= */
286#define UVH_GR0_TLB_INT1_CONFIG 0x61b40UL
287
288#define UVH_GR0_TLB_INT1_CONFIG_VECTOR_SHFT 0
289#define UVH_GR0_TLB_INT1_CONFIG_VECTOR_MASK 0x00000000000000ffUL
290#define UVH_GR0_TLB_INT1_CONFIG_DM_SHFT 8
291#define UVH_GR0_TLB_INT1_CONFIG_DM_MASK 0x0000000000000700UL
292#define UVH_GR0_TLB_INT1_CONFIG_DESTMODE_SHFT 11
293#define UVH_GR0_TLB_INT1_CONFIG_DESTMODE_MASK 0x0000000000000800UL
294#define UVH_GR0_TLB_INT1_CONFIG_STATUS_SHFT 12
295#define UVH_GR0_TLB_INT1_CONFIG_STATUS_MASK 0x0000000000001000UL
296#define UVH_GR0_TLB_INT1_CONFIG_P_SHFT 13
297#define UVH_GR0_TLB_INT1_CONFIG_P_MASK 0x0000000000002000UL
298#define UVH_GR0_TLB_INT1_CONFIG_T_SHFT 15
299#define UVH_GR0_TLB_INT1_CONFIG_T_MASK 0x0000000000008000UL
300#define UVH_GR0_TLB_INT1_CONFIG_M_SHFT 16
301#define UVH_GR0_TLB_INT1_CONFIG_M_MASK 0x0000000000010000UL
302#define UVH_GR0_TLB_INT1_CONFIG_APIC_ID_SHFT 32
303#define UVH_GR0_TLB_INT1_CONFIG_APIC_ID_MASK 0xffffffff00000000UL
304
305union uvh_gr0_tlb_int1_config_u {
306 unsigned long v;
307 struct uvh_gr0_tlb_int1_config_s {
308 unsigned long vector_ : 8; /* RW */
309 unsigned long dm : 3; /* RW */
310 unsigned long destmode : 1; /* RW */
311 unsigned long status : 1; /* RO */
312 unsigned long p : 1; /* RO */
313 unsigned long rsvd_14 : 1; /* */
314 unsigned long t : 1; /* RO */
315 unsigned long m : 1; /* RW */
316 unsigned long rsvd_17_31: 15; /* */
317 unsigned long apic_id : 32; /* RW */
318 } s;
319};
320
321/* ========================================================================= */
322/* UVH_GR1_TLB_INT0_CONFIG */
323/* ========================================================================= */
324#define UVH_GR1_TLB_INT0_CONFIG 0x61f00UL
325
326#define UVH_GR1_TLB_INT0_CONFIG_VECTOR_SHFT 0
327#define UVH_GR1_TLB_INT0_CONFIG_VECTOR_MASK 0x00000000000000ffUL
328#define UVH_GR1_TLB_INT0_CONFIG_DM_SHFT 8
329#define UVH_GR1_TLB_INT0_CONFIG_DM_MASK 0x0000000000000700UL
330#define UVH_GR1_TLB_INT0_CONFIG_DESTMODE_SHFT 11
331#define UVH_GR1_TLB_INT0_CONFIG_DESTMODE_MASK 0x0000000000000800UL
332#define UVH_GR1_TLB_INT0_CONFIG_STATUS_SHFT 12
333#define UVH_GR1_TLB_INT0_CONFIG_STATUS_MASK 0x0000000000001000UL
334#define UVH_GR1_TLB_INT0_CONFIG_P_SHFT 13
335#define UVH_GR1_TLB_INT0_CONFIG_P_MASK 0x0000000000002000UL
336#define UVH_GR1_TLB_INT0_CONFIG_T_SHFT 15
337#define UVH_GR1_TLB_INT0_CONFIG_T_MASK 0x0000000000008000UL
338#define UVH_GR1_TLB_INT0_CONFIG_M_SHFT 16
339#define UVH_GR1_TLB_INT0_CONFIG_M_MASK 0x0000000000010000UL
340#define UVH_GR1_TLB_INT0_CONFIG_APIC_ID_SHFT 32
341#define UVH_GR1_TLB_INT0_CONFIG_APIC_ID_MASK 0xffffffff00000000UL
342
343union uvh_gr1_tlb_int0_config_u {
344 unsigned long v;
345 struct uvh_gr1_tlb_int0_config_s {
346 unsigned long vector_ : 8; /* RW */
347 unsigned long dm : 3; /* RW */
348 unsigned long destmode : 1; /* RW */
349 unsigned long status : 1; /* RO */
350 unsigned long p : 1; /* RO */
351 unsigned long rsvd_14 : 1; /* */
352 unsigned long t : 1; /* RO */
353 unsigned long m : 1; /* RW */
354 unsigned long rsvd_17_31: 15; /* */
355 unsigned long apic_id : 32; /* RW */
356 } s;
357};
358
359/* ========================================================================= */
360/* UVH_GR1_TLB_INT1_CONFIG */
361/* ========================================================================= */
362#define UVH_GR1_TLB_INT1_CONFIG 0x61f40UL
363
364#define UVH_GR1_TLB_INT1_CONFIG_VECTOR_SHFT 0
365#define UVH_GR1_TLB_INT1_CONFIG_VECTOR_MASK 0x00000000000000ffUL
366#define UVH_GR1_TLB_INT1_CONFIG_DM_SHFT 8
367#define UVH_GR1_TLB_INT1_CONFIG_DM_MASK 0x0000000000000700UL
368#define UVH_GR1_TLB_INT1_CONFIG_DESTMODE_SHFT 11
369#define UVH_GR1_TLB_INT1_CONFIG_DESTMODE_MASK 0x0000000000000800UL
370#define UVH_GR1_TLB_INT1_CONFIG_STATUS_SHFT 12
371#define UVH_GR1_TLB_INT1_CONFIG_STATUS_MASK 0x0000000000001000UL
372#define UVH_GR1_TLB_INT1_CONFIG_P_SHFT 13
373#define UVH_GR1_TLB_INT1_CONFIG_P_MASK 0x0000000000002000UL
374#define UVH_GR1_TLB_INT1_CONFIG_T_SHFT 15
375#define UVH_GR1_TLB_INT1_CONFIG_T_MASK 0x0000000000008000UL
376#define UVH_GR1_TLB_INT1_CONFIG_M_SHFT 16
377#define UVH_GR1_TLB_INT1_CONFIG_M_MASK 0x0000000000010000UL
378#define UVH_GR1_TLB_INT1_CONFIG_APIC_ID_SHFT 32
379#define UVH_GR1_TLB_INT1_CONFIG_APIC_ID_MASK 0xffffffff00000000UL
380
381union uvh_gr1_tlb_int1_config_u {
382 unsigned long v;
383 struct uvh_gr1_tlb_int1_config_s {
384 unsigned long vector_ : 8; /* RW */
385 unsigned long dm : 3; /* RW */
386 unsigned long destmode : 1; /* RW */
387 unsigned long status : 1; /* RO */
388 unsigned long p : 1; /* RO */
389 unsigned long rsvd_14 : 1; /* */
390 unsigned long t : 1; /* RO */
391 unsigned long m : 1; /* RW */
392 unsigned long rsvd_17_31: 15; /* */
393 unsigned long apic_id : 32; /* RW */
394 } s;
395};
396
397/* ========================================================================= */
246/* UVH_INT_CMPB */ 398/* UVH_INT_CMPB */
247/* ========================================================================= */ 399/* ========================================================================= */
248#define UVH_INT_CMPB 0x22080UL 400#define UVH_INT_CMPB 0x22080UL
@@ -670,4 +822,4 @@ union uvh_si_alias2_overlay_config_u {
670}; 822};
671 823
672 824
673#endif /* __ASM_IA64_UV_MMRS__ */ 825#endif /* _ASM_IA64_UV_UV_MMRS_H */
diff --git a/arch/ia64/include/asm/xen/hypervisor.h b/arch/ia64/include/asm/xen/hypervisor.h
index 7a804e80fc67..e425227a418e 100644
--- a/arch/ia64/include/asm/xen/hypervisor.h
+++ b/arch/ia64/include/asm/xen/hypervisor.h
@@ -33,9 +33,6 @@
33#ifndef _ASM_IA64_XEN_HYPERVISOR_H 33#ifndef _ASM_IA64_XEN_HYPERVISOR_H
34#define _ASM_IA64_XEN_HYPERVISOR_H 34#define _ASM_IA64_XEN_HYPERVISOR_H
35 35
36#ifdef CONFIG_XEN
37
38#include <linux/init.h>
39#include <xen/interface/xen.h> 36#include <xen/interface/xen.h>
40#include <xen/interface/version.h> /* to compile feature.c */ 37#include <xen/interface/version.h> /* to compile feature.c */
41#include <xen/features.h> /* to comiple xen-netfront.c */ 38#include <xen/features.h> /* to comiple xen-netfront.c */
@@ -43,22 +40,32 @@
43 40
44/* xen_domain_type is set before executing any C code by early_xen_setup */ 41/* xen_domain_type is set before executing any C code by early_xen_setup */
45enum xen_domain_type { 42enum xen_domain_type {
46 XEN_NATIVE, 43 XEN_NATIVE, /* running on bare hardware */
47 XEN_PV_DOMAIN, 44 XEN_PV_DOMAIN, /* running in a PV domain */
48 XEN_HVM_DOMAIN, 45 XEN_HVM_DOMAIN, /* running in a Xen hvm domain*/
49}; 46};
50 47
48#ifdef CONFIG_XEN
51extern enum xen_domain_type xen_domain_type; 49extern enum xen_domain_type xen_domain_type;
50#else
51#define xen_domain_type XEN_NATIVE
52#endif
52 53
53#define xen_domain() (xen_domain_type != XEN_NATIVE) 54#define xen_domain() (xen_domain_type != XEN_NATIVE)
54#define xen_pv_domain() (xen_domain_type == XEN_PV_DOMAIN) 55#define xen_pv_domain() (xen_domain() && \
55#define xen_initial_domain() (xen_pv_domain() && \ 56 xen_domain_type == XEN_PV_DOMAIN)
57#define xen_hvm_domain() (xen_domain() && \
58 xen_domain_type == XEN_HVM_DOMAIN)
59
60#ifdef CONFIG_XEN_DOM0
61#define xen_initial_domain() (xen_pv_domain() && \
56 (xen_start_info->flags & SIF_INITDOMAIN)) 62 (xen_start_info->flags & SIF_INITDOMAIN))
57#define xen_hvm_domain() (xen_domain_type == XEN_HVM_DOMAIN) 63#else
64#define xen_initial_domain() (0)
65#endif
58 66
59/* deprecated. remove this */
60#define is_running_on_xen() (xen_domain_type == XEN_PV_DOMAIN)
61 67
68#ifdef CONFIG_XEN
62extern struct shared_info *HYPERVISOR_shared_info; 69extern struct shared_info *HYPERVISOR_shared_info;
63extern struct start_info *xen_start_info; 70extern struct start_info *xen_start_info;
64 71
@@ -74,16 +81,6 @@ void force_evtchn_callback(void);
74 81
75/* For setup_arch() in arch/ia64/kernel/setup.c */ 82/* For setup_arch() in arch/ia64/kernel/setup.c */
76void xen_ia64_enable_opt_feature(void); 83void 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 84#endif
86 85
87#define is_initial_xendomain() (0) /* deprecated. remove this */
88
89#endif /* _ASM_IA64_XEN_HYPERVISOR_H */ 86#endif /* _ASM_IA64_XEN_HYPERVISOR_H */
diff --git a/arch/ia64/include/asm/xen/inst.h b/arch/ia64/include/asm/xen/inst.h
index 19c2ae1d878a..c53a47611208 100644
--- a/arch/ia64/include/asm/xen/inst.h
+++ b/arch/ia64/include/asm/xen/inst.h
@@ -33,6 +33,9 @@
33#define __paravirt_work_processed_syscall_target \ 33#define __paravirt_work_processed_syscall_target \
34 xen_work_processed_syscall 34 xen_work_processed_syscall
35 35
36#define paravirt_fsyscall_table xen_fsyscall_table
37#define paravirt_fsys_bubble_down xen_fsys_bubble_down
38
36#define MOV_FROM_IFA(reg) \ 39#define MOV_FROM_IFA(reg) \
37 movl reg = XSI_IFA; \ 40 movl reg = XSI_IFA; \
38 ;; \ 41 ;; \
@@ -110,6 +113,27 @@
110.endm 113.endm
111#define MOV_FROM_PSR(pred, reg, clob) __MOV_FROM_PSR pred, reg, clob 114#define MOV_FROM_PSR(pred, reg, clob) __MOV_FROM_PSR pred, reg, clob
112 115
116/* assuming ar.itc is read with interrupt disabled. */
117#define MOV_FROM_ITC(pred, pred_clob, reg, clob) \
118(pred) movl clob = XSI_ITC_OFFSET; \
119 ;; \
120(pred) ld8 clob = [clob]; \
121(pred) mov reg = ar.itc; \
122 ;; \
123(pred) add reg = reg, clob; \
124 ;; \
125(pred) movl clob = XSI_ITC_LAST; \
126 ;; \
127(pred) ld8 clob = [clob]; \
128 ;; \
129(pred) cmp.geu.unc pred_clob, p0 = clob, reg; \
130 ;; \
131(pred_clob) add reg = 1, clob; \
132 ;; \
133(pred) movl clob = XSI_ITC_LAST; \
134 ;; \
135(pred) st8 [clob] = reg
136
113 137
114#define MOV_TO_IFA(reg, clob) \ 138#define MOV_TO_IFA(reg, clob) \
115 movl clob = XSI_IFA; \ 139 movl clob = XSI_IFA; \
@@ -362,6 +386,10 @@
362#define RSM_PSR_DT \ 386#define RSM_PSR_DT \
363 XEN_HYPER_RSM_PSR_DT 387 XEN_HYPER_RSM_PSR_DT
364 388
389#define RSM_PSR_BE_I(clob0, clob1) \
390 RSM_PSR_I(p0, clob0, clob1); \
391 rum psr.be
392
365#define SSM_PSR_DT_AND_SRLZ_I \ 393#define SSM_PSR_DT_AND_SRLZ_I \
366 XEN_HYPER_SSM_PSR_DT 394 XEN_HYPER_SSM_PSR_DT
367 395
diff --git a/arch/ia64/include/asm/xen/interface.h b/arch/ia64/include/asm/xen/interface.h
index f00fab40854d..e951e740bdf2 100644
--- a/arch/ia64/include/asm/xen/interface.h
+++ b/arch/ia64/include/asm/xen/interface.h
@@ -209,6 +209,15 @@ struct mapped_regs {
209 unsigned long krs[8]; /* kernel registers */ 209 unsigned long krs[8]; /* kernel registers */
210 unsigned long tmp[16]; /* temp registers 210 unsigned long tmp[16]; /* temp registers
211 (e.g. for hyperprivops) */ 211 (e.g. for hyperprivops) */
212
213 /* itc paravirtualization
214 * vAR.ITC = mAR.ITC + itc_offset
215 * itc_last is one which was lastly passed to
216 * the guest OS in order to prevent it from
217 * going backwords.
218 */
219 unsigned long itc_offset;
220 unsigned long itc_last;
212 }; 221 };
213 }; 222 };
214}; 223};
diff --git a/arch/ia64/include/asm/xen/minstate.h b/arch/ia64/include/asm/xen/minstate.h
index 4d92d9bbda7b..c57fa910f2c9 100644
--- a/arch/ia64/include/asm/xen/minstate.h
+++ b/arch/ia64/include/asm/xen/minstate.h
@@ -1,3 +1,12 @@
1
2#ifdef CONFIG_VIRT_CPU_ACCOUNTING
3/* read ar.itc in advance, and use it before leaving bank 0 */
4#define XEN_ACCOUNT_GET_STAMP \
5 MOV_FROM_ITC(pUStk, p6, r20, r2);
6#else
7#define XEN_ACCOUNT_GET_STAMP
8#endif
9
1/* 10/*
2 * DO_SAVE_MIN switches to the kernel stacks (if necessary) and saves 11 * 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 12 * the minimum state necessary that allows us to turn psr.ic back
@@ -123,7 +132,7 @@
123 ;; \ 132 ;; \
124.mem.offset 0,0; st8.spill [r16]=r2,16; \ 133.mem.offset 0,0; st8.spill [r16]=r2,16; \
125.mem.offset 8,0; st8.spill [r17]=r3,16; \ 134.mem.offset 8,0; st8.spill [r17]=r3,16; \
126 ACCOUNT_GET_STAMP \ 135 XEN_ACCOUNT_GET_STAMP \
127 adds r2=IA64_PT_REGS_R16_OFFSET,r1; \ 136 adds r2=IA64_PT_REGS_R16_OFFSET,r1; \
128 ;; \ 137 ;; \
129 EXTRA; \ 138 EXTRA; \
diff --git a/arch/ia64/include/asm/xen/patchlist.h b/arch/ia64/include/asm/xen/patchlist.h
new file mode 100644
index 000000000000..eae944e88846
--- /dev/null
+++ b/arch/ia64/include/asm/xen/patchlist.h
@@ -0,0 +1,38 @@
1/******************************************************************************
2 * arch/ia64/include/asm/xen/patchlist.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#define __paravirt_start_gate_fsyscall_patchlist \
24 __xen_start_gate_fsyscall_patchlist
25#define __paravirt_end_gate_fsyscall_patchlist \
26 __xen_end_gate_fsyscall_patchlist
27#define __paravirt_start_gate_brl_fsys_bubble_down_patchlist \
28 __xen_start_gate_brl_fsys_bubble_down_patchlist
29#define __paravirt_end_gate_brl_fsys_bubble_down_patchlist \
30 __xen_end_gate_brl_fsys_bubble_down_patchlist
31#define __paravirt_start_gate_vtop_patchlist \
32 __xen_start_gate_vtop_patchlist
33#define __paravirt_end_gate_vtop_patchlist \
34 __xen_end_gate_vtop_patchlist
35#define __paravirt_start_gate_mckinley_e9_patchlist \
36 __xen_start_gate_mckinley_e9_patchlist
37#define __paravirt_end_gate_mckinley_e9_patchlist \
38 __xen_end_gate_mckinley_e9_patchlist
diff --git a/arch/ia64/include/asm/xen/privop.h b/arch/ia64/include/asm/xen/privop.h
index 71ec7546e100..fb4ec5e0b066 100644
--- a/arch/ia64/include/asm/xen/privop.h
+++ b/arch/ia64/include/asm/xen/privop.h
@@ -55,6 +55,8 @@
55#define XSI_BANK1_R16 (XSI_BASE + XSI_BANK1_R16_OFS) 55#define XSI_BANK1_R16 (XSI_BASE + XSI_BANK1_R16_OFS)
56#define XSI_BANKNUM (XSI_BASE + XSI_BANKNUM_OFS) 56#define XSI_BANKNUM (XSI_BASE + XSI_BANKNUM_OFS)
57#define XSI_IHA (XSI_BASE + XSI_IHA_OFS) 57#define XSI_IHA (XSI_BASE + XSI_IHA_OFS)
58#define XSI_ITC_OFFSET (XSI_BASE + XSI_ITC_OFFSET_OFS)
59#define XSI_ITC_LAST (XSI_BASE + XSI_ITC_LAST_OFS)
58#endif 60#endif
59 61
60#ifndef __ASSEMBLY__ 62#ifndef __ASSEMBLY__
@@ -67,7 +69,7 @@
67 * may have different semantics depending on whether they are executed 69 * may have different semantics depending on whether they are executed
68 * at PL0 vs PL!=0. When paravirtualized, these instructions mustn't 70 * at PL0 vs PL!=0. When paravirtualized, these instructions mustn't
69 * be allowed to execute directly, lest incorrect semantics result. */ 71 * be allowed to execute directly, lest incorrect semantics result. */
70extern void xen_fc(unsigned long addr); 72extern void xen_fc(void *addr);
71extern unsigned long xen_thash(unsigned long addr); 73extern unsigned long xen_thash(unsigned long addr);
72 74
73/* Note that "ttag" and "cover" are also privilege-sensitive; "ttag" 75/* Note that "ttag" and "cover" are also privilege-sensitive; "ttag"
@@ -80,8 +82,10 @@ extern unsigned long xen_thash(unsigned long addr);
80extern unsigned long xen_get_cpuid(int index); 82extern unsigned long xen_get_cpuid(int index);
81extern unsigned long xen_get_pmd(int index); 83extern unsigned long xen_get_pmd(int index);
82 84
85#ifndef ASM_SUPPORTED
83extern unsigned long xen_get_eflag(void); /* see xen_ia64_getreg */ 86extern unsigned long xen_get_eflag(void); /* see xen_ia64_getreg */
84extern void xen_set_eflag(unsigned long); /* see xen_ia64_setreg */ 87extern void xen_set_eflag(unsigned long); /* see xen_ia64_setreg */
88#endif
85 89
86/************************************************/ 90/************************************************/
87/* Instructions paravirtualized for performance */ 91/* Instructions paravirtualized for performance */
@@ -106,6 +110,7 @@ extern void xen_set_eflag(unsigned long); /* see xen_ia64_setreg */
106#define xen_get_virtual_pend() \ 110#define xen_get_virtual_pend() \
107 (*(((uint8_t *)XEN_MAPPEDREGS->interrupt_mask_addr) - 1)) 111 (*(((uint8_t *)XEN_MAPPEDREGS->interrupt_mask_addr) - 1))
108 112
113#ifndef ASM_SUPPORTED
109/* Although all privileged operations can be left to trap and will 114/* Although all privileged operations can be left to trap and will
110 * be properly handled by Xen, some are frequent enough that we use 115 * be properly handled by Xen, some are frequent enough that we use
111 * hyperprivops for performance. */ 116 * hyperprivops for performance. */
@@ -123,6 +128,7 @@ extern void xen_set_rr0_to_rr4(unsigned long val0, unsigned long val1,
123 unsigned long val4); 128 unsigned long val4);
124extern void xen_set_kr(unsigned long index, unsigned long val); 129extern void xen_set_kr(unsigned long index, unsigned long val);
125extern void xen_ptcga(unsigned long addr, unsigned long size); 130extern void xen_ptcga(unsigned long addr, unsigned long size);
131#endif /* !ASM_SUPPORTED */
126 132
127#endif /* !__ASSEMBLY__ */ 133#endif /* !__ASSEMBLY__ */
128 134
diff --git a/arch/ia64/kernel/Makefile b/arch/ia64/kernel/Makefile
index dc62df021673..6b7edcab0cb5 100644
--- a/arch/ia64/kernel/Makefile
+++ b/arch/ia64/kernel/Makefile
@@ -9,7 +9,7 @@ endif
9extra-y := head.o init_task.o vmlinux.lds 9extra-y := head.o init_task.o vmlinux.lds
10 10
11obj-y := acpi.o entry.o efi.o efi_stub.o gate-data.o fsys.o ia64_ksyms.o irq.o irq_ia64.o \ 11obj-y := acpi.o entry.o efi.o efi_stub.o gate-data.o fsys.o ia64_ksyms.o irq.o irq_ia64.o \
12 irq_lsapic.o ivt.o machvec.o pal.o patch.o process.o perfmon.o ptrace.o sal.o \ 12 irq_lsapic.o ivt.o machvec.o pal.o paravirt_patchlist.o patch.o process.o perfmon.o ptrace.o sal.o \
13 salinfo.o setup.o signal.o sys_ia64.o time.o traps.o unaligned.o \ 13 salinfo.o setup.o signal.o sys_ia64.o time.o traps.o unaligned.o \
14 unwind.o mca.o mca_asm.o topology.o dma-mapping.o 14 unwind.o mca.o mca_asm.o topology.o dma-mapping.o
15 15
@@ -41,7 +41,8 @@ obj-$(CONFIG_PCI_MSI) += msi_ia64.o
41mca_recovery-y += mca_drv.o mca_drv_asm.o 41mca_recovery-y += mca_drv.o mca_drv_asm.o
42obj-$(CONFIG_IA64_MC_ERR_INJECT)+= err_inject.o 42obj-$(CONFIG_IA64_MC_ERR_INJECT)+= err_inject.o
43 43
44obj-$(CONFIG_PARAVIRT) += paravirt.o paravirtentry.o 44obj-$(CONFIG_PARAVIRT) += paravirt.o paravirtentry.o \
45 paravirt_patch.o
45 46
46obj-$(CONFIG_IA64_ESI) += esi.o 47obj-$(CONFIG_IA64_ESI) += esi.o
47ifneq ($(CONFIG_IA64_ESI),) 48ifneq ($(CONFIG_IA64_ESI),)
@@ -50,35 +51,13 @@ endif
50obj-$(CONFIG_DMAR) += pci-dma.o 51obj-$(CONFIG_DMAR) += pci-dma.o
51obj-$(CONFIG_SWIOTLB) += pci-swiotlb.o 52obj-$(CONFIG_SWIOTLB) += pci-swiotlb.o
52 53
53# The gate DSO image is built using a special linker script.
54targets += gate.so gate-syms.o
55
56extra-y += gate.so gate-syms.o gate.lds gate.o
57
58# fp_emulate() expects f2-f5,f16-f31 to contain the user-level state. 54# fp_emulate() expects f2-f5,f16-f31 to contain the user-level state.
59CFLAGS_traps.o += -mfixed-range=f2-f5,f16-f31 55CFLAGS_traps.o += -mfixed-range=f2-f5,f16-f31
60 56
61CPPFLAGS_gate.lds := -P -C -U$(ARCH) 57# The gate DSO image is built using a special linker script.
62 58include $(srctree)/arch/ia64/kernel/Makefile.gate
63quiet_cmd_gate = GATE $@ 59# tell compiled for native
64 cmd_gate = $(CC) -nostdlib $(GATECFLAGS_$(@F)) -Wl,-T,$(filter-out FORCE,$^) -o $@ 60CPPFLAGS_gate.lds += -D__IA64_GATE_PARAVIRTUALIZED_NATIVE
65
66GATECFLAGS_gate.so = -shared -s -Wl,-soname=linux-gate.so.1 \
67 $(call ld-option, -Wl$(comma)--hash-style=sysv)
68$(obj)/gate.so: $(obj)/gate.lds $(obj)/gate.o FORCE
69 $(call if_changed,gate)
70
71$(obj)/built-in.o: $(obj)/gate-syms.o
72$(obj)/built-in.o: ld_flags += -R $(obj)/gate-syms.o
73
74GATECFLAGS_gate-syms.o = -r
75$(obj)/gate-syms.o: $(obj)/gate.lds $(obj)/gate.o FORCE
76 $(call if_changed,gate)
77
78# gate-data.o contains the gate DSO image as data in section .data.gate.
79# We must build gate.so before we can assemble it.
80# Note: kbuild does not track this dependency due to usage of .incbin
81$(obj)/gate-data.o: $(obj)/gate.so
82 61
83# Calculate NR_IRQ = max(IA64_NATIVE_NR_IRQS, XEN_NR_IRQS, ...) based on config 62# Calculate NR_IRQ = max(IA64_NATIVE_NR_IRQS, XEN_NR_IRQS, ...) based on config
84define sed-y 63define sed-y
@@ -114,9 +93,9 @@ include/asm-ia64/nr-irqs.h: arch/$(SRCARCH)/kernel/nr-irqs.s
114clean-files += $(objtree)/include/asm-ia64/nr-irqs.h 93clean-files += $(objtree)/include/asm-ia64/nr-irqs.h
115 94
116# 95#
117# native ivt.S and entry.S 96# native ivt.S, entry.S and fsys.S
118# 97#
119ASM_PARAVIRT_OBJS = ivt.o entry.o 98ASM_PARAVIRT_OBJS = ivt.o entry.o fsys.o
120define paravirtualized_native 99define paravirtualized_native
121AFLAGS_$(1) += -D__IA64_ASM_PARAVIRTUALIZED_NATIVE 100AFLAGS_$(1) += -D__IA64_ASM_PARAVIRTUALIZED_NATIVE
122AFLAGS_pvchk-sed-$(1) += -D__IA64_ASM_PARAVIRTUALIZED_PVCHECK 101AFLAGS_pvchk-sed-$(1) += -D__IA64_ASM_PARAVIRTUALIZED_PVCHECK
diff --git a/arch/ia64/kernel/Makefile.gate b/arch/ia64/kernel/Makefile.gate
new file mode 100644
index 000000000000..1d87f84069b3
--- /dev/null
+++ b/arch/ia64/kernel/Makefile.gate
@@ -0,0 +1,27 @@
1# The gate DSO image is built using a special linker script.
2
3targets += gate.so gate-syms.o
4
5extra-y += gate.so gate-syms.o gate.lds gate.o
6
7CPPFLAGS_gate.lds := -P -C -U$(ARCH)
8
9quiet_cmd_gate = GATE $@
10 cmd_gate = $(CC) -nostdlib $(GATECFLAGS_$(@F)) -Wl,-T,$(filter-out FORCE,$^) -o $@
11
12GATECFLAGS_gate.so = -shared -s -Wl,-soname=linux-gate.so.1 \
13 $(call ld-option, -Wl$(comma)--hash-style=sysv)
14$(obj)/gate.so: $(obj)/gate.lds $(obj)/gate.o FORCE
15 $(call if_changed,gate)
16
17$(obj)/built-in.o: $(obj)/gate-syms.o
18$(obj)/built-in.o: ld_flags += -R $(obj)/gate-syms.o
19
20GATECFLAGS_gate-syms.o = -r
21$(obj)/gate-syms.o: $(obj)/gate.lds $(obj)/gate.o FORCE
22 $(call if_changed,gate)
23
24# gate-data.o contains the gate DSO image as data in section .data.gate.
25# We must build gate.so before we can assemble it.
26# Note: kbuild does not track this dependency due to usage of .incbin
27$(obj)/gate-data.o: $(obj)/gate.so
diff --git a/arch/ia64/kernel/acpi.c b/arch/ia64/kernel/acpi.c
index bdef2ce38c8b..5510317db37b 100644
--- a/arch/ia64/kernel/acpi.c
+++ b/arch/ia64/kernel/acpi.c
@@ -890,7 +890,7 @@ __init void prefill_possible_map(void)
890 possible, max((possible - available_cpus), 0)); 890 possible, max((possible - available_cpus), 0));
891 891
892 for (i = 0; i < possible; i++) 892 for (i = 0; i < possible; i++)
893 cpu_set(i, cpu_possible_map); 893 set_cpu_possible(i, true);
894} 894}
895 895
896int acpi_map_lsapic(acpi_handle handle, int *pcpu) 896int acpi_map_lsapic(acpi_handle handle, int *pcpu)
@@ -928,9 +928,9 @@ int acpi_map_lsapic(acpi_handle handle, int *pcpu)
928 buffer.length = ACPI_ALLOCATE_BUFFER; 928 buffer.length = ACPI_ALLOCATE_BUFFER;
929 buffer.pointer = NULL; 929 buffer.pointer = NULL;
930 930
931 cpus_complement(tmp_map, cpu_present_map); 931 cpumask_complement(&tmp_map, cpu_present_mask);
932 cpu = first_cpu(tmp_map); 932 cpu = cpumask_first(&tmp_map);
933 if (cpu >= NR_CPUS) 933 if (cpu >= nr_cpu_ids)
934 return -EINVAL; 934 return -EINVAL;
935 935
936 acpi_map_cpu2node(handle, cpu, physid); 936 acpi_map_cpu2node(handle, cpu, physid);
diff --git a/arch/ia64/kernel/asm-offsets.c b/arch/ia64/kernel/asm-offsets.c
index 742dbb1d5a4f..af5650169043 100644
--- a/arch/ia64/kernel/asm-offsets.c
+++ b/arch/ia64/kernel/asm-offsets.c
@@ -316,5 +316,7 @@ void foo(void)
316 DEFINE_MAPPED_REG_OFS(XSI_BANK1_R16_OFS, bank1_regs[0]); 316 DEFINE_MAPPED_REG_OFS(XSI_BANK1_R16_OFS, bank1_regs[0]);
317 DEFINE_MAPPED_REG_OFS(XSI_B0NATS_OFS, vbnat); 317 DEFINE_MAPPED_REG_OFS(XSI_B0NATS_OFS, vbnat);
318 DEFINE_MAPPED_REG_OFS(XSI_B1NATS_OFS, vnat); 318 DEFINE_MAPPED_REG_OFS(XSI_B1NATS_OFS, vnat);
319 DEFINE_MAPPED_REG_OFS(XSI_ITC_OFFSET_OFS, itc_offset);
320 DEFINE_MAPPED_REG_OFS(XSI_ITC_LAST_OFS, itc_last);
319#endif /* CONFIG_XEN */ 321#endif /* CONFIG_XEN */
320} 322}
diff --git a/arch/ia64/kernel/efi.c b/arch/ia64/kernel/efi.c
index efaff15d8cf1..7ef80e8161ce 100644
--- a/arch/ia64/kernel/efi.c
+++ b/arch/ia64/kernel/efi.c
@@ -456,6 +456,7 @@ efi_map_pal_code (void)
456 GRANULEROUNDDOWN((unsigned long) pal_vaddr), 456 GRANULEROUNDDOWN((unsigned long) pal_vaddr),
457 pte_val(pfn_pte(__pa(pal_vaddr) >> PAGE_SHIFT, PAGE_KERNEL)), 457 pte_val(pfn_pte(__pa(pal_vaddr) >> PAGE_SHIFT, PAGE_KERNEL)),
458 IA64_GRANULE_SHIFT); 458 IA64_GRANULE_SHIFT);
459 paravirt_dv_serialize_data();
459 ia64_set_psr(psr); /* restore psr */ 460 ia64_set_psr(psr); /* restore psr */
460} 461}
461 462
diff --git a/arch/ia64/kernel/entry.S b/arch/ia64/kernel/entry.S
index 7e3382b06d56..8dc69669586a 100644
--- a/arch/ia64/kernel/entry.S
+++ b/arch/ia64/kernel/entry.S
@@ -736,7 +736,7 @@ GLOBAL_ENTRY(__paravirt_leave_syscall)
736__paravirt_work_processed_syscall: 736__paravirt_work_processed_syscall:
737#ifdef CONFIG_VIRT_CPU_ACCOUNTING 737#ifdef CONFIG_VIRT_CPU_ACCOUNTING
738 adds r2=PT(LOADRS)+16,r12 738 adds r2=PT(LOADRS)+16,r12
739(pUStk) mov.m r22=ar.itc // fetch time at leave 739 MOV_FROM_ITC(pUStk, p9, r22, r19) // fetch time at leave
740 adds r18=TI_FLAGS+IA64_TASK_SIZE,r13 740 adds r18=TI_FLAGS+IA64_TASK_SIZE,r13
741 ;; 741 ;;
742(p6) ld4 r31=[r18] // load current_thread_info()->flags 742(p6) ld4 r31=[r18] // load current_thread_info()->flags
@@ -985,7 +985,7 @@ GLOBAL_ENTRY(__paravirt_leave_kernel)
985#ifdef CONFIG_VIRT_CPU_ACCOUNTING 985#ifdef CONFIG_VIRT_CPU_ACCOUNTING
986 .pred.rel.mutex pUStk,pKStk 986 .pred.rel.mutex pUStk,pKStk
987 MOV_FROM_PSR(pKStk, r22, r29) // M2 read PSR now that interrupts are disabled 987 MOV_FROM_PSR(pKStk, r22, r29) // M2 read PSR now that interrupts are disabled
988(pUStk) mov.m r22=ar.itc // M fetch time at leave 988 MOV_FROM_ITC(pUStk, p9, r22, r29) // M fetch time at leave
989 nop.i 0 989 nop.i 0
990 ;; 990 ;;
991#else 991#else
diff --git a/arch/ia64/kernel/fsys.S b/arch/ia64/kernel/fsys.S
index c1625c7e1779..3567d54f8cee 100644
--- a/arch/ia64/kernel/fsys.S
+++ b/arch/ia64/kernel/fsys.S
@@ -25,6 +25,7 @@
25#include <asm/unistd.h> 25#include <asm/unistd.h>
26 26
27#include "entry.h" 27#include "entry.h"
28#include "paravirt_inst.h"
28 29
29/* 30/*
30 * See Documentation/ia64/fsys.txt for details on fsyscalls. 31 * See Documentation/ia64/fsys.txt for details on fsyscalls.
@@ -279,7 +280,7 @@ ENTRY(fsys_gettimeofday)
279(p9) cmp.eq p13,p0 = 0,r30 // if mmio_ptr, clear p13 jitter control 280(p9) cmp.eq p13,p0 = 0,r30 // if mmio_ptr, clear p13 jitter control
280 ;; 281 ;;
281 .pred.rel.mutex p8,p9 282 .pred.rel.mutex p8,p9
282(p8) mov r2 = ar.itc // CPU_TIMER. 36 clocks latency!!! 283 MOV_FROM_ITC(p8, p6, r2, r10) // CPU_TIMER. 36 clocks latency!!!
283(p9) ld8 r2 = [r30] // MMIO_TIMER. Could also have latency issues.. 284(p9) ld8 r2 = [r30] // MMIO_TIMER. Could also have latency issues..
284(p13) ld8 r25 = [r19] // get itc_lastcycle value 285(p13) ld8 r25 = [r19] // get itc_lastcycle value
285 ld8 r9 = [r22],IA64_TIMESPEC_TV_NSEC_OFFSET // tv_sec 286 ld8 r9 = [r22],IA64_TIMESPEC_TV_NSEC_OFFSET // tv_sec
@@ -418,7 +419,7 @@ EX(.fail_efault, ld8 r14=[r33]) // r14 <- *set
418 mov r17=(1 << (SIGKILL - 1)) | (1 << (SIGSTOP - 1)) 419 mov r17=(1 << (SIGKILL - 1)) | (1 << (SIGSTOP - 1))
419 ;; 420 ;;
420 421
421 rsm psr.i // mask interrupt delivery 422 RSM_PSR_I(p0, r18, r19) // mask interrupt delivery
422 mov ar.ccv=0 423 mov ar.ccv=0
423 andcm r14=r14,r17 // filter out SIGKILL & SIGSTOP 424 andcm r14=r14,r17 // filter out SIGKILL & SIGSTOP
424 425
@@ -491,7 +492,7 @@ EX(.fail_efault, ld8 r14=[r33]) // r14 <- *set
491#ifdef CONFIG_SMP 492#ifdef CONFIG_SMP
492 st4.rel [r31]=r0 // release the lock 493 st4.rel [r31]=r0 // release the lock
493#endif 494#endif
494 ssm psr.i 495 SSM_PSR_I(p0, p9, r31)
495 ;; 496 ;;
496 497
497 srlz.d // ensure psr.i is set again 498 srlz.d // ensure psr.i is set again
@@ -513,7 +514,7 @@ EX(.fail_efault, (p15) st8 [r34]=r3)
513#ifdef CONFIG_SMP 514#ifdef CONFIG_SMP
514 st4.rel [r31]=r0 // release the lock 515 st4.rel [r31]=r0 // release the lock
515#endif 516#endif
516 ssm psr.i 517 SSM_PSR_I(p0, p9, r17)
517 ;; 518 ;;
518 srlz.d 519 srlz.d
519 br.sptk.many fsys_fallback_syscall // with signal pending, do the heavy-weight syscall 520 br.sptk.many fsys_fallback_syscall // with signal pending, do the heavy-weight syscall
@@ -521,7 +522,7 @@ EX(.fail_efault, (p15) st8 [r34]=r3)
521#ifdef CONFIG_SMP 522#ifdef CONFIG_SMP
522.lock_contention: 523.lock_contention:
523 /* Rather than spinning here, fall back on doing a heavy-weight syscall. */ 524 /* Rather than spinning here, fall back on doing a heavy-weight syscall. */
524 ssm psr.i 525 SSM_PSR_I(p0, p9, r17)
525 ;; 526 ;;
526 srlz.d 527 srlz.d
527 br.sptk.many fsys_fallback_syscall 528 br.sptk.many fsys_fallback_syscall
@@ -592,17 +593,17 @@ ENTRY(fsys_fallback_syscall)
592 adds r17=-1024,r15 593 adds r17=-1024,r15
593 movl r14=sys_call_table 594 movl r14=sys_call_table
594 ;; 595 ;;
595 rsm psr.i 596 RSM_PSR_I(p0, r26, r27)
596 shladd r18=r17,3,r14 597 shladd r18=r17,3,r14
597 ;; 598 ;;
598 ld8 r18=[r18] // load normal (heavy-weight) syscall entry-point 599 ld8 r18=[r18] // load normal (heavy-weight) syscall entry-point
599 mov r29=psr // read psr (12 cyc load latency) 600 MOV_FROM_PSR(p0, r29, r26) // read psr (12 cyc load latency)
600 mov r27=ar.rsc 601 mov r27=ar.rsc
601 mov r21=ar.fpsr 602 mov r21=ar.fpsr
602 mov r26=ar.pfs 603 mov r26=ar.pfs
603END(fsys_fallback_syscall) 604END(fsys_fallback_syscall)
604 /* FALL THROUGH */ 605 /* FALL THROUGH */
605GLOBAL_ENTRY(fsys_bubble_down) 606GLOBAL_ENTRY(paravirt_fsys_bubble_down)
606 .prologue 607 .prologue
607 .altrp b6 608 .altrp b6
608 .body 609 .body
@@ -640,7 +641,7 @@ GLOBAL_ENTRY(fsys_bubble_down)
640 * 641 *
641 * PSR.BE : already is turned off in __kernel_syscall_via_epc() 642 * PSR.BE : already is turned off in __kernel_syscall_via_epc()
642 * PSR.AC : don't care (kernel normally turns PSR.AC on) 643 * PSR.AC : don't care (kernel normally turns PSR.AC on)
643 * PSR.I : already turned off by the time fsys_bubble_down gets 644 * PSR.I : already turned off by the time paravirt_fsys_bubble_down gets
644 * invoked 645 * invoked
645 * PSR.DFL: always 0 (kernel never turns it on) 646 * PSR.DFL: always 0 (kernel never turns it on)
646 * PSR.DFH: don't care --- kernel never touches f32-f127 on its own 647 * PSR.DFH: don't care --- kernel never touches f32-f127 on its own
@@ -650,7 +651,7 @@ GLOBAL_ENTRY(fsys_bubble_down)
650 * PSR.DB : don't care --- kernel never enables kernel-level 651 * PSR.DB : don't care --- kernel never enables kernel-level
651 * breakpoints 652 * breakpoints
652 * PSR.TB : must be 0 already; if it wasn't zero on entry to 653 * PSR.TB : must be 0 already; if it wasn't zero on entry to
653 * __kernel_syscall_via_epc, the branch to fsys_bubble_down 654 * __kernel_syscall_via_epc, the branch to paravirt_fsys_bubble_down
654 * will trigger a taken branch; the taken-trap-handler then 655 * will trigger a taken branch; the taken-trap-handler then
655 * converts the syscall into a break-based system-call. 656 * converts the syscall into a break-based system-call.
656 */ 657 */
@@ -683,7 +684,7 @@ GLOBAL_ENTRY(fsys_bubble_down)
683 ;; 684 ;;
684 mov ar.rsc=0 // M2 set enforced lazy mode, pl 0, LE, loadrs=0 685 mov ar.rsc=0 // M2 set enforced lazy mode, pl 0, LE, loadrs=0
685#ifdef CONFIG_VIRT_CPU_ACCOUNTING 686#ifdef CONFIG_VIRT_CPU_ACCOUNTING
686 mov.m r30=ar.itc // M get cycle for accounting 687 MOV_FROM_ITC(p0, p6, r30, r23) // M get cycle for accounting
687#else 688#else
688 nop.m 0 689 nop.m 0
689#endif 690#endif
@@ -734,21 +735,21 @@ GLOBAL_ENTRY(fsys_bubble_down)
734 mov rp=r14 // I0 set the real return addr 735 mov rp=r14 // I0 set the real return addr
735 and r3=_TIF_SYSCALL_TRACEAUDIT,r3 // A 736 and r3=_TIF_SYSCALL_TRACEAUDIT,r3 // A
736 ;; 737 ;;
737 ssm psr.i // M2 we're on kernel stacks now, reenable irqs 738 SSM_PSR_I(p0, p6, r22) // M2 we're on kernel stacks now, reenable irqs
738 cmp.eq p8,p0=r3,r0 // A 739 cmp.eq p8,p0=r3,r0 // A
739(p10) br.cond.spnt.many ia64_ret_from_syscall // B return if bad call-frame or r15 is a NaT 740(p10) br.cond.spnt.many ia64_ret_from_syscall // B return if bad call-frame or r15 is a NaT
740 741
741 nop.m 0 742 nop.m 0
742(p8) br.call.sptk.many b6=b6 // B (ignore return address) 743(p8) br.call.sptk.many b6=b6 // B (ignore return address)
743 br.cond.spnt ia64_trace_syscall // B 744 br.cond.spnt ia64_trace_syscall // B
744END(fsys_bubble_down) 745END(paravirt_fsys_bubble_down)
745 746
746 .rodata 747 .rodata
747 .align 8 748 .align 8
748 .globl fsyscall_table 749 .globl paravirt_fsyscall_table
749 750
750 data8 fsys_bubble_down 751 data8 paravirt_fsys_bubble_down
751fsyscall_table: 752paravirt_fsyscall_table:
752 data8 fsys_ni_syscall 753 data8 fsys_ni_syscall
753 data8 0 // exit // 1025 754 data8 0 // exit // 1025
754 data8 0 // read 755 data8 0 // read
@@ -1033,4 +1034,4 @@ fsyscall_table:
1033 1034
1034 // fill in zeros for the remaining entries 1035 // fill in zeros for the remaining entries
1035 .zero: 1036 .zero:
1036 .space fsyscall_table + 8*NR_syscalls - .zero, 0 1037 .space paravirt_fsyscall_table + 8*NR_syscalls - .zero, 0
diff --git a/arch/ia64/kernel/gate.S b/arch/ia64/kernel/gate.S
index 74b1ccce4e84..cf5e0a105e16 100644
--- a/arch/ia64/kernel/gate.S
+++ b/arch/ia64/kernel/gate.S
@@ -13,6 +13,7 @@
13#include <asm/sigcontext.h> 13#include <asm/sigcontext.h>
14#include <asm/system.h> 14#include <asm/system.h>
15#include <asm/unistd.h> 15#include <asm/unistd.h>
16#include "paravirt_inst.h"
16 17
17/* 18/*
18 * We can't easily refer to symbols inside the kernel. To avoid full runtime relocation, 19 * We can't easily refer to symbols inside the kernel. To avoid full runtime relocation,
@@ -48,87 +49,6 @@ GLOBAL_ENTRY(__kernel_syscall_via_break)
48} 49}
49END(__kernel_syscall_via_break) 50END(__kernel_syscall_via_break)
50 51
51/*
52 * On entry:
53 * r11 = saved ar.pfs
54 * r15 = system call #
55 * b0 = saved return address
56 * b6 = return address
57 * On exit:
58 * r11 = saved ar.pfs
59 * r15 = system call #
60 * b0 = saved return address
61 * all other "scratch" registers: undefined
62 * all "preserved" registers: same as on entry
63 */
64
65GLOBAL_ENTRY(__kernel_syscall_via_epc)
66 .prologue
67 .altrp b6
68 .body
69{
70 /*
71 * Note: the kernel cannot assume that the first two instructions in this
72 * bundle get executed. The remaining code must be safe even if
73 * they do not get executed.
74 */
75 adds r17=-1024,r15 // A
76 mov r10=0 // A default to successful syscall execution
77 epc // B causes split-issue
78}
79 ;;
80 rsm psr.be | psr.i // M2 (5 cyc to srlz.d)
81 LOAD_FSYSCALL_TABLE(r14) // X
82 ;;
83 mov r16=IA64_KR(CURRENT) // M2 (12 cyc)
84 shladd r18=r17,3,r14 // A
85 mov r19=NR_syscalls-1 // A
86 ;;
87 lfetch [r18] // M0|1
88 mov r29=psr // M2 (12 cyc)
89 // If r17 is a NaT, p6 will be zero
90 cmp.geu p6,p7=r19,r17 // A (sysnr > 0 && sysnr < 1024+NR_syscalls)?
91 ;;
92 mov r21=ar.fpsr // M2 (12 cyc)
93 tnat.nz p10,p9=r15 // I0
94 mov.i r26=ar.pfs // I0 (would stall anyhow due to srlz.d...)
95 ;;
96 srlz.d // M0 (forces split-issue) ensure PSR.BE==0
97(p6) ld8 r18=[r18] // M0|1
98 nop.i 0
99 ;;
100 nop.m 0
101(p6) tbit.z.unc p8,p0=r18,0 // I0 (dual-issues with "mov b7=r18"!)
102 nop.i 0
103 ;;
104(p8) ssm psr.i
105(p6) mov b7=r18 // I0
106(p8) br.dptk.many b7 // B
107
108 mov r27=ar.rsc // M2 (12 cyc)
109/*
110 * brl.cond doesn't work as intended because the linker would convert this branch
111 * into a branch to a PLT. Perhaps there will be a way to avoid this with some
112 * future version of the linker. In the meantime, we just use an indirect branch
113 * instead.
114 */
115#ifdef CONFIG_ITANIUM
116(p6) add r14=-8,r14 // r14 <- addr of fsys_bubble_down entry
117 ;;
118(p6) ld8 r14=[r14] // r14 <- fsys_bubble_down
119 ;;
120(p6) mov b7=r14
121(p6) br.sptk.many b7
122#else
123 BRL_COND_FSYS_BUBBLE_DOWN(p6)
124#endif
125 ssm psr.i
126 mov r10=-1
127(p10) mov r8=EINVAL
128(p9) mov r8=ENOSYS
129 FSYS_RETURN
130END(__kernel_syscall_via_epc)
131
132# define ARG0_OFF (16 + IA64_SIGFRAME_ARG0_OFFSET) 52# define ARG0_OFF (16 + IA64_SIGFRAME_ARG0_OFFSET)
133# define ARG1_OFF (16 + IA64_SIGFRAME_ARG1_OFFSET) 53# define ARG1_OFF (16 + IA64_SIGFRAME_ARG1_OFFSET)
134# define ARG2_OFF (16 + IA64_SIGFRAME_ARG2_OFFSET) 54# define ARG2_OFF (16 + IA64_SIGFRAME_ARG2_OFFSET)
@@ -374,3 +294,92 @@ restore_rbs:
374 // invala not necessary as that will happen when returning to user-mode 294 // invala not necessary as that will happen when returning to user-mode
375 br.cond.sptk back_from_restore_rbs 295 br.cond.sptk back_from_restore_rbs
376END(__kernel_sigtramp) 296END(__kernel_sigtramp)
297
298/*
299 * On entry:
300 * r11 = saved ar.pfs
301 * r15 = system call #
302 * b0 = saved return address
303 * b6 = return address
304 * On exit:
305 * r11 = saved ar.pfs
306 * r15 = system call #
307 * b0 = saved return address
308 * all other "scratch" registers: undefined
309 * all "preserved" registers: same as on entry
310 */
311
312GLOBAL_ENTRY(__kernel_syscall_via_epc)
313 .prologue
314 .altrp b6
315 .body
316{
317 /*
318 * Note: the kernel cannot assume that the first two instructions in this
319 * bundle get executed. The remaining code must be safe even if
320 * they do not get executed.
321 */
322 adds r17=-1024,r15 // A
323 mov r10=0 // A default to successful syscall execution
324 epc // B causes split-issue
325}
326 ;;
327 RSM_PSR_BE_I(r20, r22) // M2 (5 cyc to srlz.d)
328 LOAD_FSYSCALL_TABLE(r14) // X
329 ;;
330 mov r16=IA64_KR(CURRENT) // M2 (12 cyc)
331 shladd r18=r17,3,r14 // A
332 mov r19=NR_syscalls-1 // A
333 ;;
334 lfetch [r18] // M0|1
335 MOV_FROM_PSR(p0, r29, r8) // M2 (12 cyc)
336 // If r17 is a NaT, p6 will be zero
337 cmp.geu p6,p7=r19,r17 // A (sysnr > 0 && sysnr < 1024+NR_syscalls)?
338 ;;
339 mov r21=ar.fpsr // M2 (12 cyc)
340 tnat.nz p10,p9=r15 // I0
341 mov.i r26=ar.pfs // I0 (would stall anyhow due to srlz.d...)
342 ;;
343 srlz.d // M0 (forces split-issue) ensure PSR.BE==0
344(p6) ld8 r18=[r18] // M0|1
345 nop.i 0
346 ;;
347 nop.m 0
348(p6) tbit.z.unc p8,p0=r18,0 // I0 (dual-issues with "mov b7=r18"!)
349 nop.i 0
350 ;;
351 SSM_PSR_I(p8, p14, r25)
352(p6) mov b7=r18 // I0
353(p8) br.dptk.many b7 // B
354
355 mov r27=ar.rsc // M2 (12 cyc)
356/*
357 * brl.cond doesn't work as intended because the linker would convert this branch
358 * into a branch to a PLT. Perhaps there will be a way to avoid this with some
359 * future version of the linker. In the meantime, we just use an indirect branch
360 * instead.
361 */
362#ifdef CONFIG_ITANIUM
363(p6) add r14=-8,r14 // r14 <- addr of fsys_bubble_down entry
364 ;;
365(p6) ld8 r14=[r14] // r14 <- fsys_bubble_down
366 ;;
367(p6) mov b7=r14
368(p6) br.sptk.many b7
369#else
370 BRL_COND_FSYS_BUBBLE_DOWN(p6)
371#endif
372 SSM_PSR_I(p0, p14, r10)
373 mov r10=-1
374(p10) mov r8=EINVAL
375(p9) mov r8=ENOSYS
376 FSYS_RETURN
377
378#ifdef CONFIG_PARAVIRT
379 /*
380 * padd to make the size of this symbol constant
381 * independent of paravirtualization.
382 */
383 .align PAGE_SIZE / 8
384#endif
385END(__kernel_syscall_via_epc)
diff --git a/arch/ia64/kernel/gate.lds.S b/arch/ia64/kernel/gate.lds.S
index 3cb1abc00e24..88c64ed47c36 100644
--- a/arch/ia64/kernel/gate.lds.S
+++ b/arch/ia64/kernel/gate.lds.S
@@ -7,6 +7,7 @@
7 7
8 8
9#include <asm/system.h> 9#include <asm/system.h>
10#include "paravirt_patchlist.h"
10 11
11SECTIONS 12SECTIONS
12{ 13{
@@ -33,21 +34,21 @@ SECTIONS
33 . = GATE_ADDR + 0x600; 34 . = GATE_ADDR + 0x600;
34 35
35 .data.patch : { 36 .data.patch : {
36 __start_gate_mckinley_e9_patchlist = .; 37 __paravirt_start_gate_mckinley_e9_patchlist = .;
37 *(.data.patch.mckinley_e9) 38 *(.data.patch.mckinley_e9)
38 __end_gate_mckinley_e9_patchlist = .; 39 __paravirt_end_gate_mckinley_e9_patchlist = .;
39 40
40 __start_gate_vtop_patchlist = .; 41 __paravirt_start_gate_vtop_patchlist = .;
41 *(.data.patch.vtop) 42 *(.data.patch.vtop)
42 __end_gate_vtop_patchlist = .; 43 __paravirt_end_gate_vtop_patchlist = .;
43 44
44 __start_gate_fsyscall_patchlist = .; 45 __paravirt_start_gate_fsyscall_patchlist = .;
45 *(.data.patch.fsyscall_table) 46 *(.data.patch.fsyscall_table)
46 __end_gate_fsyscall_patchlist = .; 47 __paravirt_end_gate_fsyscall_patchlist = .;
47 48
48 __start_gate_brl_fsys_bubble_down_patchlist = .; 49 __paravirt_start_gate_brl_fsys_bubble_down_patchlist = .;
49 *(.data.patch.brl_fsys_bubble_down) 50 *(.data.patch.brl_fsys_bubble_down)
50 __end_gate_brl_fsys_bubble_down_patchlist = .; 51 __paravirt_end_gate_brl_fsys_bubble_down_patchlist = .;
51 } :readable 52 } :readable
52 53
53 .IA_64.unwind_info : { *(.IA_64.unwind_info*) } 54 .IA_64.unwind_info : { *(.IA_64.unwind_info*) }
diff --git a/arch/ia64/kernel/head.S b/arch/ia64/kernel/head.S
index 59301c472800..23f846de62d5 100644
--- a/arch/ia64/kernel/head.S
+++ b/arch/ia64/kernel/head.S
@@ -1050,7 +1050,7 @@ END(ia64_delay_loop)
1050 * except that the multiplication and the shift are done with 128-bit 1050 * except that the multiplication and the shift are done with 128-bit
1051 * intermediate precision so that we can produce a full 64-bit result. 1051 * intermediate precision so that we can produce a full 64-bit result.
1052 */ 1052 */
1053GLOBAL_ENTRY(sched_clock) 1053GLOBAL_ENTRY(ia64_native_sched_clock)
1054 addl r8=THIS_CPU(cpu_info) + IA64_CPUINFO_NSEC_PER_CYC_OFFSET,r0 1054 addl r8=THIS_CPU(cpu_info) + IA64_CPUINFO_NSEC_PER_CYC_OFFSET,r0
1055 mov.m r9=ar.itc // fetch cycle-counter (35 cyc) 1055 mov.m r9=ar.itc // fetch cycle-counter (35 cyc)
1056 ;; 1056 ;;
@@ -1066,7 +1066,13 @@ GLOBAL_ENTRY(sched_clock)
1066 ;; 1066 ;;
1067 shrp r8=r9,r8,IA64_NSEC_PER_CYC_SHIFT 1067 shrp r8=r9,r8,IA64_NSEC_PER_CYC_SHIFT
1068 br.ret.sptk.many rp 1068 br.ret.sptk.many rp
1069END(sched_clock) 1069END(ia64_native_sched_clock)
1070#ifndef CONFIG_PARAVIRT
1071 //unsigned long long
1072 //sched_clock(void) __attribute__((alias("ia64_native_sched_clock")));
1073 .global sched_clock
1074sched_clock = ia64_native_sched_clock
1075#endif
1070 1076
1071#ifdef CONFIG_VIRT_CPU_ACCOUNTING 1077#ifdef CONFIG_VIRT_CPU_ACCOUNTING
1072GLOBAL_ENTRY(cycle_to_cputime) 1078GLOBAL_ENTRY(cycle_to_cputime)
diff --git a/arch/ia64/kernel/ivt.S b/arch/ia64/kernel/ivt.S
index f675d8e33853..ec9a5fdfa1b9 100644
--- a/arch/ia64/kernel/ivt.S
+++ b/arch/ia64/kernel/ivt.S
@@ -804,7 +804,7 @@ ENTRY(break_fault)
804/////////////////////////////////////////////////////////////////////// 804///////////////////////////////////////////////////////////////////////
805 st1 [r16]=r0 // M2|3 clear current->thread.on_ustack flag 805 st1 [r16]=r0 // M2|3 clear current->thread.on_ustack flag
806#ifdef CONFIG_VIRT_CPU_ACCOUNTING 806#ifdef CONFIG_VIRT_CPU_ACCOUNTING
807 mov.m r30=ar.itc // M get cycle for accounting 807 MOV_FROM_ITC(p0, p14, r30, r18) // M get cycle for accounting
808#else 808#else
809 mov b6=r30 // I0 setup syscall handler branch reg early 809 mov b6=r30 // I0 setup syscall handler branch reg early
810#endif 810#endif
diff --git a/arch/ia64/kernel/mca.c b/arch/ia64/kernel/mca.c
index bab1de2d2f6a..8f33a8840422 100644
--- a/arch/ia64/kernel/mca.c
+++ b/arch/ia64/kernel/mca.c
@@ -1456,9 +1456,9 @@ ia64_mca_cmc_int_caller(int cmc_irq, void *arg)
1456 1456
1457 ia64_mca_cmc_int_handler(cmc_irq, arg); 1457 ia64_mca_cmc_int_handler(cmc_irq, arg);
1458 1458
1459 for (++cpuid ; cpuid < NR_CPUS && !cpu_online(cpuid) ; cpuid++); 1459 cpuid = cpumask_next(cpuid+1, cpu_online_mask);
1460 1460
1461 if (cpuid < NR_CPUS) { 1461 if (cpuid < nr_cpu_ids) {
1462 platform_send_ipi(cpuid, IA64_CMCP_VECTOR, IA64_IPI_DM_INT, 0); 1462 platform_send_ipi(cpuid, IA64_CMCP_VECTOR, IA64_IPI_DM_INT, 0);
1463 } else { 1463 } else {
1464 /* If no log record, switch out of polling mode */ 1464 /* If no log record, switch out of polling mode */
@@ -1525,7 +1525,7 @@ ia64_mca_cpe_int_caller(int cpe_irq, void *arg)
1525 1525
1526 ia64_mca_cpe_int_handler(cpe_irq, arg); 1526 ia64_mca_cpe_int_handler(cpe_irq, arg);
1527 1527
1528 for (++cpuid ; cpuid < NR_CPUS && !cpu_online(cpuid) ; cpuid++); 1528 cpuid = cpumask_next(cpuid+1, cpu_online_mask);
1529 1529
1530 if (cpuid < NR_CPUS) { 1530 if (cpuid < NR_CPUS) {
1531 platform_send_ipi(cpuid, IA64_CPEP_VECTOR, IA64_IPI_DM_INT, 0); 1531 platform_send_ipi(cpuid, IA64_CPEP_VECTOR, IA64_IPI_DM_INT, 0);
diff --git a/arch/ia64/kernel/module.c b/arch/ia64/kernel/module.c
index aaa7d901521f..da3b0cf495a3 100644
--- a/arch/ia64/kernel/module.c
+++ b/arch/ia64/kernel/module.c
@@ -446,6 +446,14 @@ module_frob_arch_sections (Elf_Ehdr *ehdr, Elf_Shdr *sechdrs, char *secstrings,
446 mod->arch.opd = s; 446 mod->arch.opd = s;
447 else if (strcmp(".IA_64.unwind", secstrings + s->sh_name) == 0) 447 else if (strcmp(".IA_64.unwind", secstrings + s->sh_name) == 0)
448 mod->arch.unwind = s; 448 mod->arch.unwind = s;
449#ifdef CONFIG_PARAVIRT
450 else if (strcmp(".paravirt_bundles",
451 secstrings + s->sh_name) == 0)
452 mod->arch.paravirt_bundles = s;
453 else if (strcmp(".paravirt_insts",
454 secstrings + s->sh_name) == 0)
455 mod->arch.paravirt_insts = s;
456#endif
449 457
450 if (!mod->arch.core_plt || !mod->arch.init_plt || !mod->arch.got || !mod->arch.opd) { 458 if (!mod->arch.core_plt || !mod->arch.init_plt || !mod->arch.got || !mod->arch.opd) {
451 printk(KERN_ERR "%s: sections missing\n", mod->name); 459 printk(KERN_ERR "%s: sections missing\n", mod->name);
@@ -525,8 +533,7 @@ get_ltoff (struct module *mod, uint64_t value, int *okp)
525 goto found; 533 goto found;
526 534
527 /* Not enough GOT entries? */ 535 /* Not enough GOT entries? */
528 if (e >= (struct got_entry *) (mod->arch.got->sh_addr + mod->arch.got->sh_size)) 536 BUG_ON(e >= (struct got_entry *) (mod->arch.got->sh_addr + mod->arch.got->sh_size));
529 BUG();
530 537
531 e->val = value; 538 e->val = value;
532 ++mod->arch.next_got_entry; 539 ++mod->arch.next_got_entry;
@@ -921,6 +928,30 @@ module_finalize (const Elf_Ehdr *hdr, const Elf_Shdr *sechdrs, struct module *mo
921 DEBUGP("%s: init: entry=%p\n", __func__, mod->init); 928 DEBUGP("%s: init: entry=%p\n", __func__, mod->init);
922 if (mod->arch.unwind) 929 if (mod->arch.unwind)
923 register_unwind_table(mod); 930 register_unwind_table(mod);
931#ifdef CONFIG_PARAVIRT
932 if (mod->arch.paravirt_bundles) {
933 struct paravirt_patch_site_bundle *start =
934 (struct paravirt_patch_site_bundle *)
935 mod->arch.paravirt_bundles->sh_addr;
936 struct paravirt_patch_site_bundle *end =
937 (struct paravirt_patch_site_bundle *)
938 (mod->arch.paravirt_bundles->sh_addr +
939 mod->arch.paravirt_bundles->sh_size);
940
941 paravirt_patch_apply_bundle(start, end);
942 }
943 if (mod->arch.paravirt_insts) {
944 struct paravirt_patch_site_inst *start =
945 (struct paravirt_patch_site_inst *)
946 mod->arch.paravirt_insts->sh_addr;
947 struct paravirt_patch_site_inst *end =
948 (struct paravirt_patch_site_inst *)
949 (mod->arch.paravirt_insts->sh_addr +
950 mod->arch.paravirt_insts->sh_size);
951
952 paravirt_patch_apply_inst(start, end);
953 }
954#endif
924 return 0; 955 return 0;
925} 956}
926 957
diff --git a/arch/ia64/kernel/paravirt.c b/arch/ia64/kernel/paravirt.c
index 9f14c16f6369..a21d7bb9c69c 100644
--- a/arch/ia64/kernel/paravirt.c
+++ b/arch/ia64/kernel/paravirt.c
@@ -46,13 +46,23 @@ struct pv_info pv_info = {
46 * initialization hooks. 46 * initialization hooks.
47 */ 47 */
48 48
49struct pv_init_ops pv_init_ops; 49static void __init
50ia64_native_patch_branch(unsigned long tag, unsigned long type);
51
52struct pv_init_ops pv_init_ops =
53{
54#ifdef ASM_SUPPORTED
55 .patch_bundle = ia64_native_patch_bundle,
56#endif
57 .patch_branch = ia64_native_patch_branch,
58};
50 59
51/*************************************************************************** 60/***************************************************************************
52 * pv_cpu_ops 61 * pv_cpu_ops
53 * intrinsics hooks. 62 * intrinsics hooks.
54 */ 63 */
55 64
65#ifndef ASM_SUPPORTED
56/* ia64_native_xxx are macros so that we have to make them real functions */ 66/* ia64_native_xxx are macros so that we have to make them real functions */
57 67
58#define DEFINE_VOID_FUNC1(name) \ 68#define DEFINE_VOID_FUNC1(name) \
@@ -60,7 +70,14 @@ struct pv_init_ops pv_init_ops;
60 ia64_native_ ## name ## _func(unsigned long arg) \ 70 ia64_native_ ## name ## _func(unsigned long arg) \
61 { \ 71 { \
62 ia64_native_ ## name(arg); \ 72 ia64_native_ ## name(arg); \
63 } \ 73 }
74
75#define DEFINE_VOID_FUNC1_VOID(name) \
76 static void \
77 ia64_native_ ## name ## _func(void *arg) \
78 { \
79 ia64_native_ ## name(arg); \
80 }
64 81
65#define DEFINE_VOID_FUNC2(name) \ 82#define DEFINE_VOID_FUNC2(name) \
66 static void \ 83 static void \
@@ -68,7 +85,7 @@ struct pv_init_ops pv_init_ops;
68 unsigned long arg1) \ 85 unsigned long arg1) \
69 { \ 86 { \
70 ia64_native_ ## name(arg0, arg1); \ 87 ia64_native_ ## name(arg0, arg1); \
71 } \ 88 }
72 89
73#define DEFINE_FUNC0(name) \ 90#define DEFINE_FUNC0(name) \
74 static unsigned long \ 91 static unsigned long \
@@ -84,7 +101,7 @@ struct pv_init_ops pv_init_ops;
84 return ia64_native_ ## name(arg); \ 101 return ia64_native_ ## name(arg); \
85 } \ 102 } \
86 103
87DEFINE_VOID_FUNC1(fc); 104DEFINE_VOID_FUNC1_VOID(fc);
88DEFINE_VOID_FUNC1(intrin_local_irq_restore); 105DEFINE_VOID_FUNC1(intrin_local_irq_restore);
89 106
90DEFINE_VOID_FUNC2(ptcga); 107DEFINE_VOID_FUNC2(ptcga);
@@ -274,6 +291,266 @@ ia64_native_setreg_func(int regnum, unsigned long val)
274 break; 291 break;
275 } 292 }
276} 293}
294#else
295
296#define __DEFINE_FUNC(name, code) \
297 extern const char ia64_native_ ## name ## _direct_start[]; \
298 extern const char ia64_native_ ## name ## _direct_end[]; \
299 asm (".align 32\n" \
300 ".proc ia64_native_" #name "_func\n" \
301 "ia64_native_" #name "_func:\n" \
302 "ia64_native_" #name "_direct_start:\n" \
303 code \
304 "ia64_native_" #name "_direct_end:\n" \
305 "br.cond.sptk.many b6\n" \
306 ".endp ia64_native_" #name "_func\n")
307
308#define DEFINE_VOID_FUNC0(name, code) \
309 extern void \
310 ia64_native_ ## name ## _func(void); \
311 __DEFINE_FUNC(name, code)
312
313#define DEFINE_VOID_FUNC1(name, code) \
314 extern void \
315 ia64_native_ ## name ## _func(unsigned long arg); \
316 __DEFINE_FUNC(name, code)
317
318#define DEFINE_VOID_FUNC1_VOID(name, code) \
319 extern void \
320 ia64_native_ ## name ## _func(void *arg); \
321 __DEFINE_FUNC(name, code)
322
323#define DEFINE_VOID_FUNC2(name, code) \
324 extern void \
325 ia64_native_ ## name ## _func(unsigned long arg0, \
326 unsigned long arg1); \
327 __DEFINE_FUNC(name, code)
328
329#define DEFINE_FUNC0(name, code) \
330 extern unsigned long \
331 ia64_native_ ## name ## _func(void); \
332 __DEFINE_FUNC(name, code)
333
334#define DEFINE_FUNC1(name, type, code) \
335 extern unsigned long \
336 ia64_native_ ## name ## _func(type arg); \
337 __DEFINE_FUNC(name, code)
338
339DEFINE_VOID_FUNC1_VOID(fc,
340 "fc r8\n");
341DEFINE_VOID_FUNC1(intrin_local_irq_restore,
342 ";;\n"
343 " cmp.ne p6, p7 = r8, r0\n"
344 ";;\n"
345 "(p6) ssm psr.i\n"
346 "(p7) rsm psr.i\n"
347 ";;\n"
348 "(p6) srlz.d\n");
349
350DEFINE_VOID_FUNC2(ptcga,
351 "ptc.ga r8, r9\n");
352DEFINE_VOID_FUNC2(set_rr,
353 "mov rr[r8] = r9\n");
354
355/* ia64_native_getreg(_IA64_REG_PSR) & IA64_PSR_I */
356DEFINE_FUNC0(get_psr_i,
357 "mov r2 = " __stringify(1 << IA64_PSR_I_BIT) "\n"
358 "mov r8 = psr\n"
359 ";;\n"
360 "and r8 = r2, r8\n");
361
362DEFINE_FUNC1(thash, unsigned long,
363 "thash r8 = r8\n");
364DEFINE_FUNC1(get_cpuid, int,
365 "mov r8 = cpuid[r8]\n");
366DEFINE_FUNC1(get_pmd, int,
367 "mov r8 = pmd[r8]\n");
368DEFINE_FUNC1(get_rr, unsigned long,
369 "mov r8 = rr[r8]\n");
370
371DEFINE_VOID_FUNC0(ssm_i,
372 "ssm psr.i\n");
373DEFINE_VOID_FUNC0(rsm_i,
374 "rsm psr.i\n");
375
376extern void
377ia64_native_set_rr0_to_rr4_func(unsigned long val0, unsigned long val1,
378 unsigned long val2, unsigned long val3,
379 unsigned long val4);
380__DEFINE_FUNC(set_rr0_to_rr4,
381 "mov rr[r0] = r8\n"
382 "movl r2 = 0x2000000000000000\n"
383 ";;\n"
384 "mov rr[r2] = r9\n"
385 "shl r3 = r2, 1\n" /* movl r3 = 0x4000000000000000 */
386 ";;\n"
387 "add r2 = r2, r3\n" /* movl r2 = 0x6000000000000000 */
388 "mov rr[r3] = r10\n"
389 ";;\n"
390 "mov rr[r2] = r11\n"
391 "shl r3 = r3, 1\n" /* movl r3 = 0x8000000000000000 */
392 ";;\n"
393 "mov rr[r3] = r14\n");
394
395extern unsigned long ia64_native_getreg_func(int regnum);
396asm(".global ia64_native_getreg_func\n");
397#define __DEFINE_GET_REG(id, reg) \
398 "mov r2 = " __stringify(_IA64_REG_ ## id) "\n" \
399 ";;\n" \
400 "cmp.eq p6, p0 = r2, r8\n" \
401 ";;\n" \
402 "(p6) mov r8 = " #reg "\n" \
403 "(p6) br.cond.sptk.many b6\n" \
404 ";;\n"
405#define __DEFINE_GET_AR(id, reg) __DEFINE_GET_REG(AR_ ## id, ar.reg)
406#define __DEFINE_GET_CR(id, reg) __DEFINE_GET_REG(CR_ ## id, cr.reg)
407
408__DEFINE_FUNC(getreg,
409 __DEFINE_GET_REG(GP, gp)
410 /*__DEFINE_GET_REG(IP, ip)*/ /* returned ip value shouldn't be constant */
411 __DEFINE_GET_REG(PSR, psr)
412 __DEFINE_GET_REG(TP, tp)
413 __DEFINE_GET_REG(SP, sp)
414
415 __DEFINE_GET_REG(AR_KR0, ar0)
416 __DEFINE_GET_REG(AR_KR1, ar1)
417 __DEFINE_GET_REG(AR_KR2, ar2)
418 __DEFINE_GET_REG(AR_KR3, ar3)
419 __DEFINE_GET_REG(AR_KR4, ar4)
420 __DEFINE_GET_REG(AR_KR5, ar5)
421 __DEFINE_GET_REG(AR_KR6, ar6)
422 __DEFINE_GET_REG(AR_KR7, ar7)
423 __DEFINE_GET_AR(RSC, rsc)
424 __DEFINE_GET_AR(BSP, bsp)
425 __DEFINE_GET_AR(BSPSTORE, bspstore)
426 __DEFINE_GET_AR(RNAT, rnat)
427 __DEFINE_GET_AR(FCR, fcr)
428 __DEFINE_GET_AR(EFLAG, eflag)
429 __DEFINE_GET_AR(CSD, csd)
430 __DEFINE_GET_AR(SSD, ssd)
431 __DEFINE_GET_REG(AR_CFLAG, ar27)
432 __DEFINE_GET_AR(FSR, fsr)
433 __DEFINE_GET_AR(FIR, fir)
434 __DEFINE_GET_AR(FDR, fdr)
435 __DEFINE_GET_AR(CCV, ccv)
436 __DEFINE_GET_AR(UNAT, unat)
437 __DEFINE_GET_AR(FPSR, fpsr)
438 __DEFINE_GET_AR(ITC, itc)
439 __DEFINE_GET_AR(PFS, pfs)
440 __DEFINE_GET_AR(LC, lc)
441 __DEFINE_GET_AR(EC, ec)
442
443 __DEFINE_GET_CR(DCR, dcr)
444 __DEFINE_GET_CR(ITM, itm)
445 __DEFINE_GET_CR(IVA, iva)
446 __DEFINE_GET_CR(PTA, pta)
447 __DEFINE_GET_CR(IPSR, ipsr)
448 __DEFINE_GET_CR(ISR, isr)
449 __DEFINE_GET_CR(IIP, iip)
450 __DEFINE_GET_CR(IFA, ifa)
451 __DEFINE_GET_CR(ITIR, itir)
452 __DEFINE_GET_CR(IIPA, iipa)
453 __DEFINE_GET_CR(IFS, ifs)
454 __DEFINE_GET_CR(IIM, iim)
455 __DEFINE_GET_CR(IHA, iha)
456 __DEFINE_GET_CR(LID, lid)
457 __DEFINE_GET_CR(IVR, ivr)
458 __DEFINE_GET_CR(TPR, tpr)
459 __DEFINE_GET_CR(EOI, eoi)
460 __DEFINE_GET_CR(IRR0, irr0)
461 __DEFINE_GET_CR(IRR1, irr1)
462 __DEFINE_GET_CR(IRR2, irr2)
463 __DEFINE_GET_CR(IRR3, irr3)
464 __DEFINE_GET_CR(ITV, itv)
465 __DEFINE_GET_CR(PMV, pmv)
466 __DEFINE_GET_CR(CMCV, cmcv)
467 __DEFINE_GET_CR(LRR0, lrr0)
468 __DEFINE_GET_CR(LRR1, lrr1)
469
470 "mov r8 = -1\n" /* unsupported case */
471 );
472
473extern void ia64_native_setreg_func(int regnum, unsigned long val);
474asm(".global ia64_native_setreg_func\n");
475#define __DEFINE_SET_REG(id, reg) \
476 "mov r2 = " __stringify(_IA64_REG_ ## id) "\n" \
477 ";;\n" \
478 "cmp.eq p6, p0 = r2, r9\n" \
479 ";;\n" \
480 "(p6) mov " #reg " = r8\n" \
481 "(p6) br.cond.sptk.many b6\n" \
482 ";;\n"
483#define __DEFINE_SET_AR(id, reg) __DEFINE_SET_REG(AR_ ## id, ar.reg)
484#define __DEFINE_SET_CR(id, reg) __DEFINE_SET_REG(CR_ ## id, cr.reg)
485__DEFINE_FUNC(setreg,
486 "mov r2 = " __stringify(_IA64_REG_PSR_L) "\n"
487 ";;\n"
488 "cmp.eq p6, p0 = r2, r9\n"
489 ";;\n"
490 "(p6) mov psr.l = r8\n"
491#ifdef HAVE_SERIALIZE_DIRECTIVE
492 ".serialize.data\n"
493#endif
494 "(p6) br.cond.sptk.many b6\n"
495 __DEFINE_SET_REG(GP, gp)
496 __DEFINE_SET_REG(SP, sp)
497
498 __DEFINE_SET_REG(AR_KR0, ar0)
499 __DEFINE_SET_REG(AR_KR1, ar1)
500 __DEFINE_SET_REG(AR_KR2, ar2)
501 __DEFINE_SET_REG(AR_KR3, ar3)
502 __DEFINE_SET_REG(AR_KR4, ar4)
503 __DEFINE_SET_REG(AR_KR5, ar5)
504 __DEFINE_SET_REG(AR_KR6, ar6)
505 __DEFINE_SET_REG(AR_KR7, ar7)
506 __DEFINE_SET_AR(RSC, rsc)
507 __DEFINE_SET_AR(BSP, bsp)
508 __DEFINE_SET_AR(BSPSTORE, bspstore)
509 __DEFINE_SET_AR(RNAT, rnat)
510 __DEFINE_SET_AR(FCR, fcr)
511 __DEFINE_SET_AR(EFLAG, eflag)
512 __DEFINE_SET_AR(CSD, csd)
513 __DEFINE_SET_AR(SSD, ssd)
514 __DEFINE_SET_REG(AR_CFLAG, ar27)
515 __DEFINE_SET_AR(FSR, fsr)
516 __DEFINE_SET_AR(FIR, fir)
517 __DEFINE_SET_AR(FDR, fdr)
518 __DEFINE_SET_AR(CCV, ccv)
519 __DEFINE_SET_AR(UNAT, unat)
520 __DEFINE_SET_AR(FPSR, fpsr)
521 __DEFINE_SET_AR(ITC, itc)
522 __DEFINE_SET_AR(PFS, pfs)
523 __DEFINE_SET_AR(LC, lc)
524 __DEFINE_SET_AR(EC, ec)
525
526 __DEFINE_SET_CR(DCR, dcr)
527 __DEFINE_SET_CR(ITM, itm)
528 __DEFINE_SET_CR(IVA, iva)
529 __DEFINE_SET_CR(PTA, pta)
530 __DEFINE_SET_CR(IPSR, ipsr)
531 __DEFINE_SET_CR(ISR, isr)
532 __DEFINE_SET_CR(IIP, iip)
533 __DEFINE_SET_CR(IFA, ifa)
534 __DEFINE_SET_CR(ITIR, itir)
535 __DEFINE_SET_CR(IIPA, iipa)
536 __DEFINE_SET_CR(IFS, ifs)
537 __DEFINE_SET_CR(IIM, iim)
538 __DEFINE_SET_CR(IHA, iha)
539 __DEFINE_SET_CR(LID, lid)
540 __DEFINE_SET_CR(IVR, ivr)
541 __DEFINE_SET_CR(TPR, tpr)
542 __DEFINE_SET_CR(EOI, eoi)
543 __DEFINE_SET_CR(IRR0, irr0)
544 __DEFINE_SET_CR(IRR1, irr1)
545 __DEFINE_SET_CR(IRR2, irr2)
546 __DEFINE_SET_CR(IRR3, irr3)
547 __DEFINE_SET_CR(ITV, itv)
548 __DEFINE_SET_CR(PMV, pmv)
549 __DEFINE_SET_CR(CMCV, cmcv)
550 __DEFINE_SET_CR(LRR0, lrr0)
551 __DEFINE_SET_CR(LRR1, lrr1)
552 );
553#endif
277 554
278struct pv_cpu_ops pv_cpu_ops = { 555struct pv_cpu_ops pv_cpu_ops = {
279 .fc = ia64_native_fc_func, 556 .fc = ia64_native_fc_func,
@@ -366,4 +643,258 @@ ia64_native_do_steal_accounting(unsigned long *new_itm)
366 643
367struct pv_time_ops pv_time_ops = { 644struct pv_time_ops pv_time_ops = {
368 .do_steal_accounting = ia64_native_do_steal_accounting, 645 .do_steal_accounting = ia64_native_do_steal_accounting,
646 .sched_clock = ia64_native_sched_clock,
647};
648
649/***************************************************************************
650 * binary pacthing
651 * pv_init_ops.patch_bundle
652 */
653
654#ifdef ASM_SUPPORTED
655#define IA64_NATIVE_PATCH_DEFINE_GET_REG(name, reg) \
656 __DEFINE_FUNC(get_ ## name, \
657 ";;\n" \
658 "mov r8 = " #reg "\n" \
659 ";;\n")
660
661#define IA64_NATIVE_PATCH_DEFINE_SET_REG(name, reg) \
662 __DEFINE_FUNC(set_ ## name, \
663 ";;\n" \
664 "mov " #reg " = r8\n" \
665 ";;\n")
666
667#define IA64_NATIVE_PATCH_DEFINE_REG(name, reg) \
668 IA64_NATIVE_PATCH_DEFINE_GET_REG(name, reg); \
669 IA64_NATIVE_PATCH_DEFINE_SET_REG(name, reg) \
670
671#define IA64_NATIVE_PATCH_DEFINE_AR(name, reg) \
672 IA64_NATIVE_PATCH_DEFINE_REG(ar_ ## name, ar.reg)
673
674#define IA64_NATIVE_PATCH_DEFINE_CR(name, reg) \
675 IA64_NATIVE_PATCH_DEFINE_REG(cr_ ## name, cr.reg)
676
677
678IA64_NATIVE_PATCH_DEFINE_GET_REG(psr, psr);
679IA64_NATIVE_PATCH_DEFINE_GET_REG(tp, tp);
680
681/* IA64_NATIVE_PATCH_DEFINE_SET_REG(psr_l, psr.l); */
682__DEFINE_FUNC(set_psr_l,
683 ";;\n"
684 "mov psr.l = r8\n"
685#ifdef HAVE_SERIALIZE_DIRECTIVE
686 ".serialize.data\n"
687#endif
688 ";;\n");
689
690IA64_NATIVE_PATCH_DEFINE_REG(gp, gp);
691IA64_NATIVE_PATCH_DEFINE_REG(sp, sp);
692
693IA64_NATIVE_PATCH_DEFINE_REG(kr0, ar0);
694IA64_NATIVE_PATCH_DEFINE_REG(kr1, ar1);
695IA64_NATIVE_PATCH_DEFINE_REG(kr2, ar2);
696IA64_NATIVE_PATCH_DEFINE_REG(kr3, ar3);
697IA64_NATIVE_PATCH_DEFINE_REG(kr4, ar4);
698IA64_NATIVE_PATCH_DEFINE_REG(kr5, ar5);
699IA64_NATIVE_PATCH_DEFINE_REG(kr6, ar6);
700IA64_NATIVE_PATCH_DEFINE_REG(kr7, ar7);
701
702IA64_NATIVE_PATCH_DEFINE_AR(rsc, rsc);
703IA64_NATIVE_PATCH_DEFINE_AR(bsp, bsp);
704IA64_NATIVE_PATCH_DEFINE_AR(bspstore, bspstore);
705IA64_NATIVE_PATCH_DEFINE_AR(rnat, rnat);
706IA64_NATIVE_PATCH_DEFINE_AR(fcr, fcr);
707IA64_NATIVE_PATCH_DEFINE_AR(eflag, eflag);
708IA64_NATIVE_PATCH_DEFINE_AR(csd, csd);
709IA64_NATIVE_PATCH_DEFINE_AR(ssd, ssd);
710IA64_NATIVE_PATCH_DEFINE_REG(ar27, ar27);
711IA64_NATIVE_PATCH_DEFINE_AR(fsr, fsr);
712IA64_NATIVE_PATCH_DEFINE_AR(fir, fir);
713IA64_NATIVE_PATCH_DEFINE_AR(fdr, fdr);
714IA64_NATIVE_PATCH_DEFINE_AR(ccv, ccv);
715IA64_NATIVE_PATCH_DEFINE_AR(unat, unat);
716IA64_NATIVE_PATCH_DEFINE_AR(fpsr, fpsr);
717IA64_NATIVE_PATCH_DEFINE_AR(itc, itc);
718IA64_NATIVE_PATCH_DEFINE_AR(pfs, pfs);
719IA64_NATIVE_PATCH_DEFINE_AR(lc, lc);
720IA64_NATIVE_PATCH_DEFINE_AR(ec, ec);
721
722IA64_NATIVE_PATCH_DEFINE_CR(dcr, dcr);
723IA64_NATIVE_PATCH_DEFINE_CR(itm, itm);
724IA64_NATIVE_PATCH_DEFINE_CR(iva, iva);
725IA64_NATIVE_PATCH_DEFINE_CR(pta, pta);
726IA64_NATIVE_PATCH_DEFINE_CR(ipsr, ipsr);
727IA64_NATIVE_PATCH_DEFINE_CR(isr, isr);
728IA64_NATIVE_PATCH_DEFINE_CR(iip, iip);
729IA64_NATIVE_PATCH_DEFINE_CR(ifa, ifa);
730IA64_NATIVE_PATCH_DEFINE_CR(itir, itir);
731IA64_NATIVE_PATCH_DEFINE_CR(iipa, iipa);
732IA64_NATIVE_PATCH_DEFINE_CR(ifs, ifs);
733IA64_NATIVE_PATCH_DEFINE_CR(iim, iim);
734IA64_NATIVE_PATCH_DEFINE_CR(iha, iha);
735IA64_NATIVE_PATCH_DEFINE_CR(lid, lid);
736IA64_NATIVE_PATCH_DEFINE_CR(ivr, ivr);
737IA64_NATIVE_PATCH_DEFINE_CR(tpr, tpr);
738IA64_NATIVE_PATCH_DEFINE_CR(eoi, eoi);
739IA64_NATIVE_PATCH_DEFINE_CR(irr0, irr0);
740IA64_NATIVE_PATCH_DEFINE_CR(irr1, irr1);
741IA64_NATIVE_PATCH_DEFINE_CR(irr2, irr2);
742IA64_NATIVE_PATCH_DEFINE_CR(irr3, irr3);
743IA64_NATIVE_PATCH_DEFINE_CR(itv, itv);
744IA64_NATIVE_PATCH_DEFINE_CR(pmv, pmv);
745IA64_NATIVE_PATCH_DEFINE_CR(cmcv, cmcv);
746IA64_NATIVE_PATCH_DEFINE_CR(lrr0, lrr0);
747IA64_NATIVE_PATCH_DEFINE_CR(lrr1, lrr1);
748
749static const struct paravirt_patch_bundle_elem ia64_native_patch_bundle_elems[]
750__initdata_or_module =
751{
752#define IA64_NATIVE_PATCH_BUNDLE_ELEM(name, type) \
753 { \
754 (void*)ia64_native_ ## name ## _direct_start, \
755 (void*)ia64_native_ ## name ## _direct_end, \
756 PARAVIRT_PATCH_TYPE_ ## type, \
757 }
758
759 IA64_NATIVE_PATCH_BUNDLE_ELEM(fc, FC),
760 IA64_NATIVE_PATCH_BUNDLE_ELEM(thash, THASH),
761 IA64_NATIVE_PATCH_BUNDLE_ELEM(get_cpuid, GET_CPUID),
762 IA64_NATIVE_PATCH_BUNDLE_ELEM(get_pmd, GET_PMD),
763 IA64_NATIVE_PATCH_BUNDLE_ELEM(ptcga, PTCGA),
764 IA64_NATIVE_PATCH_BUNDLE_ELEM(get_rr, GET_RR),
765 IA64_NATIVE_PATCH_BUNDLE_ELEM(set_rr, SET_RR),
766 IA64_NATIVE_PATCH_BUNDLE_ELEM(set_rr0_to_rr4, SET_RR0_TO_RR4),
767 IA64_NATIVE_PATCH_BUNDLE_ELEM(ssm_i, SSM_I),
768 IA64_NATIVE_PATCH_BUNDLE_ELEM(rsm_i, RSM_I),
769 IA64_NATIVE_PATCH_BUNDLE_ELEM(get_psr_i, GET_PSR_I),
770 IA64_NATIVE_PATCH_BUNDLE_ELEM(intrin_local_irq_restore,
771 INTRIN_LOCAL_IRQ_RESTORE),
772
773#define IA64_NATIVE_PATCH_BUNDLE_ELEM_GETREG(name, reg) \
774 { \
775 (void*)ia64_native_get_ ## name ## _direct_start, \
776 (void*)ia64_native_get_ ## name ## _direct_end, \
777 PARAVIRT_PATCH_TYPE_GETREG + _IA64_REG_ ## reg, \
778 }
779
780#define IA64_NATIVE_PATCH_BUNDLE_ELEM_SETREG(name, reg) \
781 { \
782 (void*)ia64_native_set_ ## name ## _direct_start, \
783 (void*)ia64_native_set_ ## name ## _direct_end, \
784 PARAVIRT_PATCH_TYPE_SETREG + _IA64_REG_ ## reg, \
785 }
786
787#define IA64_NATIVE_PATCH_BUNDLE_ELEM_REG(name, reg) \
788 IA64_NATIVE_PATCH_BUNDLE_ELEM_GETREG(name, reg), \
789 IA64_NATIVE_PATCH_BUNDLE_ELEM_SETREG(name, reg) \
790
791#define IA64_NATIVE_PATCH_BUNDLE_ELEM_AR(name, reg) \
792 IA64_NATIVE_PATCH_BUNDLE_ELEM_REG(ar_ ## name, AR_ ## reg)
793
794#define IA64_NATIVE_PATCH_BUNDLE_ELEM_CR(name, reg) \
795 IA64_NATIVE_PATCH_BUNDLE_ELEM_REG(cr_ ## name, CR_ ## reg)
796
797 IA64_NATIVE_PATCH_BUNDLE_ELEM_GETREG(psr, PSR),
798 IA64_NATIVE_PATCH_BUNDLE_ELEM_GETREG(tp, TP),
799
800 IA64_NATIVE_PATCH_BUNDLE_ELEM_SETREG(psr_l, PSR_L),
801
802 IA64_NATIVE_PATCH_BUNDLE_ELEM_REG(gp, GP),
803 IA64_NATIVE_PATCH_BUNDLE_ELEM_REG(sp, SP),
804
805 IA64_NATIVE_PATCH_BUNDLE_ELEM_REG(kr0, AR_KR0),
806 IA64_NATIVE_PATCH_BUNDLE_ELEM_REG(kr1, AR_KR1),
807 IA64_NATIVE_PATCH_BUNDLE_ELEM_REG(kr2, AR_KR2),
808 IA64_NATIVE_PATCH_BUNDLE_ELEM_REG(kr3, AR_KR3),
809 IA64_NATIVE_PATCH_BUNDLE_ELEM_REG(kr4, AR_KR4),
810 IA64_NATIVE_PATCH_BUNDLE_ELEM_REG(kr5, AR_KR5),
811 IA64_NATIVE_PATCH_BUNDLE_ELEM_REG(kr6, AR_KR6),
812 IA64_NATIVE_PATCH_BUNDLE_ELEM_REG(kr7, AR_KR7),
813
814 IA64_NATIVE_PATCH_BUNDLE_ELEM_AR(rsc, RSC),
815 IA64_NATIVE_PATCH_BUNDLE_ELEM_AR(bsp, BSP),
816 IA64_NATIVE_PATCH_BUNDLE_ELEM_AR(bspstore, BSPSTORE),
817 IA64_NATIVE_PATCH_BUNDLE_ELEM_AR(rnat, RNAT),
818 IA64_NATIVE_PATCH_BUNDLE_ELEM_AR(fcr, FCR),
819 IA64_NATIVE_PATCH_BUNDLE_ELEM_AR(eflag, EFLAG),
820 IA64_NATIVE_PATCH_BUNDLE_ELEM_AR(csd, CSD),
821 IA64_NATIVE_PATCH_BUNDLE_ELEM_AR(ssd, SSD),
822 IA64_NATIVE_PATCH_BUNDLE_ELEM_REG(ar27, AR_CFLAG),
823 IA64_NATIVE_PATCH_BUNDLE_ELEM_AR(fsr, FSR),
824 IA64_NATIVE_PATCH_BUNDLE_ELEM_AR(fir, FIR),
825 IA64_NATIVE_PATCH_BUNDLE_ELEM_AR(fdr, FDR),
826 IA64_NATIVE_PATCH_BUNDLE_ELEM_AR(ccv, CCV),
827 IA64_NATIVE_PATCH_BUNDLE_ELEM_AR(unat, UNAT),
828 IA64_NATIVE_PATCH_BUNDLE_ELEM_AR(fpsr, FPSR),
829 IA64_NATIVE_PATCH_BUNDLE_ELEM_AR(itc, ITC),
830 IA64_NATIVE_PATCH_BUNDLE_ELEM_AR(pfs, PFS),
831 IA64_NATIVE_PATCH_BUNDLE_ELEM_AR(lc, LC),
832 IA64_NATIVE_PATCH_BUNDLE_ELEM_AR(ec, EC),
833
834 IA64_NATIVE_PATCH_BUNDLE_ELEM_CR(dcr, DCR),
835 IA64_NATIVE_PATCH_BUNDLE_ELEM_CR(itm, ITM),
836 IA64_NATIVE_PATCH_BUNDLE_ELEM_CR(iva, IVA),
837 IA64_NATIVE_PATCH_BUNDLE_ELEM_CR(pta, PTA),
838 IA64_NATIVE_PATCH_BUNDLE_ELEM_CR(ipsr, IPSR),
839 IA64_NATIVE_PATCH_BUNDLE_ELEM_CR(isr, ISR),
840 IA64_NATIVE_PATCH_BUNDLE_ELEM_CR(iip, IIP),
841 IA64_NATIVE_PATCH_BUNDLE_ELEM_CR(ifa, IFA),
842 IA64_NATIVE_PATCH_BUNDLE_ELEM_CR(itir, ITIR),
843 IA64_NATIVE_PATCH_BUNDLE_ELEM_CR(iipa, IIPA),
844 IA64_NATIVE_PATCH_BUNDLE_ELEM_CR(ifs, IFS),
845 IA64_NATIVE_PATCH_BUNDLE_ELEM_CR(iim, IIM),
846 IA64_NATIVE_PATCH_BUNDLE_ELEM_CR(iha, IHA),
847 IA64_NATIVE_PATCH_BUNDLE_ELEM_CR(lid, LID),
848 IA64_NATIVE_PATCH_BUNDLE_ELEM_CR(ivr, IVR),
849 IA64_NATIVE_PATCH_BUNDLE_ELEM_CR(tpr, TPR),
850 IA64_NATIVE_PATCH_BUNDLE_ELEM_CR(eoi, EOI),
851 IA64_NATIVE_PATCH_BUNDLE_ELEM_CR(irr0, IRR0),
852 IA64_NATIVE_PATCH_BUNDLE_ELEM_CR(irr1, IRR1),
853 IA64_NATIVE_PATCH_BUNDLE_ELEM_CR(irr2, IRR2),
854 IA64_NATIVE_PATCH_BUNDLE_ELEM_CR(irr3, IRR3),
855 IA64_NATIVE_PATCH_BUNDLE_ELEM_CR(itv, ITV),
856 IA64_NATIVE_PATCH_BUNDLE_ELEM_CR(pmv, PMV),
857 IA64_NATIVE_PATCH_BUNDLE_ELEM_CR(cmcv, CMCV),
858 IA64_NATIVE_PATCH_BUNDLE_ELEM_CR(lrr0, LRR0),
859 IA64_NATIVE_PATCH_BUNDLE_ELEM_CR(lrr1, LRR1),
369}; 860};
861
862unsigned long __init_or_module
863ia64_native_patch_bundle(void *sbundle, void *ebundle, unsigned long type)
864{
865 const unsigned long nelems = sizeof(ia64_native_patch_bundle_elems) /
866 sizeof(ia64_native_patch_bundle_elems[0]);
867
868 return __paravirt_patch_apply_bundle(sbundle, ebundle, type,
869 ia64_native_patch_bundle_elems,
870 nelems, NULL);
871}
872#endif /* ASM_SUPPOTED */
873
874extern const char ia64_native_switch_to[];
875extern const char ia64_native_leave_syscall[];
876extern const char ia64_native_work_processed_syscall[];
877extern const char ia64_native_leave_kernel[];
878
879const struct paravirt_patch_branch_target ia64_native_branch_target[]
880__initconst = {
881#define PARAVIRT_BR_TARGET(name, type) \
882 { \
883 ia64_native_ ## name, \
884 PARAVIRT_PATCH_TYPE_BR_ ## type, \
885 }
886 PARAVIRT_BR_TARGET(switch_to, SWITCH_TO),
887 PARAVIRT_BR_TARGET(leave_syscall, LEAVE_SYSCALL),
888 PARAVIRT_BR_TARGET(work_processed_syscall, WORK_PROCESSED_SYSCALL),
889 PARAVIRT_BR_TARGET(leave_kernel, LEAVE_KERNEL),
890};
891
892static void __init
893ia64_native_patch_branch(unsigned long tag, unsigned long type)
894{
895 const unsigned long nelem =
896 sizeof(ia64_native_branch_target) /
897 sizeof(ia64_native_branch_target[0]);
898 __paravirt_patch_apply_branch(tag, type,
899 ia64_native_branch_target, nelem);
900}
diff --git a/arch/ia64/kernel/paravirt_patch.c b/arch/ia64/kernel/paravirt_patch.c
new file mode 100644
index 000000000000..bfdfef1b1ffd
--- /dev/null
+++ b/arch/ia64/kernel/paravirt_patch.c
@@ -0,0 +1,514 @@
1/******************************************************************************
2 * linux/arch/ia64/xen/paravirt_patch.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/init.h>
24#include <asm/intrinsics.h>
25#include <asm/kprobes.h>
26#include <asm/paravirt.h>
27#include <asm/paravirt_patch.h>
28
29typedef union ia64_inst {
30 struct {
31 unsigned long long qp : 6;
32 unsigned long long : 31;
33 unsigned long long opcode : 4;
34 unsigned long long reserved : 23;
35 } generic;
36 unsigned long long l;
37} ia64_inst_t;
38
39/*
40 * flush_icache_range() can't be used here.
41 * we are here before cpu_init() which initializes
42 * ia64_i_cache_stride_shift. flush_icache_range() uses it.
43 */
44void __init_or_module
45paravirt_flush_i_cache_range(const void *instr, unsigned long size)
46{
47 extern void paravirt_fc_i(const void *addr);
48 unsigned long i;
49
50 for (i = 0; i < size; i += sizeof(bundle_t))
51 paravirt_fc_i(instr + i);
52}
53
54bundle_t* __init_or_module
55paravirt_get_bundle(unsigned long tag)
56{
57 return (bundle_t *)(tag & ~3UL);
58}
59
60unsigned long __init_or_module
61paravirt_get_slot(unsigned long tag)
62{
63 return tag & 3UL;
64}
65
66unsigned long __init_or_module
67paravirt_get_num_inst(unsigned long stag, unsigned long etag)
68{
69 bundle_t *sbundle = paravirt_get_bundle(stag);
70 unsigned long sslot = paravirt_get_slot(stag);
71 bundle_t *ebundle = paravirt_get_bundle(etag);
72 unsigned long eslot = paravirt_get_slot(etag);
73
74 return (ebundle - sbundle) * 3 + eslot - sslot + 1;
75}
76
77unsigned long __init_or_module
78paravirt_get_next_tag(unsigned long tag)
79{
80 unsigned long slot = paravirt_get_slot(tag);
81
82 switch (slot) {
83 case 0:
84 case 1:
85 return tag + 1;
86 case 2: {
87 bundle_t *bundle = paravirt_get_bundle(tag);
88 return (unsigned long)(bundle + 1);
89 }
90 default:
91 BUG();
92 }
93 /* NOTREACHED */
94}
95
96ia64_inst_t __init_or_module
97paravirt_read_slot0(const bundle_t *bundle)
98{
99 ia64_inst_t inst;
100 inst.l = bundle->quad0.slot0;
101 return inst;
102}
103
104ia64_inst_t __init_or_module
105paravirt_read_slot1(const bundle_t *bundle)
106{
107 ia64_inst_t inst;
108 inst.l = bundle->quad0.slot1_p0 |
109 ((unsigned long long)bundle->quad1.slot1_p1 << 18UL);
110 return inst;
111}
112
113ia64_inst_t __init_or_module
114paravirt_read_slot2(const bundle_t *bundle)
115{
116 ia64_inst_t inst;
117 inst.l = bundle->quad1.slot2;
118 return inst;
119}
120
121ia64_inst_t __init_or_module
122paravirt_read_inst(unsigned long tag)
123{
124 bundle_t *bundle = paravirt_get_bundle(tag);
125 unsigned long slot = paravirt_get_slot(tag);
126
127 switch (slot) {
128 case 0:
129 return paravirt_read_slot0(bundle);
130 case 1:
131 return paravirt_read_slot1(bundle);
132 case 2:
133 return paravirt_read_slot2(bundle);
134 default:
135 BUG();
136 }
137 /* NOTREACHED */
138}
139
140void __init_or_module
141paravirt_write_slot0(bundle_t *bundle, ia64_inst_t inst)
142{
143 bundle->quad0.slot0 = inst.l;
144}
145
146void __init_or_module
147paravirt_write_slot1(bundle_t *bundle, ia64_inst_t inst)
148{
149 bundle->quad0.slot1_p0 = inst.l;
150 bundle->quad1.slot1_p1 = inst.l >> 18UL;
151}
152
153void __init_or_module
154paravirt_write_slot2(bundle_t *bundle, ia64_inst_t inst)
155{
156 bundle->quad1.slot2 = inst.l;
157}
158
159void __init_or_module
160paravirt_write_inst(unsigned long tag, ia64_inst_t inst)
161{
162 bundle_t *bundle = paravirt_get_bundle(tag);
163 unsigned long slot = paravirt_get_slot(tag);
164
165 switch (slot) {
166 case 0:
167 paravirt_write_slot0(bundle, inst);
168 break;
169 case 1:
170 paravirt_write_slot1(bundle, inst);
171 break;
172 case 2:
173 paravirt_write_slot2(bundle, inst);
174 break;
175 default:
176 BUG();
177 break;
178 }
179 paravirt_flush_i_cache_range(bundle, sizeof(*bundle));
180}
181
182/* for debug */
183void
184paravirt_print_bundle(const bundle_t *bundle)
185{
186 const unsigned long *quad = (const unsigned long *)bundle;
187 ia64_inst_t slot0 = paravirt_read_slot0(bundle);
188 ia64_inst_t slot1 = paravirt_read_slot1(bundle);
189 ia64_inst_t slot2 = paravirt_read_slot2(bundle);
190
191 printk(KERN_DEBUG
192 "bundle 0x%p 0x%016lx 0x%016lx\n", bundle, quad[0], quad[1]);
193 printk(KERN_DEBUG
194 "bundle template 0x%x\n",
195 bundle->quad0.template);
196 printk(KERN_DEBUG
197 "slot0 0x%lx slot1_p0 0x%lx slot1_p1 0x%lx slot2 0x%lx\n",
198 (unsigned long)bundle->quad0.slot0,
199 (unsigned long)bundle->quad0.slot1_p0,
200 (unsigned long)bundle->quad1.slot1_p1,
201 (unsigned long)bundle->quad1.slot2);
202 printk(KERN_DEBUG
203 "slot0 0x%016llx slot1 0x%016llx slot2 0x%016llx\n",
204 slot0.l, slot1.l, slot2.l);
205}
206
207static int noreplace_paravirt __init_or_module = 0;
208
209static int __init setup_noreplace_paravirt(char *str)
210{
211 noreplace_paravirt = 1;
212 return 1;
213}
214__setup("noreplace-paravirt", setup_noreplace_paravirt);
215
216#ifdef ASM_SUPPORTED
217static void __init_or_module
218fill_nop_bundle(void *sbundle, void *ebundle)
219{
220 extern const char paravirt_nop_bundle[];
221 extern const unsigned long paravirt_nop_bundle_size;
222
223 void *bundle = sbundle;
224
225 BUG_ON((((unsigned long)sbundle) % sizeof(bundle_t)) != 0);
226 BUG_ON((((unsigned long)ebundle) % sizeof(bundle_t)) != 0);
227
228 while (bundle < ebundle) {
229 memcpy(bundle, paravirt_nop_bundle, paravirt_nop_bundle_size);
230
231 bundle += paravirt_nop_bundle_size;
232 }
233}
234
235/* helper function */
236unsigned long __init_or_module
237__paravirt_patch_apply_bundle(void *sbundle, void *ebundle, unsigned long type,
238 const struct paravirt_patch_bundle_elem *elems,
239 unsigned long nelems,
240 const struct paravirt_patch_bundle_elem **found)
241{
242 unsigned long used = 0;
243 unsigned long i;
244
245 BUG_ON((((unsigned long)sbundle) % sizeof(bundle_t)) != 0);
246 BUG_ON((((unsigned long)ebundle) % sizeof(bundle_t)) != 0);
247
248 found = NULL;
249 for (i = 0; i < nelems; i++) {
250 const struct paravirt_patch_bundle_elem *p = &elems[i];
251 if (p->type == type) {
252 unsigned long need = p->ebundle - p->sbundle;
253 unsigned long room = ebundle - sbundle;
254
255 if (found != NULL)
256 *found = p;
257
258 if (room < need) {
259 /* no room to replace. skip it */
260 printk(KERN_DEBUG
261 "the space is too small to put "
262 "bundles. type %ld need %ld room %ld\n",
263 type, need, room);
264 break;
265 }
266
267 used = need;
268 memcpy(sbundle, p->sbundle, used);
269 break;
270 }
271 }
272
273 return used;
274}
275
276void __init_or_module
277paravirt_patch_apply_bundle(const struct paravirt_patch_site_bundle *start,
278 const struct paravirt_patch_site_bundle *end)
279{
280 const struct paravirt_patch_site_bundle *p;
281
282 if (noreplace_paravirt)
283 return;
284 if (pv_init_ops.patch_bundle == NULL)
285 return;
286
287 for (p = start; p < end; p++) {
288 unsigned long used;
289
290 used = (*pv_init_ops.patch_bundle)(p->sbundle, p->ebundle,
291 p->type);
292 if (used == 0)
293 continue;
294
295 fill_nop_bundle(p->sbundle + used, p->ebundle);
296 paravirt_flush_i_cache_range(p->sbundle,
297 p->ebundle - p->sbundle);
298 }
299 ia64_sync_i();
300 ia64_srlz_i();
301}
302
303/*
304 * nop.i, nop.m, nop.f instruction are same format.
305 * but nop.b has differennt format.
306 * This doesn't support nop.b for now.
307 */
308static void __init_or_module
309fill_nop_inst(unsigned long stag, unsigned long etag)
310{
311 extern const bundle_t paravirt_nop_mfi_inst_bundle[];
312 unsigned long tag;
313 const ia64_inst_t nop_inst =
314 paravirt_read_slot0(paravirt_nop_mfi_inst_bundle);
315
316 for (tag = stag; tag < etag; tag = paravirt_get_next_tag(tag))
317 paravirt_write_inst(tag, nop_inst);
318}
319
320void __init_or_module
321paravirt_patch_apply_inst(const struct paravirt_patch_site_inst *start,
322 const struct paravirt_patch_site_inst *end)
323{
324 const struct paravirt_patch_site_inst *p;
325
326 if (noreplace_paravirt)
327 return;
328 if (pv_init_ops.patch_inst == NULL)
329 return;
330
331 for (p = start; p < end; p++) {
332 unsigned long tag;
333 bundle_t *sbundle;
334 bundle_t *ebundle;
335
336 tag = (*pv_init_ops.patch_inst)(p->stag, p->etag, p->type);
337 if (tag == p->stag)
338 continue;
339
340 fill_nop_inst(tag, p->etag);
341 sbundle = paravirt_get_bundle(p->stag);
342 ebundle = paravirt_get_bundle(p->etag) + 1;
343 paravirt_flush_i_cache_range(sbundle, (ebundle - sbundle) *
344 sizeof(bundle_t));
345 }
346 ia64_sync_i();
347 ia64_srlz_i();
348}
349#endif /* ASM_SUPPOTED */
350
351/* brl.cond.sptk.many <target64> X3 */
352typedef union inst_x3_op {
353 ia64_inst_t inst;
354 struct {
355 unsigned long qp: 6;
356 unsigned long btyp: 3;
357 unsigned long unused: 3;
358 unsigned long p: 1;
359 unsigned long imm20b: 20;
360 unsigned long wh: 2;
361 unsigned long d: 1;
362 unsigned long i: 1;
363 unsigned long opcode: 4;
364 };
365 unsigned long l;
366} inst_x3_op_t;
367
368typedef union inst_x3_imm {
369 ia64_inst_t inst;
370 struct {
371 unsigned long unused: 2;
372 unsigned long imm39: 39;
373 };
374 unsigned long l;
375} inst_x3_imm_t;
376
377void __init_or_module
378paravirt_patch_reloc_brl(unsigned long tag, const void *target)
379{
380 unsigned long tag_op = paravirt_get_next_tag(tag);
381 unsigned long tag_imm = tag;
382 bundle_t *bundle = paravirt_get_bundle(tag);
383
384 ia64_inst_t inst_op = paravirt_read_inst(tag_op);
385 ia64_inst_t inst_imm = paravirt_read_inst(tag_imm);
386
387 inst_x3_op_t inst_x3_op = { .l = inst_op.l };
388 inst_x3_imm_t inst_x3_imm = { .l = inst_imm.l };
389
390 unsigned long imm60 =
391 ((unsigned long)target - (unsigned long)bundle) >> 4;
392
393 BUG_ON(paravirt_get_slot(tag) != 1); /* MLX */
394 BUG_ON(((unsigned long)target & (sizeof(bundle_t) - 1)) != 0);
395
396 /* imm60[59] 1bit */
397 inst_x3_op.i = (imm60 >> 59) & 1;
398 /* imm60[19:0] 20bit */
399 inst_x3_op.imm20b = imm60 & ((1UL << 20) - 1);
400 /* imm60[58:20] 39bit */
401 inst_x3_imm.imm39 = (imm60 >> 20) & ((1UL << 39) - 1);
402
403 inst_op.l = inst_x3_op.l;
404 inst_imm.l = inst_x3_imm.l;
405
406 paravirt_write_inst(tag_op, inst_op);
407 paravirt_write_inst(tag_imm, inst_imm);
408}
409
410/* br.cond.sptk.many <target25> B1 */
411typedef union inst_b1 {
412 ia64_inst_t inst;
413 struct {
414 unsigned long qp: 6;
415 unsigned long btype: 3;
416 unsigned long unused: 3;
417 unsigned long p: 1;
418 unsigned long imm20b: 20;
419 unsigned long wh: 2;
420 unsigned long d: 1;
421 unsigned long s: 1;
422 unsigned long opcode: 4;
423 };
424 unsigned long l;
425} inst_b1_t;
426
427void __init
428paravirt_patch_reloc_br(unsigned long tag, const void *target)
429{
430 bundle_t *bundle = paravirt_get_bundle(tag);
431 ia64_inst_t inst = paravirt_read_inst(tag);
432 unsigned long target25 = (unsigned long)target - (unsigned long)bundle;
433 inst_b1_t inst_b1;
434
435 BUG_ON(((unsigned long)target & (sizeof(bundle_t) - 1)) != 0);
436
437 inst_b1.l = inst.l;
438 if (target25 & (1UL << 63))
439 inst_b1.s = 1;
440 else
441 inst_b1.s = 0;
442
443 inst_b1.imm20b = target25 >> 4;
444 inst.l = inst_b1.l;
445
446 paravirt_write_inst(tag, inst);
447}
448
449void __init
450__paravirt_patch_apply_branch(
451 unsigned long tag, unsigned long type,
452 const struct paravirt_patch_branch_target *entries,
453 unsigned int nr_entries)
454{
455 unsigned int i;
456 for (i = 0; i < nr_entries; i++) {
457 if (entries[i].type == type) {
458 paravirt_patch_reloc_br(tag, entries[i].entry);
459 break;
460 }
461 }
462}
463
464static void __init
465paravirt_patch_apply_branch(const struct paravirt_patch_site_branch *start,
466 const struct paravirt_patch_site_branch *end)
467{
468 const struct paravirt_patch_site_branch *p;
469
470 if (noreplace_paravirt)
471 return;
472 if (pv_init_ops.patch_branch == NULL)
473 return;
474
475 for (p = start; p < end; p++)
476 (*pv_init_ops.patch_branch)(p->tag, p->type);
477
478 ia64_sync_i();
479 ia64_srlz_i();
480}
481
482void __init
483paravirt_patch_apply(void)
484{
485 extern const char __start_paravirt_bundles[];
486 extern const char __stop_paravirt_bundles[];
487 extern const char __start_paravirt_insts[];
488 extern const char __stop_paravirt_insts[];
489 extern const char __start_paravirt_branches[];
490 extern const char __stop_paravirt_branches[];
491
492 paravirt_patch_apply_bundle((const struct paravirt_patch_site_bundle *)
493 __start_paravirt_bundles,
494 (const struct paravirt_patch_site_bundle *)
495 __stop_paravirt_bundles);
496 paravirt_patch_apply_inst((const struct paravirt_patch_site_inst *)
497 __start_paravirt_insts,
498 (const struct paravirt_patch_site_inst *)
499 __stop_paravirt_insts);
500 paravirt_patch_apply_branch((const struct paravirt_patch_site_branch *)
501 __start_paravirt_branches,
502 (const struct paravirt_patch_site_branch *)
503 __stop_paravirt_branches);
504}
505
506/*
507 * Local variables:
508 * mode: C
509 * c-set-style: "linux"
510 * c-basic-offset: 8
511 * tab-width: 8
512 * indent-tabs-mode: t
513 * End:
514 */
diff --git a/arch/ia64/kernel/paravirt_patchlist.c b/arch/ia64/kernel/paravirt_patchlist.c
new file mode 100644
index 000000000000..b28082a95d45
--- /dev/null
+++ b/arch/ia64/kernel/paravirt_patchlist.c
@@ -0,0 +1,79 @@
1/******************************************************************************
2 * Copyright (c) 2008 Isaku Yamahata <yamahata at valinux co jp>
3 * VA Linux Systems Japan K.K.
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 *
19 */
20
21#include <linux/bug.h>
22#include <asm/paravirt.h>
23
24#define DECLARE(name) \
25 extern unsigned long \
26 __ia64_native_start_gate_##name##_patchlist[]; \
27 extern unsigned long \
28 __ia64_native_end_gate_##name##_patchlist[]
29
30DECLARE(fsyscall);
31DECLARE(brl_fsys_bubble_down);
32DECLARE(vtop);
33DECLARE(mckinley_e9);
34
35extern unsigned long __start_gate_section[];
36
37#define ASSIGN(name) \
38 .start_##name##_patchlist = \
39 (unsigned long)__ia64_native_start_gate_##name##_patchlist, \
40 .end_##name##_patchlist = \
41 (unsigned long)__ia64_native_end_gate_##name##_patchlist
42
43struct pv_patchdata pv_patchdata __initdata = {
44 ASSIGN(fsyscall),
45 ASSIGN(brl_fsys_bubble_down),
46 ASSIGN(vtop),
47 ASSIGN(mckinley_e9),
48
49 .gate_section = (void*)__start_gate_section,
50};
51
52
53unsigned long __init
54paravirt_get_gate_patchlist(enum pv_gate_patchlist type)
55{
56
57#define CASE(NAME, name) \
58 case PV_GATE_START_##NAME: \
59 return pv_patchdata.start_##name##_patchlist; \
60 case PV_GATE_END_##NAME: \
61 return pv_patchdata.end_##name##_patchlist; \
62
63 switch (type) {
64 CASE(FSYSCALL, fsyscall);
65 CASE(BRL_FSYS_BUBBLE_DOWN, brl_fsys_bubble_down);
66 CASE(VTOP, vtop);
67 CASE(MCKINLEY_E9, mckinley_e9);
68 default:
69 BUG();
70 break;
71 }
72 return 0;
73}
74
75void * __init
76paravirt_get_gate_section(void)
77{
78 return pv_patchdata.gate_section;
79}
diff --git a/arch/ia64/kernel/paravirt_patchlist.h b/arch/ia64/kernel/paravirt_patchlist.h
new file mode 100644
index 000000000000..0684aa6c6507
--- /dev/null
+++ b/arch/ia64/kernel/paravirt_patchlist.h
@@ -0,0 +1,28 @@
1/******************************************************************************
2 * linux/arch/ia64/xen/paravirt_patchlist.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#if defined(__IA64_GATE_PARAVIRTUALIZED_XEN)
24#include <asm/xen/patchlist.h>
25#else
26#include <asm/native/patchlist.h>
27#endif
28
diff --git a/arch/ia64/kernel/paravirtentry.S b/arch/ia64/kernel/paravirtentry.S
index 2f42fcb9776a..6158560d7f17 100644
--- a/arch/ia64/kernel/paravirtentry.S
+++ b/arch/ia64/kernel/paravirtentry.S
@@ -20,8 +20,11 @@
20 * 20 *
21 */ 21 */
22 22
23#include <linux/init.h>
23#include <asm/asmmacro.h> 24#include <asm/asmmacro.h>
24#include <asm/asm-offsets.h> 25#include <asm/asm-offsets.h>
26#include <asm/paravirt_privop.h>
27#include <asm/paravirt_patch.h>
25#include "entry.h" 28#include "entry.h"
26 29
27#define DATA8(sym, init_value) \ 30#define DATA8(sym, init_value) \
@@ -32,29 +35,87 @@
32 data8 init_value ; \ 35 data8 init_value ; \
33 .popsection 36 .popsection
34 37
35#define BRANCH(targ, reg, breg) \ 38#define BRANCH(targ, reg, breg, type) \
36 movl reg=targ ; \ 39 PARAVIRT_PATCH_SITE_BR(PARAVIRT_PATCH_TYPE_BR_ ## type) ; \
37 ;; \ 40 ;; \
38 ld8 reg=[reg] ; \ 41 movl reg=targ ; \
39 ;; \ 42 ;; \
40 mov breg=reg ; \ 43 ld8 reg=[reg] ; \
44 ;; \
45 mov breg=reg ; \
41 br.cond.sptk.many breg 46 br.cond.sptk.many breg
42 47
43#define BRANCH_PROC(sym, reg, breg) \ 48#define BRANCH_PROC(sym, reg, breg, type) \
44 DATA8(paravirt_ ## sym ## _targ, ia64_native_ ## sym) ; \ 49 DATA8(paravirt_ ## sym ## _targ, ia64_native_ ## sym) ; \
45 GLOBAL_ENTRY(paravirt_ ## sym) ; \ 50 GLOBAL_ENTRY(paravirt_ ## sym) ; \
46 BRANCH(paravirt_ ## sym ## _targ, reg, breg) ; \ 51 BRANCH(paravirt_ ## sym ## _targ, reg, breg, type) ; \
47 END(paravirt_ ## sym) 52 END(paravirt_ ## sym)
48 53
49#define BRANCH_PROC_UNWINFO(sym, reg, breg) \ 54#define BRANCH_PROC_UNWINFO(sym, reg, breg, type) \
50 DATA8(paravirt_ ## sym ## _targ, ia64_native_ ## sym) ; \ 55 DATA8(paravirt_ ## sym ## _targ, ia64_native_ ## sym) ; \
51 GLOBAL_ENTRY(paravirt_ ## sym) ; \ 56 GLOBAL_ENTRY(paravirt_ ## sym) ; \
52 PT_REGS_UNWIND_INFO(0) ; \ 57 PT_REGS_UNWIND_INFO(0) ; \
53 BRANCH(paravirt_ ## sym ## _targ, reg, breg) ; \ 58 BRANCH(paravirt_ ## sym ## _targ, reg, breg, type) ; \
54 END(paravirt_ ## sym) 59 END(paravirt_ ## sym)
55 60
56 61
57BRANCH_PROC(switch_to, r22, b7) 62BRANCH_PROC(switch_to, r22, b7, SWITCH_TO)
58BRANCH_PROC_UNWINFO(leave_syscall, r22, b7) 63BRANCH_PROC_UNWINFO(leave_syscall, r22, b7, LEAVE_SYSCALL)
59BRANCH_PROC(work_processed_syscall, r2, b7) 64BRANCH_PROC(work_processed_syscall, r2, b7, WORK_PROCESSED_SYSCALL)
60BRANCH_PROC_UNWINFO(leave_kernel, r22, b7) 65BRANCH_PROC_UNWINFO(leave_kernel, r22, b7, LEAVE_KERNEL)
66
67
68#ifdef CONFIG_MODULES
69#define __INIT_OR_MODULE .text
70#define __INITDATA_OR_MODULE .data
71#else
72#define __INIT_OR_MODULE __INIT
73#define __INITDATA_OR_MODULE __INITDATA
74#endif /* CONFIG_MODULES */
75
76 __INIT_OR_MODULE
77 GLOBAL_ENTRY(paravirt_fc_i)
78 fc.i r32
79 br.ret.sptk.many rp
80 END(paravirt_fc_i)
81 __FINIT
82
83 __INIT_OR_MODULE
84 .align 32
85 GLOBAL_ENTRY(paravirt_nop_b_inst_bundle)
86 {
87 nop.b 0
88 nop.b 0
89 nop.b 0
90 }
91 END(paravirt_nop_b_inst_bundle)
92 __FINIT
93
94 /* NOTE: nop.[mfi] has same format */
95 __INIT_OR_MODULE
96 GLOBAL_ENTRY(paravirt_nop_mfi_inst_bundle)
97 {
98 nop.m 0
99 nop.f 0
100 nop.i 0
101 }
102 END(paravirt_nop_mfi_inst_bundle)
103 __FINIT
104
105 __INIT_OR_MODULE
106 GLOBAL_ENTRY(paravirt_nop_bundle)
107paravirt_nop_bundle_start:
108 {
109 nop 0
110 nop 0
111 nop 0
112 }
113paravirt_nop_bundle_end:
114 END(paravirt_nop_bundle)
115 __FINIT
116
117 __INITDATA_OR_MODULE
118 .align 8
119 .global paravirt_nop_bundle_size
120paravirt_nop_bundle_size:
121 data8 paravirt_nop_bundle_end - paravirt_nop_bundle_start
diff --git a/arch/ia64/kernel/patch.c b/arch/ia64/kernel/patch.c
index b83b2c516008..68a1311db806 100644
--- a/arch/ia64/kernel/patch.c
+++ b/arch/ia64/kernel/patch.c
@@ -7,6 +7,7 @@
7#include <linux/init.h> 7#include <linux/init.h>
8#include <linux/string.h> 8#include <linux/string.h>
9 9
10#include <asm/paravirt.h>
10#include <asm/patch.h> 11#include <asm/patch.h>
11#include <asm/processor.h> 12#include <asm/processor.h>
12#include <asm/sections.h> 13#include <asm/sections.h>
@@ -169,16 +170,35 @@ ia64_patch_mckinley_e9 (unsigned long start, unsigned long end)
169 ia64_srlz_i(); 170 ia64_srlz_i();
170} 171}
171 172
173extern unsigned long ia64_native_fsyscall_table[NR_syscalls];
174extern char ia64_native_fsys_bubble_down[];
175struct pv_fsys_data pv_fsys_data __initdata = {
176 .fsyscall_table = (unsigned long *)ia64_native_fsyscall_table,
177 .fsys_bubble_down = (void *)ia64_native_fsys_bubble_down,
178};
179
180unsigned long * __init
181paravirt_get_fsyscall_table(void)
182{
183 return pv_fsys_data.fsyscall_table;
184}
185
186char * __init
187paravirt_get_fsys_bubble_down(void)
188{
189 return pv_fsys_data.fsys_bubble_down;
190}
191
172static void __init 192static void __init
173patch_fsyscall_table (unsigned long start, unsigned long end) 193patch_fsyscall_table (unsigned long start, unsigned long end)
174{ 194{
175 extern unsigned long fsyscall_table[NR_syscalls]; 195 u64 fsyscall_table = (u64)paravirt_get_fsyscall_table();
176 s32 *offp = (s32 *) start; 196 s32 *offp = (s32 *) start;
177 u64 ip; 197 u64 ip;
178 198
179 while (offp < (s32 *) end) { 199 while (offp < (s32 *) end) {
180 ip = (u64) ia64_imva((char *) offp + *offp); 200 ip = (u64) ia64_imva((char *) offp + *offp);
181 ia64_patch_imm64(ip, (u64) fsyscall_table); 201 ia64_patch_imm64(ip, fsyscall_table);
182 ia64_fc((void *) ip); 202 ia64_fc((void *) ip);
183 ++offp; 203 ++offp;
184 } 204 }
@@ -189,7 +209,7 @@ patch_fsyscall_table (unsigned long start, unsigned long end)
189static void __init 209static void __init
190patch_brl_fsys_bubble_down (unsigned long start, unsigned long end) 210patch_brl_fsys_bubble_down (unsigned long start, unsigned long end)
191{ 211{
192 extern char fsys_bubble_down[]; 212 u64 fsys_bubble_down = (u64)paravirt_get_fsys_bubble_down();
193 s32 *offp = (s32 *) start; 213 s32 *offp = (s32 *) start;
194 u64 ip; 214 u64 ip;
195 215
@@ -207,13 +227,13 @@ patch_brl_fsys_bubble_down (unsigned long start, unsigned long end)
207void __init 227void __init
208ia64_patch_gate (void) 228ia64_patch_gate (void)
209{ 229{
210# define START(name) ((unsigned long) __start_gate_##name##_patchlist) 230# define START(name) paravirt_get_gate_patchlist(PV_GATE_START_##name)
211# define END(name) ((unsigned long)__end_gate_##name##_patchlist) 231# define END(name) paravirt_get_gate_patchlist(PV_GATE_END_##name)
212 232
213 patch_fsyscall_table(START(fsyscall), END(fsyscall)); 233 patch_fsyscall_table(START(FSYSCALL), END(FSYSCALL));
214 patch_brl_fsys_bubble_down(START(brl_fsys_bubble_down), END(brl_fsys_bubble_down)); 234 patch_brl_fsys_bubble_down(START(BRL_FSYS_BUBBLE_DOWN), END(BRL_FSYS_BUBBLE_DOWN));
215 ia64_patch_vtop(START(vtop), END(vtop)); 235 ia64_patch_vtop(START(VTOP), END(VTOP));
216 ia64_patch_mckinley_e9(START(mckinley_e9), END(mckinley_e9)); 236 ia64_patch_mckinley_e9(START(MCKINLEY_E9), END(MCKINLEY_E9));
217} 237}
218 238
219void ia64_patch_phys_stack_reg(unsigned long val) 239void ia64_patch_phys_stack_reg(unsigned long val)
@@ -229,7 +249,7 @@ void ia64_patch_phys_stack_reg(unsigned long val)
229 while (offp < end) { 249 while (offp < end) {
230 ip = (u64) offp + *offp; 250 ip = (u64) offp + *offp;
231 ia64_patch(ip, mask, imm); 251 ia64_patch(ip, mask, imm);
232 ia64_fc(ip); 252 ia64_fc((void *)ip);
233 ++offp; 253 ++offp;
234 } 254 }
235 ia64_sync_i(); 255 ia64_sync_i();
diff --git a/arch/ia64/kernel/perfmon.c b/arch/ia64/kernel/perfmon.c
index 5c0f408cfd71..8a06dc480594 100644
--- a/arch/ia64/kernel/perfmon.c
+++ b/arch/ia64/kernel/perfmon.c
@@ -5603,7 +5603,7 @@ pfm_interrupt_handler(int irq, void *arg)
5603 * /proc/perfmon interface, for debug only 5603 * /proc/perfmon interface, for debug only
5604 */ 5604 */
5605 5605
5606#define PFM_PROC_SHOW_HEADER ((void *)NR_CPUS+1) 5606#define PFM_PROC_SHOW_HEADER ((void *)nr_cpu_ids+1)
5607 5607
5608static void * 5608static void *
5609pfm_proc_start(struct seq_file *m, loff_t *pos) 5609pfm_proc_start(struct seq_file *m, loff_t *pos)
@@ -5612,7 +5612,7 @@ pfm_proc_start(struct seq_file *m, loff_t *pos)
5612 return PFM_PROC_SHOW_HEADER; 5612 return PFM_PROC_SHOW_HEADER;
5613 } 5613 }
5614 5614
5615 while (*pos <= NR_CPUS) { 5615 while (*pos <= nr_cpu_ids) {
5616 if (cpu_online(*pos - 1)) { 5616 if (cpu_online(*pos - 1)) {
5617 return (void *)*pos; 5617 return (void *)*pos;
5618 } 5618 }
diff --git a/arch/ia64/kernel/process.c b/arch/ia64/kernel/process.c
index c57162705147..5d7c0e5b9e76 100644
--- a/arch/ia64/kernel/process.c
+++ b/arch/ia64/kernel/process.c
@@ -413,7 +413,7 @@ ia64_load_extra (struct task_struct *task)
413 * so there is nothing to worry about. 413 * so there is nothing to worry about.
414 */ 414 */
415int 415int
416copy_thread (int nr, unsigned long clone_flags, 416copy_thread(unsigned long clone_flags,
417 unsigned long user_stack_base, unsigned long user_stack_size, 417 unsigned long user_stack_base, unsigned long user_stack_size,
418 struct task_struct *p, struct pt_regs *regs) 418 struct task_struct *p, struct pt_regs *regs)
419{ 419{
diff --git a/arch/ia64/kernel/salinfo.c b/arch/ia64/kernel/salinfo.c
index ecb9eb78d687..7053c55b7649 100644
--- a/arch/ia64/kernel/salinfo.c
+++ b/arch/ia64/kernel/salinfo.c
@@ -317,7 +317,7 @@ retry:
317 } 317 }
318 318
319 n = data->cpu_check; 319 n = data->cpu_check;
320 for (i = 0; i < NR_CPUS; i++) { 320 for (i = 0; i < nr_cpu_ids; i++) {
321 if (cpu_isset(n, data->cpu_event)) { 321 if (cpu_isset(n, data->cpu_event)) {
322 if (!cpu_online(n)) { 322 if (!cpu_online(n)) {
323 cpu_clear(n, data->cpu_event); 323 cpu_clear(n, data->cpu_event);
@@ -326,7 +326,7 @@ retry:
326 cpu = n; 326 cpu = n;
327 break; 327 break;
328 } 328 }
329 if (++n == NR_CPUS) 329 if (++n == nr_cpu_ids)
330 n = 0; 330 n = 0;
331 } 331 }
332 332
@@ -337,7 +337,7 @@ retry:
337 337
338 /* for next read, start checking at next CPU */ 338 /* for next read, start checking at next CPU */
339 data->cpu_check = cpu; 339 data->cpu_check = cpu;
340 if (++data->cpu_check == NR_CPUS) 340 if (++data->cpu_check == nr_cpu_ids)
341 data->cpu_check = 0; 341 data->cpu_check = 0;
342 342
343 snprintf(cmd, sizeof(cmd), "read %d\n", cpu); 343 snprintf(cmd, sizeof(cmd), "read %d\n", cpu);
diff --git a/arch/ia64/kernel/setup.c b/arch/ia64/kernel/setup.c
index 865af27c7737..714066aeda7f 100644
--- a/arch/ia64/kernel/setup.c
+++ b/arch/ia64/kernel/setup.c
@@ -52,6 +52,7 @@
52#include <asm/meminit.h> 52#include <asm/meminit.h>
53#include <asm/page.h> 53#include <asm/page.h>
54#include <asm/paravirt.h> 54#include <asm/paravirt.h>
55#include <asm/paravirt_patch.h>
55#include <asm/patch.h> 56#include <asm/patch.h>
56#include <asm/pgtable.h> 57#include <asm/pgtable.h>
57#include <asm/processor.h> 58#include <asm/processor.h>
@@ -537,6 +538,7 @@ setup_arch (char **cmdline_p)
537 paravirt_arch_setup_early(); 538 paravirt_arch_setup_early();
538 539
539 ia64_patch_vtop((u64) __start___vtop_patchlist, (u64) __end___vtop_patchlist); 540 ia64_patch_vtop((u64) __start___vtop_patchlist, (u64) __end___vtop_patchlist);
541 paravirt_patch_apply();
540 542
541 *cmdline_p = __va(ia64_boot_param->command_line); 543 *cmdline_p = __va(ia64_boot_param->command_line);
542 strlcpy(boot_command_line, *cmdline_p, COMMAND_LINE_SIZE); 544 strlcpy(boot_command_line, *cmdline_p, COMMAND_LINE_SIZE);
@@ -730,10 +732,10 @@ static void *
730c_start (struct seq_file *m, loff_t *pos) 732c_start (struct seq_file *m, loff_t *pos)
731{ 733{
732#ifdef CONFIG_SMP 734#ifdef CONFIG_SMP
733 while (*pos < NR_CPUS && !cpu_isset(*pos, cpu_online_map)) 735 while (*pos < nr_cpu_ids && !cpu_online(*pos))
734 ++*pos; 736 ++*pos;
735#endif 737#endif
736 return *pos < NR_CPUS ? cpu_data(*pos) : NULL; 738 return *pos < nr_cpu_ids ? cpu_data(*pos) : NULL;
737} 739}
738 740
739static void * 741static void *
@@ -1016,8 +1018,7 @@ cpu_init (void)
1016 | IA64_DCR_DA | IA64_DCR_DD | IA64_DCR_LC)); 1018 | IA64_DCR_DA | IA64_DCR_DD | IA64_DCR_LC));
1017 atomic_inc(&init_mm.mm_count); 1019 atomic_inc(&init_mm.mm_count);
1018 current->active_mm = &init_mm; 1020 current->active_mm = &init_mm;
1019 if (current->mm) 1021 BUG_ON(current->mm);
1020 BUG();
1021 1022
1022 ia64_mmu_init(ia64_imva(cpu_data)); 1023 ia64_mmu_init(ia64_imva(cpu_data));
1023 ia64_mca_cpu_init(ia64_imva(cpu_data)); 1024 ia64_mca_cpu_init(ia64_imva(cpu_data));
diff --git a/arch/ia64/kernel/smp.c b/arch/ia64/kernel/smp.c
index da8f020d82c1..2ea4199d9c57 100644
--- a/arch/ia64/kernel/smp.c
+++ b/arch/ia64/kernel/smp.c
@@ -166,11 +166,11 @@ send_IPI_allbutself (int op)
166 * Called with preemption disabled. 166 * Called with preemption disabled.
167 */ 167 */
168static inline void 168static inline void
169send_IPI_mask(cpumask_t mask, int op) 169send_IPI_mask(const struct cpumask *mask, int op)
170{ 170{
171 unsigned int cpu; 171 unsigned int cpu;
172 172
173 for_each_cpu_mask(cpu, mask) { 173 for_each_cpu(cpu, mask) {
174 send_IPI_single(cpu, op); 174 send_IPI_single(cpu, op);
175 } 175 }
176} 176}
@@ -316,7 +316,7 @@ void arch_send_call_function_single_ipi(int cpu)
316 send_IPI_single(cpu, IPI_CALL_FUNC_SINGLE); 316 send_IPI_single(cpu, IPI_CALL_FUNC_SINGLE);
317} 317}
318 318
319void arch_send_call_function_ipi(cpumask_t mask) 319void arch_send_call_function_ipi_mask(const struct cpumask *mask)
320{ 320{
321 send_IPI_mask(mask, IPI_CALL_FUNC); 321 send_IPI_mask(mask, IPI_CALL_FUNC);
322} 322}
diff --git a/arch/ia64/kernel/smpboot.c b/arch/ia64/kernel/smpboot.c
index 52290547c85b..7700e23034bb 100644
--- a/arch/ia64/kernel/smpboot.c
+++ b/arch/ia64/kernel/smpboot.c
@@ -581,14 +581,14 @@ smp_build_cpu_map (void)
581 581
582 ia64_cpu_to_sapicid[0] = boot_cpu_id; 582 ia64_cpu_to_sapicid[0] = boot_cpu_id;
583 cpus_clear(cpu_present_map); 583 cpus_clear(cpu_present_map);
584 cpu_set(0, cpu_present_map); 584 set_cpu_present(0, true);
585 cpu_set(0, cpu_possible_map); 585 set_cpu_possible(0, true);
586 for (cpu = 1, i = 0; i < smp_boot_data.cpu_count; i++) { 586 for (cpu = 1, i = 0; i < smp_boot_data.cpu_count; i++) {
587 sapicid = smp_boot_data.cpu_phys_id[i]; 587 sapicid = smp_boot_data.cpu_phys_id[i];
588 if (sapicid == boot_cpu_id) 588 if (sapicid == boot_cpu_id)
589 continue; 589 continue;
590 cpu_set(cpu, cpu_present_map); 590 set_cpu_present(cpu, true);
591 cpu_set(cpu, cpu_possible_map); 591 set_cpu_possible(cpu, true);
592 ia64_cpu_to_sapicid[cpu] = sapicid; 592 ia64_cpu_to_sapicid[cpu] = sapicid;
593 cpu++; 593 cpu++;
594 } 594 }
@@ -626,12 +626,9 @@ smp_prepare_cpus (unsigned int max_cpus)
626 */ 626 */
627 if (!max_cpus) { 627 if (!max_cpus) {
628 printk(KERN_INFO "SMP mode deactivated.\n"); 628 printk(KERN_INFO "SMP mode deactivated.\n");
629 cpus_clear(cpu_online_map); 629 init_cpu_online(cpumask_of(0));
630 cpus_clear(cpu_present_map); 630 init_cpu_present(cpumask_of(0));
631 cpus_clear(cpu_possible_map); 631 init_cpu_possible(cpumask_of(0));
632 cpu_set(0, cpu_online_map);
633 cpu_set(0, cpu_present_map);
634 cpu_set(0, cpu_possible_map);
635 return; 632 return;
636 } 633 }
637} 634}
diff --git a/arch/ia64/kernel/time.c b/arch/ia64/kernel/time.c
index d6747bae52d8..641c8b61c4f1 100644
--- a/arch/ia64/kernel/time.c
+++ b/arch/ia64/kernel/time.c
@@ -51,6 +51,15 @@ EXPORT_SYMBOL(last_cli_ip);
51#endif 51#endif
52 52
53#ifdef CONFIG_PARAVIRT 53#ifdef CONFIG_PARAVIRT
54/* We need to define a real function for sched_clock, to override the
55 weak default version */
56unsigned long long sched_clock(void)
57{
58 return paravirt_sched_clock();
59}
60#endif
61
62#ifdef CONFIG_PARAVIRT
54static void 63static void
55paravirt_clocksource_resume(void) 64paravirt_clocksource_resume(void)
56{ 65{
diff --git a/arch/ia64/kernel/vmlinux.lds.S b/arch/ia64/kernel/vmlinux.lds.S
index 3765efc5f963..4a95e86b9ac2 100644
--- a/arch/ia64/kernel/vmlinux.lds.S
+++ b/arch/ia64/kernel/vmlinux.lds.S
@@ -169,6 +169,30 @@ SECTIONS
169 __end___mckinley_e9_bundles = .; 169 __end___mckinley_e9_bundles = .;
170 } 170 }
171 171
172#if defined(CONFIG_PARAVIRT)
173 . = ALIGN(16);
174 .paravirt_bundles : AT(ADDR(.paravirt_bundles) - LOAD_OFFSET)
175 {
176 __start_paravirt_bundles = .;
177 *(.paravirt_bundles)
178 __stop_paravirt_bundles = .;
179 }
180 . = ALIGN(16);
181 .paravirt_insts : AT(ADDR(.paravirt_insts) - LOAD_OFFSET)
182 {
183 __start_paravirt_insts = .;
184 *(.paravirt_insts)
185 __stop_paravirt_insts = .;
186 }
187 . = ALIGN(16);
188 .paravirt_branches : AT(ADDR(.paravirt_branches) - LOAD_OFFSET)
189 {
190 __start_paravirt_branches = .;
191 *(.paravirt_branches)
192 __stop_paravirt_branches = .;
193 }
194#endif
195
172#if defined(CONFIG_IA64_GENERIC) 196#if defined(CONFIG_IA64_GENERIC)
173 /* Machine Vector */ 197 /* Machine Vector */
174 . = ALIGN(16); 198 . = ALIGN(16);
@@ -201,6 +225,12 @@ SECTIONS
201 __start_gate_section = .; 225 __start_gate_section = .;
202 *(.data.gate) 226 *(.data.gate)
203 __stop_gate_section = .; 227 __stop_gate_section = .;
228#ifdef CONFIG_XEN
229 . = ALIGN(PAGE_SIZE);
230 __xen_start_gate_section = .;
231 *(.data.gate.xen)
232 __xen_stop_gate_section = .;
233#endif
204 } 234 }
205 . = ALIGN(PAGE_SIZE); /* make sure the gate page doesn't expose 235 . = ALIGN(PAGE_SIZE); /* make sure the gate page doesn't expose
206 * kernel data 236 * kernel data
diff --git a/arch/ia64/kvm/kvm-ia64.c b/arch/ia64/kvm/kvm-ia64.c
index 076b00d1dbff..28af6a731bb8 100644
--- a/arch/ia64/kvm/kvm-ia64.c
+++ b/arch/ia64/kvm/kvm-ia64.c
@@ -70,7 +70,7 @@ static void kvm_flush_icache(unsigned long start, unsigned long len)
70 int l; 70 int l;
71 71
72 for (l = 0; l < (len + 32); l += 32) 72 for (l = 0; l < (len + 32); l += 32)
73 ia64_fc(start + l); 73 ia64_fc((void *)(start + l));
74 74
75 ia64_sync_i(); 75 ia64_sync_i();
76 ia64_srlz_i(); 76 ia64_srlz_i();
diff --git a/arch/ia64/kvm/vcpu.c b/arch/ia64/kvm/vcpu.c
index d4d280505878..a18ee17b9192 100644
--- a/arch/ia64/kvm/vcpu.c
+++ b/arch/ia64/kvm/vcpu.c
@@ -386,7 +386,7 @@ void set_rse_reg(struct kvm_pt_regs *regs, unsigned long r1,
386 else 386 else
387 *rnat_addr = (*rnat_addr) & (~nat_mask); 387 *rnat_addr = (*rnat_addr) & (~nat_mask);
388 388
389 ia64_setreg(_IA64_REG_AR_BSPSTORE, bspstore); 389 ia64_setreg(_IA64_REG_AR_BSPSTORE, (unsigned long)bspstore);
390 ia64_setreg(_IA64_REG_AR_RNAT, rnat); 390 ia64_setreg(_IA64_REG_AR_RNAT, rnat);
391 } 391 }
392 local_irq_restore(psr); 392 local_irq_restore(psr);
diff --git a/arch/ia64/kvm/vtlb.c b/arch/ia64/kvm/vtlb.c
index 38232b37668b..2c2501f13159 100644
--- a/arch/ia64/kvm/vtlb.c
+++ b/arch/ia64/kvm/vtlb.c
@@ -210,6 +210,7 @@ void thash_vhpt_insert(struct kvm_vcpu *v, u64 pte, u64 itir, u64 va, int type)
210 phy_pte &= ~PAGE_FLAGS_RV_MASK; 210 phy_pte &= ~PAGE_FLAGS_RV_MASK;
211 psr = ia64_clear_ic(); 211 psr = ia64_clear_ic();
212 ia64_itc(type, va, phy_pte, itir_ps(itir)); 212 ia64_itc(type, va, phy_pte, itir_ps(itir));
213 paravirt_dv_serialize_data();
213 ia64_set_psr(psr); 214 ia64_set_psr(psr);
214 } 215 }
215 216
@@ -456,6 +457,7 @@ void thash_purge_and_insert(struct kvm_vcpu *v, u64 pte, u64 itir,
456 phy_pte &= ~PAGE_FLAGS_RV_MASK; 457 phy_pte &= ~PAGE_FLAGS_RV_MASK;
457 psr = ia64_clear_ic(); 458 psr = ia64_clear_ic();
458 ia64_itc(type, ifa, phy_pte, ps); 459 ia64_itc(type, ifa, phy_pte, ps);
460 paravirt_dv_serialize_data();
459 ia64_set_psr(psr); 461 ia64_set_psr(psr);
460 } 462 }
461 if (!(pte&VTLB_PTE_IO)) 463 if (!(pte&VTLB_PTE_IO))
diff --git a/arch/ia64/mm/init.c b/arch/ia64/mm/init.c
index 56e12903973c..c0f3bee69042 100644
--- a/arch/ia64/mm/init.c
+++ b/arch/ia64/mm/init.c
@@ -35,6 +35,7 @@
35#include <asm/uaccess.h> 35#include <asm/uaccess.h>
36#include <asm/unistd.h> 36#include <asm/unistd.h>
37#include <asm/mca.h> 37#include <asm/mca.h>
38#include <asm/paravirt.h>
38 39
39DEFINE_PER_CPU(struct mmu_gather, mmu_gathers); 40DEFINE_PER_CPU(struct mmu_gather, mmu_gathers);
40 41
@@ -259,6 +260,7 @@ put_kernel_page (struct page *page, unsigned long address, pgprot_t pgprot)
259static void __init 260static void __init
260setup_gate (void) 261setup_gate (void)
261{ 262{
263 void *gate_section;
262 struct page *page; 264 struct page *page;
263 265
264 /* 266 /*
@@ -266,10 +268,11 @@ setup_gate (void)
266 * headers etc. and once execute-only page to enable 268 * headers etc. and once execute-only page to enable
267 * privilege-promotion via "epc": 269 * privilege-promotion via "epc":
268 */ 270 */
269 page = virt_to_page(ia64_imva(__start_gate_section)); 271 gate_section = paravirt_get_gate_section();
272 page = virt_to_page(ia64_imva(gate_section));
270 put_kernel_page(page, GATE_ADDR, PAGE_READONLY); 273 put_kernel_page(page, GATE_ADDR, PAGE_READONLY);
271#ifdef HAVE_BUGGY_SEGREL 274#ifdef HAVE_BUGGY_SEGREL
272 page = virt_to_page(ia64_imva(__start_gate_section + PAGE_SIZE)); 275 page = virt_to_page(ia64_imva(gate_section + PAGE_SIZE));
273 put_kernel_page(page, GATE_ADDR + PAGE_SIZE, PAGE_GATE); 276 put_kernel_page(page, GATE_ADDR + PAGE_SIZE, PAGE_GATE);
274#else 277#else
275 put_kernel_page(page, GATE_ADDR + PERCPU_PAGE_SIZE, PAGE_GATE); 278 put_kernel_page(page, GATE_ADDR + PERCPU_PAGE_SIZE, PAGE_GATE);
@@ -633,8 +636,7 @@ mem_init (void)
633#endif 636#endif
634 637
635#ifdef CONFIG_FLATMEM 638#ifdef CONFIG_FLATMEM
636 if (!mem_map) 639 BUG_ON(!mem_map);
637 BUG();
638 max_mapnr = max_low_pfn; 640 max_mapnr = max_low_pfn;
639#endif 641#endif
640 642
@@ -667,8 +669,8 @@ mem_init (void)
667 * code can tell them apart. 669 * code can tell them apart.
668 */ 670 */
669 for (i = 0; i < NR_syscalls; ++i) { 671 for (i = 0; i < NR_syscalls; ++i) {
670 extern unsigned long fsyscall_table[NR_syscalls];
671 extern unsigned long sys_call_table[NR_syscalls]; 672 extern unsigned long sys_call_table[NR_syscalls];
673 unsigned long *fsyscall_table = paravirt_get_fsyscall_table();
672 674
673 if (!fsyscall_table[i] || nolwsys) 675 if (!fsyscall_table[i] || nolwsys)
674 fsyscall_table[i] = sys_call_table[i] | 1; 676 fsyscall_table[i] = sys_call_table[i] | 1;
diff --git a/arch/ia64/mm/tlb.c b/arch/ia64/mm/tlb.c
index bd9818a36b47..b9f3d7bbb338 100644
--- a/arch/ia64/mm/tlb.c
+++ b/arch/ia64/mm/tlb.c
@@ -309,7 +309,7 @@ flush_tlb_range (struct vm_area_struct *vma, unsigned long start,
309 309
310 preempt_disable(); 310 preempt_disable();
311#ifdef CONFIG_SMP 311#ifdef CONFIG_SMP
312 if (mm != current->active_mm || cpus_weight(mm->cpu_vm_mask) != 1) { 312 if (mm != current->active_mm || cpumask_weight(mm_cpumask(mm)) != 1) {
313 platform_global_tlb_purge(mm, start, end, nbits); 313 platform_global_tlb_purge(mm, start, end, nbits);
314 preempt_enable(); 314 preempt_enable();
315 return; 315 return;
diff --git a/arch/ia64/scripts/pvcheck.sed b/arch/ia64/scripts/pvcheck.sed
index ba66ac2e4c60..e59809a3fc01 100644
--- a/arch/ia64/scripts/pvcheck.sed
+++ b/arch/ia64/scripts/pvcheck.sed
@@ -17,6 +17,7 @@ s/mov.*=.*cr\.iip/.warning \"cr.iip should not used directly\"/g
17s/mov.*=.*cr\.ivr/.warning \"cr.ivr 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 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 19s/mov.*=.*ar\.eflags/.warning \"ar.eflags should not used directly\"/g
20s/mov.*=.*ar\.itc.*/.warning \"ar.itc should not used directly\"/g
20s/mov.*cr\.ifa.*=.*/.warning \"cr.ifa should not used directly\"/g 21s/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\.itir.*=.*/.warning \"cr.itir should not used directly\"/g
22s/mov.*cr\.iha.*=.*/.warning \"cr.iha should not used directly\"/g 23s/mov.*cr\.iha.*=.*/.warning \"cr.iha should not used directly\"/g
diff --git a/arch/ia64/sn/kernel/io_common.c b/arch/ia64/sn/kernel/io_common.c
index 0d4ffa4da1da..57f280dd9def 100644
--- a/arch/ia64/sn/kernel/io_common.c
+++ b/arch/ia64/sn/kernel/io_common.c
@@ -135,8 +135,7 @@ static s64 sn_device_fixup_war(u64 nasid, u64 widget, int device,
135 } 135 }
136 136
137 war_list = kzalloc(DEV_PER_WIDGET * sizeof(*war_list), GFP_KERNEL); 137 war_list = kzalloc(DEV_PER_WIDGET * sizeof(*war_list), GFP_KERNEL);
138 if (!war_list) 138 BUG_ON(!war_list);
139 BUG();
140 139
141 SAL_CALL_NOLOCK(isrv, SN_SAL_IOIF_GET_WIDGET_DMAFLUSH_LIST, 140 SAL_CALL_NOLOCK(isrv, SN_SAL_IOIF_GET_WIDGET_DMAFLUSH_LIST,
142 nasid, widget, __pa(war_list), 0, 0, 0 ,0); 141 nasid, widget, __pa(war_list), 0, 0, 0 ,0);
@@ -180,23 +179,20 @@ sn_common_hubdev_init(struct hubdev_info *hubdev)
180 sizeof(struct sn_flush_device_kernel *); 179 sizeof(struct sn_flush_device_kernel *);
181 hubdev->hdi_flush_nasid_list.widget_p = 180 hubdev->hdi_flush_nasid_list.widget_p =
182 kzalloc(size, GFP_KERNEL); 181 kzalloc(size, GFP_KERNEL);
183 if (!hubdev->hdi_flush_nasid_list.widget_p) 182 BUG_ON(!hubdev->hdi_flush_nasid_list.widget_p);
184 BUG();
185 183
186 for (widget = 0; widget <= HUB_WIDGET_ID_MAX; widget++) { 184 for (widget = 0; widget <= HUB_WIDGET_ID_MAX; widget++) {
187 size = DEV_PER_WIDGET * 185 size = DEV_PER_WIDGET *
188 sizeof(struct sn_flush_device_kernel); 186 sizeof(struct sn_flush_device_kernel);
189 sn_flush_device_kernel = kzalloc(size, GFP_KERNEL); 187 sn_flush_device_kernel = kzalloc(size, GFP_KERNEL);
190 if (!sn_flush_device_kernel) 188 BUG_ON(!sn_flush_device_kernel);
191 BUG();
192 189
193 dev_entry = sn_flush_device_kernel; 190 dev_entry = sn_flush_device_kernel;
194 for (device = 0; device < DEV_PER_WIDGET; 191 for (device = 0; device < DEV_PER_WIDGET;
195 device++, dev_entry++) { 192 device++, dev_entry++) {
196 size = sizeof(struct sn_flush_device_common); 193 size = sizeof(struct sn_flush_device_common);
197 dev_entry->common = kzalloc(size, GFP_KERNEL); 194 dev_entry->common = kzalloc(size, GFP_KERNEL);
198 if (!dev_entry->common) 195 BUG_ON(!dev_entry->common);
199 BUG();
200 if (sn_prom_feature_available(PRF_DEVICE_FLUSH_LIST)) 196 if (sn_prom_feature_available(PRF_DEVICE_FLUSH_LIST))
201 status = sal_get_device_dmaflush_list( 197 status = sal_get_device_dmaflush_list(
202 hubdev->hdi_nasid, widget, device, 198 hubdev->hdi_nasid, widget, device,
@@ -326,8 +322,7 @@ sn_common_bus_fixup(struct pci_bus *bus,
326 */ 322 */
327 controller->platform_data = kzalloc(sizeof(struct sn_platform_data), 323 controller->platform_data = kzalloc(sizeof(struct sn_platform_data),
328 GFP_KERNEL); 324 GFP_KERNEL);
329 if (controller->platform_data == NULL) 325 BUG_ON(controller->platform_data == NULL);
330 BUG();
331 sn_platform_data = 326 sn_platform_data =
332 (struct sn_platform_data *) controller->platform_data; 327 (struct sn_platform_data *) controller->platform_data;
333 sn_platform_data->provider_soft = provider_soft; 328 sn_platform_data->provider_soft = provider_soft;
diff --git a/arch/ia64/sn/kernel/io_init.c b/arch/ia64/sn/kernel/io_init.c
index e2eb2da60f96..ee774c366a06 100644
--- a/arch/ia64/sn/kernel/io_init.c
+++ b/arch/ia64/sn/kernel/io_init.c
@@ -128,8 +128,7 @@ sn_legacy_pci_window_fixup(struct pci_controller *controller,
128{ 128{
129 controller->window = kcalloc(2, sizeof(struct pci_window), 129 controller->window = kcalloc(2, sizeof(struct pci_window),
130 GFP_KERNEL); 130 GFP_KERNEL);
131 if (controller->window == NULL) 131 BUG_ON(controller->window == NULL);
132 BUG();
133 controller->window[0].offset = legacy_io; 132 controller->window[0].offset = legacy_io;
134 controller->window[0].resource.name = "legacy_io"; 133 controller->window[0].resource.name = "legacy_io";
135 controller->window[0].resource.flags = IORESOURCE_IO; 134 controller->window[0].resource.flags = IORESOURCE_IO;
@@ -168,8 +167,7 @@ sn_pci_window_fixup(struct pci_dev *dev, unsigned int count,
168 idx = controller->windows; 167 idx = controller->windows;
169 new_count = controller->windows + count; 168 new_count = controller->windows + count;
170 new_window = kcalloc(new_count, sizeof(struct pci_window), GFP_KERNEL); 169 new_window = kcalloc(new_count, sizeof(struct pci_window), GFP_KERNEL);
171 if (new_window == NULL) 170 BUG_ON(new_window == NULL);
172 BUG();
173 if (controller->window) { 171 if (controller->window) {
174 memcpy(new_window, controller->window, 172 memcpy(new_window, controller->window,
175 sizeof(struct pci_window) * controller->windows); 173 sizeof(struct pci_window) * controller->windows);
@@ -222,8 +220,7 @@ sn_io_slot_fixup(struct pci_dev *dev)
222 (u64) __pa(pcidev_info), 220 (u64) __pa(pcidev_info),
223 (u64) __pa(sn_irq_info)); 221 (u64) __pa(sn_irq_info));
224 222
225 if (status) 223 BUG_ON(status); /* Cannot get platform pci device information */
226 BUG(); /* Cannot get platform pci device information */
227 224
228 225
229 /* Copy over PIO Mapped Addresses */ 226 /* Copy over PIO Mapped Addresses */
@@ -307,8 +304,7 @@ sn_pci_controller_fixup(int segment, int busnum, struct pci_bus *bus)
307 prom_bussoft_ptr = __va(prom_bussoft_ptr); 304 prom_bussoft_ptr = __va(prom_bussoft_ptr);
308 305
309 controller = kzalloc(sizeof(*controller), GFP_KERNEL); 306 controller = kzalloc(sizeof(*controller), GFP_KERNEL);
310 if (!controller) 307 BUG_ON(!controller);
311 BUG();
312 controller->segment = segment; 308 controller->segment = segment;
313 309
314 /* 310 /*
diff --git a/arch/ia64/sn/kernel/setup.c b/arch/ia64/sn/kernel/setup.c
index 02c5b8a9fb60..e456f062f241 100644
--- a/arch/ia64/sn/kernel/setup.c
+++ b/arch/ia64/sn/kernel/setup.c
@@ -732,8 +732,7 @@ void __init build_cnode_tables(void)
732 kl_config_hdr_t *klgraph_header; 732 kl_config_hdr_t *klgraph_header;
733 nasid = cnodeid_to_nasid(node); 733 nasid = cnodeid_to_nasid(node);
734 klgraph_header = ia64_sn_get_klconfig_addr(nasid); 734 klgraph_header = ia64_sn_get_klconfig_addr(nasid);
735 if (klgraph_header == NULL) 735 BUG_ON(klgraph_header == NULL);
736 BUG();
737 brd = NODE_OFFSET_TO_LBOARD(nasid, klgraph_header->ch_board_info); 736 brd = NODE_OFFSET_TO_LBOARD(nasid, klgraph_header->ch_board_info);
738 while (brd) { 737 while (brd) {
739 if (board_needs_cnode(brd->brd_type) && physical_node_map[brd->brd_nasid] < 0) { 738 if (board_needs_cnode(brd->brd_type) && physical_node_map[brd->brd_nasid] < 0) {
@@ -750,7 +749,7 @@ nasid_slice_to_cpuid(int nasid, int slice)
750{ 749{
751 long cpu; 750 long cpu;
752 751
753 for (cpu = 0; cpu < NR_CPUS; cpu++) 752 for (cpu = 0; cpu < nr_cpu_ids; cpu++)
754 if (cpuid_to_nasid(cpu) == nasid && 753 if (cpuid_to_nasid(cpu) == nasid &&
755 cpuid_to_slice(cpu) == slice) 754 cpuid_to_slice(cpu) == slice)
756 return cpu; 755 return cpu;
diff --git a/arch/ia64/sn/kernel/sn2/sn2_smp.c b/arch/ia64/sn/kernel/sn2/sn2_smp.c
index e585f9a2afb9..1176506b2bae 100644
--- a/arch/ia64/sn/kernel/sn2/sn2_smp.c
+++ b/arch/ia64/sn/kernel/sn2/sn2_smp.c
@@ -133,7 +133,7 @@ sn2_ipi_flush_all_tlb(struct mm_struct *mm)
133 unsigned long itc; 133 unsigned long itc;
134 134
135 itc = ia64_get_itc(); 135 itc = ia64_get_itc();
136 smp_flush_tlb_cpumask(mm->cpu_vm_mask); 136 smp_flush_tlb_cpumask(*mm_cpumask(mm));
137 itc = ia64_get_itc() - itc; 137 itc = ia64_get_itc() - itc;
138 __get_cpu_var(ptcstats).shub_ipi_flushes_itc_clocks += itc; 138 __get_cpu_var(ptcstats).shub_ipi_flushes_itc_clocks += itc;
139 __get_cpu_var(ptcstats).shub_ipi_flushes++; 139 __get_cpu_var(ptcstats).shub_ipi_flushes++;
@@ -182,7 +182,7 @@ sn2_global_tlb_purge(struct mm_struct *mm, unsigned long start,
182 nodes_clear(nodes_flushed); 182 nodes_clear(nodes_flushed);
183 i = 0; 183 i = 0;
184 184
185 for_each_cpu_mask(cpu, mm->cpu_vm_mask) { 185 for_each_cpu(cpu, mm_cpumask(mm)) {
186 cnode = cpu_to_node(cpu); 186 cnode = cpu_to_node(cpu);
187 node_set(cnode, nodes_flushed); 187 node_set(cnode, nodes_flushed);
188 lcpu = cpu; 188 lcpu = cpu;
@@ -461,7 +461,7 @@ bool sn_cpu_disable_allowed(int cpu)
461 461
462static void *sn2_ptc_seq_start(struct seq_file *file, loff_t * offset) 462static void *sn2_ptc_seq_start(struct seq_file *file, loff_t * offset)
463{ 463{
464 if (*offset < NR_CPUS) 464 if (*offset < nr_cpu_ids)
465 return offset; 465 return offset;
466 return NULL; 466 return NULL;
467} 467}
@@ -469,7 +469,7 @@ static void *sn2_ptc_seq_start(struct seq_file *file, loff_t * offset)
469static void *sn2_ptc_seq_next(struct seq_file *file, void *data, loff_t * offset) 469static void *sn2_ptc_seq_next(struct seq_file *file, void *data, loff_t * offset)
470{ 470{
471 (*offset)++; 471 (*offset)++;
472 if (*offset < NR_CPUS) 472 if (*offset < nr_cpu_ids)
473 return offset; 473 return offset;
474 return NULL; 474 return NULL;
475} 475}
@@ -491,7 +491,7 @@ static int sn2_ptc_seq_show(struct seq_file *file, void *data)
491 seq_printf(file, "# ptctest %d, flushopt %d\n", sn2_ptctest, sn2_flush_opt); 491 seq_printf(file, "# ptctest %d, flushopt %d\n", sn2_ptctest, sn2_flush_opt);
492 } 492 }
493 493
494 if (cpu < NR_CPUS && cpu_online(cpu)) { 494 if (cpu < nr_cpu_ids && cpu_online(cpu)) {
495 stat = &per_cpu(ptcstats, cpu); 495 stat = &per_cpu(ptcstats, cpu);
496 seq_printf(file, "cpu %d %ld %ld %ld %ld %ld %ld %ld %ld %ld %ld %ld %ld\n", cpu, stat->ptc_l, 496 seq_printf(file, "cpu %d %ld %ld %ld %ld %ld %ld %ld %ld %ld %ld %ld %ld\n", cpu, stat->ptc_l,
497 stat->change_rid, stat->shub_ptc_flushes, stat->nodes_flushed, 497 stat->change_rid, stat->shub_ptc_flushes, stat->nodes_flushed,
@@ -554,7 +554,7 @@ static int __init sn2_ptc_init(void)
554 554
555 proc_sn2_ptc = proc_create(PTC_BASENAME, 0444, 555 proc_sn2_ptc = proc_create(PTC_BASENAME, 0444,
556 NULL, &proc_sn2_ptc_operations); 556 NULL, &proc_sn2_ptc_operations);
557 if (!&proc_sn2_ptc_operations) { 557 if (!proc_sn2_ptc) {
558 printk(KERN_ERR "unable to create %s proc entry", PTC_BASENAME); 558 printk(KERN_ERR "unable to create %s proc entry", PTC_BASENAME);
559 return -EINVAL; 559 return -EINVAL;
560 } 560 }
diff --git a/arch/ia64/sn/kernel/sn2/sn_hwperf.c b/arch/ia64/sn/kernel/sn2/sn_hwperf.c
index be339477f906..9e6491cf72bd 100644
--- a/arch/ia64/sn/kernel/sn2/sn_hwperf.c
+++ b/arch/ia64/sn/kernel/sn2/sn_hwperf.c
@@ -275,8 +275,7 @@ static int sn_hwperf_get_nearest_node_objdata(struct sn_hwperf_object_info *objb
275 275
276 /* get it's interconnect topology */ 276 /* get it's interconnect topology */
277 sz = op->ports * sizeof(struct sn_hwperf_port_info); 277 sz = op->ports * sizeof(struct sn_hwperf_port_info);
278 if (sz > sizeof(ptdata)) 278 BUG_ON(sz > sizeof(ptdata));
279 BUG();
280 e = ia64_sn_hwperf_op(sn_hwperf_master_nasid, 279 e = ia64_sn_hwperf_op(sn_hwperf_master_nasid,
281 SN_HWPERF_ENUM_PORTS, nodeobj->id, sz, 280 SN_HWPERF_ENUM_PORTS, nodeobj->id, sz,
282 (u64)&ptdata, 0, 0, NULL); 281 (u64)&ptdata, 0, 0, NULL);
@@ -310,8 +309,7 @@ static int sn_hwperf_get_nearest_node_objdata(struct sn_hwperf_object_info *objb
310 if (router && (!found_cpu || !found_mem)) { 309 if (router && (!found_cpu || !found_mem)) {
311 /* search for a node connected to the same router */ 310 /* search for a node connected to the same router */
312 sz = router->ports * sizeof(struct sn_hwperf_port_info); 311 sz = router->ports * sizeof(struct sn_hwperf_port_info);
313 if (sz > sizeof(ptdata)) 312 BUG_ON(sz > sizeof(ptdata));
314 BUG();
315 e = ia64_sn_hwperf_op(sn_hwperf_master_nasid, 313 e = ia64_sn_hwperf_op(sn_hwperf_master_nasid,
316 SN_HWPERF_ENUM_PORTS, router->id, sz, 314 SN_HWPERF_ENUM_PORTS, router->id, sz,
317 (u64)&ptdata, 0, 0, NULL); 315 (u64)&ptdata, 0, 0, NULL);
@@ -612,7 +610,7 @@ static int sn_hwperf_op_cpu(struct sn_hwperf_op_info *op_info)
612 op_info->a->arg &= SN_HWPERF_ARG_OBJID_MASK; 610 op_info->a->arg &= SN_HWPERF_ARG_OBJID_MASK;
613 611
614 if (cpu != SN_HWPERF_ARG_ANY_CPU) { 612 if (cpu != SN_HWPERF_ARG_ANY_CPU) {
615 if (cpu >= NR_CPUS || !cpu_online(cpu)) { 613 if (cpu >= nr_cpu_ids || !cpu_online(cpu)) {
616 r = -EINVAL; 614 r = -EINVAL;
617 goto out; 615 goto out;
618 } 616 }
diff --git a/arch/ia64/sn/pci/pcibr/pcibr_dma.c b/arch/ia64/sn/pci/pcibr/pcibr_dma.c
index 060df4aa9916..c659ad5613a0 100644
--- a/arch/ia64/sn/pci/pcibr/pcibr_dma.c
+++ b/arch/ia64/sn/pci/pcibr/pcibr_dma.c
@@ -256,9 +256,7 @@ void sn_dma_flush(u64 addr)
256 256
257 hubinfo = (NODEPDA(nasid_to_cnodeid(nasid)))->pdinfo; 257 hubinfo = (NODEPDA(nasid_to_cnodeid(nasid)))->pdinfo;
258 258
259 if (!hubinfo) { 259 BUG_ON(!hubinfo);
260 BUG();
261 }
262 260
263 flush_nasid_list = &hubinfo->hdi_flush_nasid_list; 261 flush_nasid_list = &hubinfo->hdi_flush_nasid_list;
264 if (flush_nasid_list->widget_p == NULL) 262 if (flush_nasid_list->widget_p == NULL)
diff --git a/arch/ia64/xen/Makefile b/arch/ia64/xen/Makefile
index 0ad0224693d9..e6f4a0a74228 100644
--- a/arch/ia64/xen/Makefile
+++ b/arch/ia64/xen/Makefile
@@ -3,14 +3,29 @@
3# 3#
4 4
5obj-y := hypercall.o xenivt.o xensetup.o xen_pv_ops.o irq_xen.o \ 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 6 hypervisor.o xencomm.o xcom_hcall.o grant-table.o time.o suspend.o \
7 gate-data.o
7 8
8obj-$(CONFIG_IA64_GENERIC) += machvec.o 9obj-$(CONFIG_IA64_GENERIC) += machvec.o
9 10
11# The gate DSO image is built using a special linker script.
12include $(srctree)/arch/ia64/kernel/Makefile.gate
13
14# tell compiled for xen
15CPPFLAGS_gate.lds += -D__IA64_GATE_PARAVIRTUALIZED_XEN
16AFLAGS_gate.o += -D__IA64_ASM_PARAVIRTUALIZED_XEN -D__IA64_GATE_PARAVIRTUALIZED_XEN
17
18# use same file of native.
19$(obj)/gate.o: $(src)/../kernel/gate.S FORCE
20 $(call if_changed_dep,as_o_S)
21$(obj)/gate.lds: $(src)/../kernel/gate.lds.S FORCE
22 $(call if_changed_dep,cpp_lds_S)
23
24
10AFLAGS_xenivt.o += -D__IA64_ASM_PARAVIRTUALIZED_XEN 25AFLAGS_xenivt.o += -D__IA64_ASM_PARAVIRTUALIZED_XEN
11 26
12# xen multi compile 27# xen multi compile
13ASM_PARAVIRT_MULTI_COMPILE_SRCS = ivt.S entry.S 28ASM_PARAVIRT_MULTI_COMPILE_SRCS = ivt.S entry.S fsys.S
14ASM_PARAVIRT_OBJS = $(addprefix xen-,$(ASM_PARAVIRT_MULTI_COMPILE_SRCS:.S=.o)) 29ASM_PARAVIRT_OBJS = $(addprefix xen-,$(ASM_PARAVIRT_MULTI_COMPILE_SRCS:.S=.o))
15obj-y += $(ASM_PARAVIRT_OBJS) 30obj-y += $(ASM_PARAVIRT_OBJS)
16define paravirtualized_xen 31define paravirtualized_xen
diff --git a/arch/ia64/xen/gate-data.S b/arch/ia64/xen/gate-data.S
new file mode 100644
index 000000000000..7d4830afc91d
--- /dev/null
+++ b/arch/ia64/xen/gate-data.S
@@ -0,0 +1,3 @@
1 .section .data.gate.xen, "aw"
2
3 .incbin "arch/ia64/xen/gate.so"
diff --git a/arch/ia64/xen/hypercall.S b/arch/ia64/xen/hypercall.S
index 45e02bb64a92..e32dae444dd6 100644
--- a/arch/ia64/xen/hypercall.S
+++ b/arch/ia64/xen/hypercall.S
@@ -9,6 +9,7 @@
9#include <asm/intrinsics.h> 9#include <asm/intrinsics.h>
10#include <asm/xen/privop.h> 10#include <asm/xen/privop.h>
11 11
12#ifdef __INTEL_COMPILER
12/* 13/*
13 * Hypercalls without parameter. 14 * Hypercalls without parameter.
14 */ 15 */
@@ -72,6 +73,7 @@ GLOBAL_ENTRY(xen_set_rr0_to_rr4)
72 br.ret.sptk.many rp 73 br.ret.sptk.many rp
73 ;; 74 ;;
74END(xen_set_rr0_to_rr4) 75END(xen_set_rr0_to_rr4)
76#endif
75 77
76GLOBAL_ENTRY(xen_send_ipi) 78GLOBAL_ENTRY(xen_send_ipi)
77 mov r14=r32 79 mov r14=r32
diff --git a/arch/ia64/xen/time.c b/arch/ia64/xen/time.c
index 68d6204c3f16..fb8332690179 100644
--- a/arch/ia64/xen/time.c
+++ b/arch/ia64/xen/time.c
@@ -175,10 +175,58 @@ static void xen_itc_jitter_data_reset(void)
175 } while (unlikely(ret != lcycle)); 175 } while (unlikely(ret != lcycle));
176} 176}
177 177
178/* based on xen_sched_clock() in arch/x86/xen/time.c. */
179/*
180 * This relies on HAVE_UNSTABLE_SCHED_CLOCK. If it can't be defined,
181 * something similar logic should be implemented here.
182 */
183/*
184 * Xen sched_clock implementation. Returns the number of unstolen
185 * nanoseconds, which is nanoseconds the VCPU spent in RUNNING+BLOCKED
186 * states.
187 */
188static unsigned long long xen_sched_clock(void)
189{
190 struct vcpu_runstate_info runstate;
191
192 unsigned long long now;
193 unsigned long long offset;
194 unsigned long long ret;
195
196 /*
197 * Ideally sched_clock should be called on a per-cpu basis
198 * anyway, so preempt should already be disabled, but that's
199 * not current practice at the moment.
200 */
201 preempt_disable();
202
203 /*
204 * both ia64_native_sched_clock() and xen's runstate are
205 * based on mAR.ITC. So difference of them makes sense.
206 */
207 now = ia64_native_sched_clock();
208
209 get_runstate_snapshot(&runstate);
210
211 WARN_ON(runstate.state != RUNSTATE_running);
212
213 offset = 0;
214 if (now > runstate.state_entry_time)
215 offset = now - runstate.state_entry_time;
216 ret = runstate.time[RUNSTATE_blocked] +
217 runstate.time[RUNSTATE_running] +
218 offset;
219
220 preempt_enable();
221
222 return ret;
223}
224
178struct pv_time_ops xen_time_ops __initdata = { 225struct pv_time_ops xen_time_ops __initdata = {
179 .init_missing_ticks_accounting = xen_init_missing_ticks_accounting, 226 .init_missing_ticks_accounting = xen_init_missing_ticks_accounting,
180 .do_steal_accounting = xen_do_steal_accounting, 227 .do_steal_accounting = xen_do_steal_accounting,
181 .clocksource_resume = xen_itc_jitter_data_reset, 228 .clocksource_resume = xen_itc_jitter_data_reset,
229 .sched_clock = xen_sched_clock,
182}; 230};
183 231
184/* Called after suspend, to resume time. */ 232/* Called after suspend, to resume time. */
diff --git a/arch/ia64/xen/xen_pv_ops.c b/arch/ia64/xen/xen_pv_ops.c
index 936cff3c96e0..5e2270a999fa 100644
--- a/arch/ia64/xen/xen_pv_ops.c
+++ b/arch/ia64/xen/xen_pv_ops.c
@@ -24,6 +24,7 @@
24#include <linux/irq.h> 24#include <linux/irq.h>
25#include <linux/kernel.h> 25#include <linux/kernel.h>
26#include <linux/pm.h> 26#include <linux/pm.h>
27#include <linux/unistd.h>
27 28
28#include <asm/xen/hypervisor.h> 29#include <asm/xen/hypervisor.h>
29#include <asm/xen/xencomm.h> 30#include <asm/xen/xencomm.h>
@@ -153,6 +154,13 @@ xen_post_smp_prepare_boot_cpu(void)
153 xen_setup_vcpu_info_placement(); 154 xen_setup_vcpu_info_placement();
154} 155}
155 156
157#ifdef ASM_SUPPORTED
158static unsigned long __init_or_module
159xen_patch_bundle(void *sbundle, void *ebundle, unsigned long type);
160#endif
161static void __init
162xen_patch_branch(unsigned long tag, unsigned long type);
163
156static const struct pv_init_ops xen_init_ops __initconst = { 164static const struct pv_init_ops xen_init_ops __initconst = {
157 .banner = xen_banner, 165 .banner = xen_banner,
158 166
@@ -163,6 +171,53 @@ static const struct pv_init_ops xen_init_ops __initconst = {
163 .arch_setup_nomca = xen_arch_setup_nomca, 171 .arch_setup_nomca = xen_arch_setup_nomca,
164 172
165 .post_smp_prepare_boot_cpu = xen_post_smp_prepare_boot_cpu, 173 .post_smp_prepare_boot_cpu = xen_post_smp_prepare_boot_cpu,
174#ifdef ASM_SUPPORTED
175 .patch_bundle = xen_patch_bundle,
176#endif
177 .patch_branch = xen_patch_branch,
178};
179
180/***************************************************************************
181 * pv_fsys_data
182 * addresses for fsys
183 */
184
185extern unsigned long xen_fsyscall_table[NR_syscalls];
186extern char xen_fsys_bubble_down[];
187struct pv_fsys_data xen_fsys_data __initdata = {
188 .fsyscall_table = (unsigned long *)xen_fsyscall_table,
189 .fsys_bubble_down = (void *)xen_fsys_bubble_down,
190};
191
192/***************************************************************************
193 * pv_patchdata
194 * patchdata addresses
195 */
196
197#define DECLARE(name) \
198 extern unsigned long __xen_start_gate_##name##_patchlist[]; \
199 extern unsigned long __xen_end_gate_##name##_patchlist[]
200
201DECLARE(fsyscall);
202DECLARE(brl_fsys_bubble_down);
203DECLARE(vtop);
204DECLARE(mckinley_e9);
205
206extern unsigned long __xen_start_gate_section[];
207
208#define ASSIGN(name) \
209 .start_##name##_patchlist = \
210 (unsigned long)__xen_start_gate_##name##_patchlist, \
211 .end_##name##_patchlist = \
212 (unsigned long)__xen_end_gate_##name##_patchlist
213
214static struct pv_patchdata xen_patchdata __initdata = {
215 ASSIGN(fsyscall),
216 ASSIGN(brl_fsys_bubble_down),
217 ASSIGN(vtop),
218 ASSIGN(mckinley_e9),
219
220 .gate_section = (void*)__xen_start_gate_section,
166}; 221};
167 222
168/*************************************************************************** 223/***************************************************************************
@@ -170,6 +225,76 @@ static const struct pv_init_ops xen_init_ops __initconst = {
170 * intrinsics hooks. 225 * intrinsics hooks.
171 */ 226 */
172 227
228#ifndef ASM_SUPPORTED
229static void
230xen_set_itm_with_offset(unsigned long val)
231{
232 /* ia64_cpu_local_tick() calls this with interrupt enabled. */
233 /* WARN_ON(!irqs_disabled()); */
234 xen_set_itm(val - XEN_MAPPEDREGS->itc_offset);
235}
236
237static unsigned long
238xen_get_itm_with_offset(void)
239{
240 /* unused at this moment */
241 printk(KERN_DEBUG "%s is called.\n", __func__);
242
243 WARN_ON(!irqs_disabled());
244 return ia64_native_getreg(_IA64_REG_CR_ITM) +
245 XEN_MAPPEDREGS->itc_offset;
246}
247
248/* ia64_set_itc() is only called by
249 * cpu_init() with ia64_set_itc(0) and ia64_sync_itc().
250 * So XEN_MAPPEDRESG->itc_offset cal be considered as almost constant.
251 */
252static void
253xen_set_itc(unsigned long val)
254{
255 unsigned long mitc;
256
257 WARN_ON(!irqs_disabled());
258 mitc = ia64_native_getreg(_IA64_REG_AR_ITC);
259 XEN_MAPPEDREGS->itc_offset = val - mitc;
260 XEN_MAPPEDREGS->itc_last = val;
261}
262
263static unsigned long
264xen_get_itc(void)
265{
266 unsigned long res;
267 unsigned long itc_offset;
268 unsigned long itc_last;
269 unsigned long ret_itc_last;
270
271 itc_offset = XEN_MAPPEDREGS->itc_offset;
272 do {
273 itc_last = XEN_MAPPEDREGS->itc_last;
274 res = ia64_native_getreg(_IA64_REG_AR_ITC);
275 res += itc_offset;
276 if (itc_last >= res)
277 res = itc_last + 1;
278 ret_itc_last = cmpxchg(&XEN_MAPPEDREGS->itc_last,
279 itc_last, res);
280 } while (unlikely(ret_itc_last != itc_last));
281 return res;
282
283#if 0
284 /* ia64_itc_udelay() calls ia64_get_itc() with interrupt enabled.
285 Should it be paravirtualized instead? */
286 WARN_ON(!irqs_disabled());
287 itc_offset = XEN_MAPPEDREGS->itc_offset;
288 itc_last = XEN_MAPPEDREGS->itc_last;
289 res = ia64_native_getreg(_IA64_REG_AR_ITC);
290 res += itc_offset;
291 if (itc_last >= res)
292 res = itc_last + 1;
293 XEN_MAPPEDREGS->itc_last = res;
294 return res;
295#endif
296}
297
173static void xen_setreg(int regnum, unsigned long val) 298static void xen_setreg(int regnum, unsigned long val)
174{ 299{
175 switch (regnum) { 300 switch (regnum) {
@@ -181,11 +306,14 @@ static void xen_setreg(int regnum, unsigned long val)
181 xen_set_eflag(val); 306 xen_set_eflag(val);
182 break; 307 break;
183#endif 308#endif
309 case _IA64_REG_AR_ITC:
310 xen_set_itc(val);
311 break;
184 case _IA64_REG_CR_TPR: 312 case _IA64_REG_CR_TPR:
185 xen_set_tpr(val); 313 xen_set_tpr(val);
186 break; 314 break;
187 case _IA64_REG_CR_ITM: 315 case _IA64_REG_CR_ITM:
188 xen_set_itm(val); 316 xen_set_itm_with_offset(val);
189 break; 317 break;
190 case _IA64_REG_CR_EOI: 318 case _IA64_REG_CR_EOI:
191 xen_eoi(val); 319 xen_eoi(val);
@@ -209,6 +337,12 @@ static unsigned long xen_getreg(int regnum)
209 res = xen_get_eflag(); 337 res = xen_get_eflag();
210 break; 338 break;
211#endif 339#endif
340 case _IA64_REG_AR_ITC:
341 res = xen_get_itc();
342 break;
343 case _IA64_REG_CR_ITM:
344 res = xen_get_itm_with_offset();
345 break;
212 case _IA64_REG_CR_IVR: 346 case _IA64_REG_CR_IVR:
213 res = xen_get_ivr(); 347 res = xen_get_ivr();
214 break; 348 break;
@@ -259,8 +393,417 @@ xen_intrin_local_irq_restore(unsigned long mask)
259 else 393 else
260 xen_rsm_i(); 394 xen_rsm_i();
261} 395}
396#else
397#define __DEFINE_FUNC(name, code) \
398 extern const char xen_ ## name ## _direct_start[]; \
399 extern const char xen_ ## name ## _direct_end[]; \
400 asm (".align 32\n" \
401 ".proc xen_" #name "\n" \
402 "xen_" #name ":\n" \
403 "xen_" #name "_direct_start:\n" \
404 code \
405 "xen_" #name "_direct_end:\n" \
406 "br.cond.sptk.many b6\n" \
407 ".endp xen_" #name "\n")
408
409#define DEFINE_VOID_FUNC0(name, code) \
410 extern void \
411 xen_ ## name (void); \
412 __DEFINE_FUNC(name, code)
413
414#define DEFINE_VOID_FUNC1(name, code) \
415 extern void \
416 xen_ ## name (unsigned long arg); \
417 __DEFINE_FUNC(name, code)
418
419#define DEFINE_VOID_FUNC1_VOID(name, code) \
420 extern void \
421 xen_ ## name (void *arg); \
422 __DEFINE_FUNC(name, code)
423
424#define DEFINE_VOID_FUNC2(name, code) \
425 extern void \
426 xen_ ## name (unsigned long arg0, \
427 unsigned long arg1); \
428 __DEFINE_FUNC(name, code)
262 429
263static const struct pv_cpu_ops xen_cpu_ops __initdata = { 430#define DEFINE_FUNC0(name, code) \
431 extern unsigned long \
432 xen_ ## name (void); \
433 __DEFINE_FUNC(name, code)
434
435#define DEFINE_FUNC1(name, type, code) \
436 extern unsigned long \
437 xen_ ## name (type arg); \
438 __DEFINE_FUNC(name, code)
439
440#define XEN_PSR_I_ADDR_ADDR (XSI_BASE + XSI_PSR_I_ADDR_OFS)
441
442/*
443 * static void xen_set_itm_with_offset(unsigned long val)
444 * xen_set_itm(val - XEN_MAPPEDREGS->itc_offset);
445 */
446/* 2 bundles */
447DEFINE_VOID_FUNC1(set_itm_with_offset,
448 "mov r2 = " __stringify(XSI_BASE) " + "
449 __stringify(XSI_ITC_OFFSET_OFS) "\n"
450 ";;\n"
451 "ld8 r3 = [r2]\n"
452 ";;\n"
453 "sub r8 = r8, r3\n"
454 "break " __stringify(HYPERPRIVOP_SET_ITM) "\n");
455
456/*
457 * static unsigned long xen_get_itm_with_offset(void)
458 * return ia64_native_getreg(_IA64_REG_CR_ITM) + XEN_MAPPEDREGS->itc_offset;
459 */
460/* 2 bundles */
461DEFINE_FUNC0(get_itm_with_offset,
462 "mov r2 = " __stringify(XSI_BASE) " + "
463 __stringify(XSI_ITC_OFFSET_OFS) "\n"
464 ";;\n"
465 "ld8 r3 = [r2]\n"
466 "mov r8 = cr.itm\n"
467 ";;\n"
468 "add r8 = r8, r2\n");
469
470/*
471 * static void xen_set_itc(unsigned long val)
472 * unsigned long mitc;
473 *
474 * WARN_ON(!irqs_disabled());
475 * mitc = ia64_native_getreg(_IA64_REG_AR_ITC);
476 * XEN_MAPPEDREGS->itc_offset = val - mitc;
477 * XEN_MAPPEDREGS->itc_last = val;
478 */
479/* 2 bundles */
480DEFINE_VOID_FUNC1(set_itc,
481 "mov r2 = " __stringify(XSI_BASE) " + "
482 __stringify(XSI_ITC_LAST_OFS) "\n"
483 "mov r3 = ar.itc\n"
484 ";;\n"
485 "sub r3 = r8, r3\n"
486 "st8 [r2] = r8, "
487 __stringify(XSI_ITC_LAST_OFS) " - "
488 __stringify(XSI_ITC_OFFSET_OFS) "\n"
489 ";;\n"
490 "st8 [r2] = r3\n");
491
492/*
493 * static unsigned long xen_get_itc(void)
494 * unsigned long res;
495 * unsigned long itc_offset;
496 * unsigned long itc_last;
497 * unsigned long ret_itc_last;
498 *
499 * itc_offset = XEN_MAPPEDREGS->itc_offset;
500 * do {
501 * itc_last = XEN_MAPPEDREGS->itc_last;
502 * res = ia64_native_getreg(_IA64_REG_AR_ITC);
503 * res += itc_offset;
504 * if (itc_last >= res)
505 * res = itc_last + 1;
506 * ret_itc_last = cmpxchg(&XEN_MAPPEDREGS->itc_last,
507 * itc_last, res);
508 * } while (unlikely(ret_itc_last != itc_last));
509 * return res;
510 */
511/* 5 bundles */
512DEFINE_FUNC0(get_itc,
513 "mov r2 = " __stringify(XSI_BASE) " + "
514 __stringify(XSI_ITC_OFFSET_OFS) "\n"
515 ";;\n"
516 "ld8 r9 = [r2], " __stringify(XSI_ITC_LAST_OFS) " - "
517 __stringify(XSI_ITC_OFFSET_OFS) "\n"
518 /* r9 = itc_offset */
519 /* r2 = XSI_ITC_OFFSET */
520 "888:\n"
521 "mov r8 = ar.itc\n" /* res = ar.itc */
522 ";;\n"
523 "ld8 r3 = [r2]\n" /* r3 = itc_last */
524 "add r8 = r8, r9\n" /* res = ar.itc + itc_offset */
525 ";;\n"
526 "cmp.gtu p6, p0 = r3, r8\n"
527 ";;\n"
528 "(p6) add r8 = 1, r3\n" /* if (itc_last > res) itc_last + 1 */
529 ";;\n"
530 "mov ar.ccv = r8\n"
531 ";;\n"
532 "cmpxchg8.acq r10 = [r2], r8, ar.ccv\n"
533 ";;\n"
534 "cmp.ne p6, p0 = r10, r3\n"
535 "(p6) hint @pause\n"
536 "(p6) br.cond.spnt 888b\n");
537
538DEFINE_VOID_FUNC1_VOID(fc,
539 "break " __stringify(HYPERPRIVOP_FC) "\n");
540
541/*
542 * psr_i_addr_addr = XEN_PSR_I_ADDR_ADDR
543 * masked_addr = *psr_i_addr_addr
544 * pending_intr_addr = masked_addr - 1
545 * if (val & IA64_PSR_I) {
546 * masked = *masked_addr
547 * *masked_addr = 0:xen_set_virtual_psr_i(1)
548 * compiler barrier
549 * if (masked) {
550 * uint8_t pending = *pending_intr_addr;
551 * if (pending)
552 * XEN_HYPER_SSM_I
553 * }
554 * } else {
555 * *masked_addr = 1:xen_set_virtual_psr_i(0)
556 * }
557 */
558/* 6 bundles */
559DEFINE_VOID_FUNC1(intrin_local_irq_restore,
560 /* r8 = input value: 0 or IA64_PSR_I
561 * p6 = (flags & IA64_PSR_I)
562 * = if clause
563 * p7 = !(flags & IA64_PSR_I)
564 * = else clause
565 */
566 "cmp.ne p6, p7 = r8, r0\n"
567 "mov r9 = " __stringify(XEN_PSR_I_ADDR_ADDR) "\n"
568 ";;\n"
569 /* r9 = XEN_PSR_I_ADDR */
570 "ld8 r9 = [r9]\n"
571 ";;\n"
572
573 /* r10 = masked previous value */
574 "(p6) ld1.acq r10 = [r9]\n"
575 ";;\n"
576
577 /* p8 = !masked interrupt masked previously? */
578 "(p6) cmp.ne.unc p8, p0 = r10, r0\n"
579
580 /* p7 = else clause */
581 "(p7) mov r11 = 1\n"
582 ";;\n"
583 /* masked = 1 */
584 "(p7) st1.rel [r9] = r11\n"
585
586 /* p6 = if clause */
587 /* masked = 0
588 * r9 = masked_addr - 1
589 * = pending_intr_addr
590 */
591 "(p8) st1.rel [r9] = r0, -1\n"
592 ";;\n"
593 /* r8 = pending_intr */
594 "(p8) ld1.acq r11 = [r9]\n"
595 ";;\n"
596 /* p9 = interrupt pending? */
597 "(p8) cmp.ne.unc p9, p10 = r11, r0\n"
598 ";;\n"
599 "(p10) mf\n"
600 /* issue hypercall to trigger interrupt */
601 "(p9) break " __stringify(HYPERPRIVOP_SSM_I) "\n");
602
603DEFINE_VOID_FUNC2(ptcga,
604 "break " __stringify(HYPERPRIVOP_PTC_GA) "\n");
605DEFINE_VOID_FUNC2(set_rr,
606 "break " __stringify(HYPERPRIVOP_SET_RR) "\n");
607
608/*
609 * tmp = XEN_MAPPEDREGS->interrupt_mask_addr = XEN_PSR_I_ADDR_ADDR;
610 * tmp = *tmp
611 * tmp = *tmp;
612 * psr_i = tmp? 0: IA64_PSR_I;
613 */
614/* 4 bundles */
615DEFINE_FUNC0(get_psr_i,
616 "mov r9 = " __stringify(XEN_PSR_I_ADDR_ADDR) "\n"
617 ";;\n"
618 "ld8 r9 = [r9]\n" /* r9 = XEN_PSR_I_ADDR */
619 "mov r8 = 0\n" /* psr_i = 0 */
620 ";;\n"
621 "ld1.acq r9 = [r9]\n" /* r9 = XEN_PSR_I */
622 ";;\n"
623 "cmp.eq.unc p6, p0 = r9, r0\n" /* p6 = (XEN_PSR_I != 0) */
624 ";;\n"
625 "(p6) mov r8 = " __stringify(1 << IA64_PSR_I_BIT) "\n");
626
627DEFINE_FUNC1(thash, unsigned long,
628 "break " __stringify(HYPERPRIVOP_THASH) "\n");
629DEFINE_FUNC1(get_cpuid, int,
630 "break " __stringify(HYPERPRIVOP_GET_CPUID) "\n");
631DEFINE_FUNC1(get_pmd, int,
632 "break " __stringify(HYPERPRIVOP_GET_PMD) "\n");
633DEFINE_FUNC1(get_rr, unsigned long,
634 "break " __stringify(HYPERPRIVOP_GET_RR) "\n");
635
636/*
637 * void xen_privop_ssm_i(void)
638 *
639 * int masked = !xen_get_virtual_psr_i();
640 * // masked = *(*XEN_MAPPEDREGS->interrupt_mask_addr)
641 * xen_set_virtual_psr_i(1)
642 * // *(*XEN_MAPPEDREGS->interrupt_mask_addr) = 0
643 * // compiler barrier
644 * if (masked) {
645 * uint8_t* pend_int_addr =
646 * (uint8_t*)(*XEN_MAPPEDREGS->interrupt_mask_addr) - 1;
647 * uint8_t pending = *pend_int_addr;
648 * if (pending)
649 * XEN_HYPER_SSM_I
650 * }
651 */
652/* 4 bundles */
653DEFINE_VOID_FUNC0(ssm_i,
654 "mov r8 = " __stringify(XEN_PSR_I_ADDR_ADDR) "\n"
655 ";;\n"
656 "ld8 r8 = [r8]\n" /* r8 = XEN_PSR_I_ADDR */
657 ";;\n"
658 "ld1.acq r9 = [r8]\n" /* r9 = XEN_PSR_I */
659 ";;\n"
660 "st1.rel [r8] = r0, -1\n" /* psr_i = 0. enable interrupt
661 * r8 = XEN_PSR_I_ADDR - 1
662 * = pend_int_addr
663 */
664 "cmp.eq.unc p0, p6 = r9, r0\n"/* p6 = !XEN_PSR_I
665 * previously interrupt
666 * masked?
667 */
668 ";;\n"
669 "(p6) ld1.acq r8 = [r8]\n" /* r8 = xen_pend_int */
670 ";;\n"
671 "(p6) cmp.eq.unc p6, p7 = r8, r0\n" /*interrupt pending?*/
672 ";;\n"
673 /* issue hypercall to get interrupt */
674 "(p7) break " __stringify(HYPERPRIVOP_SSM_I) "\n"
675 ";;\n");
676
677/*
678 * psr_i_addr_addr = XEN_MAPPEDREGS->interrupt_mask_addr
679 * = XEN_PSR_I_ADDR_ADDR;
680 * psr_i_addr = *psr_i_addr_addr;
681 * *psr_i_addr = 1;
682 */
683/* 2 bundles */
684DEFINE_VOID_FUNC0(rsm_i,
685 "mov r8 = " __stringify(XEN_PSR_I_ADDR_ADDR) "\n"
686 /* r8 = XEN_PSR_I_ADDR */
687 "mov r9 = 1\n"
688 ";;\n"
689 "ld8 r8 = [r8]\n" /* r8 = XEN_PSR_I */
690 ";;\n"
691 "st1.rel [r8] = r9\n"); /* XEN_PSR_I = 1 */
692
693extern void
694xen_set_rr0_to_rr4(unsigned long val0, unsigned long val1,
695 unsigned long val2, unsigned long val3,
696 unsigned long val4);
697__DEFINE_FUNC(set_rr0_to_rr4,
698 "break " __stringify(HYPERPRIVOP_SET_RR0_TO_RR4) "\n");
699
700
701extern unsigned long xen_getreg(int regnum);
702#define __DEFINE_GET_REG(id, privop) \
703 "mov r2 = " __stringify(_IA64_REG_ ## id) "\n" \
704 ";;\n" \
705 "cmp.eq p6, p0 = r2, r8\n" \
706 ";;\n" \
707 "(p6) break " __stringify(HYPERPRIVOP_GET_ ## privop) "\n" \
708 "(p6) br.cond.sptk.many b6\n" \
709 ";;\n"
710
711__DEFINE_FUNC(getreg,
712 __DEFINE_GET_REG(PSR, PSR)
713#ifdef CONFIG_IA32_SUPPORT
714 __DEFINE_GET_REG(AR_EFLAG, EFLAG)
715#endif
716
717 /* get_itc */
718 "mov r2 = " __stringify(_IA64_REG_AR_ITC) "\n"
719 ";;\n"
720 "cmp.eq p6, p0 = r2, r8\n"
721 ";;\n"
722 "(p6) br.cond.spnt xen_get_itc\n"
723 ";;\n"
724
725 /* get itm */
726 "mov r2 = " __stringify(_IA64_REG_CR_ITM) "\n"
727 ";;\n"
728 "cmp.eq p6, p0 = r2, r8\n"
729 ";;\n"
730 "(p6) br.cond.spnt xen_get_itm_with_offset\n"
731 ";;\n"
732
733 __DEFINE_GET_REG(CR_IVR, IVR)
734 __DEFINE_GET_REG(CR_TPR, TPR)
735
736 /* fall back */
737 "movl r2 = ia64_native_getreg_func\n"
738 ";;\n"
739 "mov b7 = r2\n"
740 ";;\n"
741 "br.cond.sptk.many b7\n");
742
743extern void xen_setreg(int regnum, unsigned long val);
744#define __DEFINE_SET_REG(id, privop) \
745 "mov r2 = " __stringify(_IA64_REG_ ## id) "\n" \
746 ";;\n" \
747 "cmp.eq p6, p0 = r2, r9\n" \
748 ";;\n" \
749 "(p6) break " __stringify(HYPERPRIVOP_ ## privop) "\n" \
750 "(p6) br.cond.sptk.many b6\n" \
751 ";;\n"
752
753__DEFINE_FUNC(setreg,
754 /* kr0 .. kr 7*/
755 /*
756 * if (_IA64_REG_AR_KR0 <= regnum &&
757 * regnum <= _IA64_REG_AR_KR7) {
758 * register __index asm ("r8") = regnum - _IA64_REG_AR_KR0
759 * register __val asm ("r9") = val
760 * "break HYPERPRIVOP_SET_KR"
761 * }
762 */
763 "mov r17 = r9\n"
764 "mov r2 = " __stringify(_IA64_REG_AR_KR0) "\n"
765 ";;\n"
766 "cmp.ge p6, p0 = r9, r2\n"
767 "sub r17 = r17, r2\n"
768 ";;\n"
769 "(p6) cmp.ge.unc p7, p0 = "
770 __stringify(_IA64_REG_AR_KR7) " - " __stringify(_IA64_REG_AR_KR0)
771 ", r17\n"
772 ";;\n"
773 "(p7) mov r9 = r8\n"
774 ";;\n"
775 "(p7) mov r8 = r17\n"
776 "(p7) break " __stringify(HYPERPRIVOP_SET_KR) "\n"
777
778 /* set itm */
779 "mov r2 = " __stringify(_IA64_REG_CR_ITM) "\n"
780 ";;\n"
781 "cmp.eq p6, p0 = r2, r8\n"
782 ";;\n"
783 "(p6) br.cond.spnt xen_set_itm_with_offset\n"
784
785 /* set itc */
786 "mov r2 = " __stringify(_IA64_REG_AR_ITC) "\n"
787 ";;\n"
788 "cmp.eq p6, p0 = r2, r8\n"
789 ";;\n"
790 "(p6) br.cond.spnt xen_set_itc\n"
791
792#ifdef CONFIG_IA32_SUPPORT
793 __DEFINE_SET_REG(AR_EFLAG, SET_EFLAG)
794#endif
795 __DEFINE_SET_REG(CR_TPR, SET_TPR)
796 __DEFINE_SET_REG(CR_EOI, EOI)
797
798 /* fall back */
799 "movl r2 = ia64_native_setreg_func\n"
800 ";;\n"
801 "mov b7 = r2\n"
802 ";;\n"
803 "br.cond.sptk.many b7\n");
804#endif
805
806static const struct pv_cpu_ops xen_cpu_ops __initconst = {
264 .fc = xen_fc, 807 .fc = xen_fc,
265 .thash = xen_thash, 808 .thash = xen_thash,
266 .get_cpuid = xen_get_cpuid, 809 .get_cpuid = xen_get_cpuid,
@@ -337,7 +880,7 @@ xen_iosapic_write(char __iomem *iosapic, unsigned int reg, u32 val)
337 HYPERVISOR_physdev_op(PHYSDEVOP_apic_write, &apic_op); 880 HYPERVISOR_physdev_op(PHYSDEVOP_apic_write, &apic_op);
338} 881}
339 882
340static const struct pv_iosapic_ops xen_iosapic_ops __initconst = { 883static struct pv_iosapic_ops xen_iosapic_ops __initdata = {
341 .pcat_compat_init = xen_pcat_compat_init, 884 .pcat_compat_init = xen_pcat_compat_init,
342 .__get_irq_chip = xen_iosapic_get_irq_chip, 885 .__get_irq_chip = xen_iosapic_get_irq_chip,
343 886
@@ -355,6 +898,8 @@ xen_setup_pv_ops(void)
355 xen_info_init(); 898 xen_info_init();
356 pv_info = xen_info; 899 pv_info = xen_info;
357 pv_init_ops = xen_init_ops; 900 pv_init_ops = xen_init_ops;
901 pv_fsys_data = xen_fsys_data;
902 pv_patchdata = xen_patchdata;
358 pv_cpu_ops = xen_cpu_ops; 903 pv_cpu_ops = xen_cpu_ops;
359 pv_iosapic_ops = xen_iosapic_ops; 904 pv_iosapic_ops = xen_iosapic_ops;
360 pv_irq_ops = xen_irq_ops; 905 pv_irq_ops = xen_irq_ops;
@@ -362,3 +907,252 @@ xen_setup_pv_ops(void)
362 907
363 paravirt_cpu_asm_init(&xen_cpu_asm_switch); 908 paravirt_cpu_asm_init(&xen_cpu_asm_switch);
364} 909}
910
911#ifdef ASM_SUPPORTED
912/***************************************************************************
913 * binary pacthing
914 * pv_init_ops.patch_bundle
915 */
916
917#define DEFINE_FUNC_GETREG(name, privop) \
918 DEFINE_FUNC0(get_ ## name, \
919 "break "__stringify(HYPERPRIVOP_GET_ ## privop) "\n")
920
921DEFINE_FUNC_GETREG(psr, PSR);
922DEFINE_FUNC_GETREG(eflag, EFLAG);
923DEFINE_FUNC_GETREG(ivr, IVR);
924DEFINE_FUNC_GETREG(tpr, TPR);
925
926#define DEFINE_FUNC_SET_KR(n) \
927 DEFINE_VOID_FUNC0(set_kr ## n, \
928 ";;\n" \
929 "mov r9 = r8\n" \
930 "mov r8 = " #n "\n" \
931 "break " __stringify(HYPERPRIVOP_SET_KR) "\n")
932
933DEFINE_FUNC_SET_KR(0);
934DEFINE_FUNC_SET_KR(1);
935DEFINE_FUNC_SET_KR(2);
936DEFINE_FUNC_SET_KR(3);
937DEFINE_FUNC_SET_KR(4);
938DEFINE_FUNC_SET_KR(5);
939DEFINE_FUNC_SET_KR(6);
940DEFINE_FUNC_SET_KR(7);
941
942#define __DEFINE_FUNC_SETREG(name, privop) \
943 DEFINE_VOID_FUNC0(name, \
944 "break "__stringify(HYPERPRIVOP_ ## privop) "\n")
945
946#define DEFINE_FUNC_SETREG(name, privop) \
947 __DEFINE_FUNC_SETREG(set_ ## name, SET_ ## privop)
948
949DEFINE_FUNC_SETREG(eflag, EFLAG);
950DEFINE_FUNC_SETREG(tpr, TPR);
951__DEFINE_FUNC_SETREG(eoi, EOI);
952
953extern const char xen_check_events[];
954extern const char __xen_intrin_local_irq_restore_direct_start[];
955extern const char __xen_intrin_local_irq_restore_direct_end[];
956extern const unsigned long __xen_intrin_local_irq_restore_direct_reloc;
957
958asm (
959 ".align 32\n"
960 ".proc xen_check_events\n"
961 "xen_check_events:\n"
962 /* masked = 0
963 * r9 = masked_addr - 1
964 * = pending_intr_addr
965 */
966 "st1.rel [r9] = r0, -1\n"
967 ";;\n"
968 /* r8 = pending_intr */
969 "ld1.acq r11 = [r9]\n"
970 ";;\n"
971 /* p9 = interrupt pending? */
972 "cmp.ne p9, p10 = r11, r0\n"
973 ";;\n"
974 "(p10) mf\n"
975 /* issue hypercall to trigger interrupt */
976 "(p9) break " __stringify(HYPERPRIVOP_SSM_I) "\n"
977 "br.cond.sptk.many b6\n"
978 ".endp xen_check_events\n"
979 "\n"
980 ".align 32\n"
981 ".proc __xen_intrin_local_irq_restore_direct\n"
982 "__xen_intrin_local_irq_restore_direct:\n"
983 "__xen_intrin_local_irq_restore_direct_start:\n"
984 "1:\n"
985 "{\n"
986 "cmp.ne p6, p7 = r8, r0\n"
987 "mov r17 = ip\n" /* get ip to calc return address */
988 "mov r9 = "__stringify(XEN_PSR_I_ADDR_ADDR) "\n"
989 ";;\n"
990 "}\n"
991 "{\n"
992 /* r9 = XEN_PSR_I_ADDR */
993 "ld8 r9 = [r9]\n"
994 ";;\n"
995 /* r10 = masked previous value */
996 "(p6) ld1.acq r10 = [r9]\n"
997 "adds r17 = 1f - 1b, r17\n" /* calculate return address */
998 ";;\n"
999 "}\n"
1000 "{\n"
1001 /* p8 = !masked interrupt masked previously? */
1002 "(p6) cmp.ne.unc p8, p0 = r10, r0\n"
1003 "\n"
1004 /* p7 = else clause */
1005 "(p7) mov r11 = 1\n"
1006 ";;\n"
1007 "(p8) mov b6 = r17\n" /* set return address */
1008 "}\n"
1009 "{\n"
1010 /* masked = 1 */
1011 "(p7) st1.rel [r9] = r11\n"
1012 "\n"
1013 "[99:]\n"
1014 "(p8) brl.cond.dptk.few xen_check_events\n"
1015 "}\n"
1016 /* pv calling stub is 5 bundles. fill nop to adjust return address */
1017 "{\n"
1018 "nop 0\n"
1019 "nop 0\n"
1020 "nop 0\n"
1021 "}\n"
1022 "1:\n"
1023 "__xen_intrin_local_irq_restore_direct_end:\n"
1024 ".endp __xen_intrin_local_irq_restore_direct\n"
1025 "\n"
1026 ".align 8\n"
1027 "__xen_intrin_local_irq_restore_direct_reloc:\n"
1028 "data8 99b\n"
1029);
1030
1031static struct paravirt_patch_bundle_elem xen_patch_bundle_elems[]
1032__initdata_or_module =
1033{
1034#define XEN_PATCH_BUNDLE_ELEM(name, type) \
1035 { \
1036 (void*)xen_ ## name ## _direct_start, \
1037 (void*)xen_ ## name ## _direct_end, \
1038 PARAVIRT_PATCH_TYPE_ ## type, \
1039 }
1040
1041 XEN_PATCH_BUNDLE_ELEM(fc, FC),
1042 XEN_PATCH_BUNDLE_ELEM(thash, THASH),
1043 XEN_PATCH_BUNDLE_ELEM(get_cpuid, GET_CPUID),
1044 XEN_PATCH_BUNDLE_ELEM(get_pmd, GET_PMD),
1045 XEN_PATCH_BUNDLE_ELEM(ptcga, PTCGA),
1046 XEN_PATCH_BUNDLE_ELEM(get_rr, GET_RR),
1047 XEN_PATCH_BUNDLE_ELEM(set_rr, SET_RR),
1048 XEN_PATCH_BUNDLE_ELEM(set_rr0_to_rr4, SET_RR0_TO_RR4),
1049 XEN_PATCH_BUNDLE_ELEM(ssm_i, SSM_I),
1050 XEN_PATCH_BUNDLE_ELEM(rsm_i, RSM_I),
1051 XEN_PATCH_BUNDLE_ELEM(get_psr_i, GET_PSR_I),
1052 {
1053 (void*)__xen_intrin_local_irq_restore_direct_start,
1054 (void*)__xen_intrin_local_irq_restore_direct_end,
1055 PARAVIRT_PATCH_TYPE_INTRIN_LOCAL_IRQ_RESTORE,
1056 },
1057
1058#define XEN_PATCH_BUNDLE_ELEM_GETREG(name, reg) \
1059 { \
1060 xen_get_ ## name ## _direct_start, \
1061 xen_get_ ## name ## _direct_end, \
1062 PARAVIRT_PATCH_TYPE_GETREG + _IA64_REG_ ## reg, \
1063 }
1064
1065 XEN_PATCH_BUNDLE_ELEM_GETREG(psr, PSR),
1066 XEN_PATCH_BUNDLE_ELEM_GETREG(eflag, AR_EFLAG),
1067
1068 XEN_PATCH_BUNDLE_ELEM_GETREG(ivr, CR_IVR),
1069 XEN_PATCH_BUNDLE_ELEM_GETREG(tpr, CR_TPR),
1070
1071 XEN_PATCH_BUNDLE_ELEM_GETREG(itc, AR_ITC),
1072 XEN_PATCH_BUNDLE_ELEM_GETREG(itm_with_offset, CR_ITM),
1073
1074
1075#define __XEN_PATCH_BUNDLE_ELEM_SETREG(name, reg) \
1076 { \
1077 xen_ ## name ## _direct_start, \
1078 xen_ ## name ## _direct_end, \
1079 PARAVIRT_PATCH_TYPE_SETREG + _IA64_REG_ ## reg, \
1080 }
1081
1082#define XEN_PATCH_BUNDLE_ELEM_SETREG(name, reg) \
1083 __XEN_PATCH_BUNDLE_ELEM_SETREG(set_ ## name, reg)
1084
1085 XEN_PATCH_BUNDLE_ELEM_SETREG(kr0, AR_KR0),
1086 XEN_PATCH_BUNDLE_ELEM_SETREG(kr1, AR_KR1),
1087 XEN_PATCH_BUNDLE_ELEM_SETREG(kr2, AR_KR2),
1088 XEN_PATCH_BUNDLE_ELEM_SETREG(kr3, AR_KR3),
1089 XEN_PATCH_BUNDLE_ELEM_SETREG(kr4, AR_KR4),
1090 XEN_PATCH_BUNDLE_ELEM_SETREG(kr5, AR_KR5),
1091 XEN_PATCH_BUNDLE_ELEM_SETREG(kr6, AR_KR6),
1092 XEN_PATCH_BUNDLE_ELEM_SETREG(kr7, AR_KR7),
1093
1094 XEN_PATCH_BUNDLE_ELEM_SETREG(eflag, AR_EFLAG),
1095 XEN_PATCH_BUNDLE_ELEM_SETREG(tpr, CR_TPR),
1096 __XEN_PATCH_BUNDLE_ELEM_SETREG(eoi, CR_EOI),
1097
1098 XEN_PATCH_BUNDLE_ELEM_SETREG(itc, AR_ITC),
1099 XEN_PATCH_BUNDLE_ELEM_SETREG(itm_with_offset, CR_ITM),
1100};
1101
1102static unsigned long __init_or_module
1103xen_patch_bundle(void *sbundle, void *ebundle, unsigned long type)
1104{
1105 const unsigned long nelems = sizeof(xen_patch_bundle_elems) /
1106 sizeof(xen_patch_bundle_elems[0]);
1107 unsigned long used;
1108 const struct paravirt_patch_bundle_elem *found;
1109
1110 used = __paravirt_patch_apply_bundle(sbundle, ebundle, type,
1111 xen_patch_bundle_elems, nelems,
1112 &found);
1113
1114 if (found == NULL)
1115 /* fallback */
1116 return ia64_native_patch_bundle(sbundle, ebundle, type);
1117 if (used == 0)
1118 return used;
1119
1120 /* relocation */
1121 switch (type) {
1122 case PARAVIRT_PATCH_TYPE_INTRIN_LOCAL_IRQ_RESTORE: {
1123 unsigned long reloc =
1124 __xen_intrin_local_irq_restore_direct_reloc;
1125 unsigned long reloc_offset = reloc - (unsigned long)
1126 __xen_intrin_local_irq_restore_direct_start;
1127 unsigned long tag = (unsigned long)sbundle + reloc_offset;
1128 paravirt_patch_reloc_brl(tag, xen_check_events);
1129 break;
1130 }
1131 default:
1132 /* nothing */
1133 break;
1134 }
1135 return used;
1136}
1137#endif /* ASM_SUPPOTED */
1138
1139const struct paravirt_patch_branch_target xen_branch_target[]
1140__initconst = {
1141#define PARAVIRT_BR_TARGET(name, type) \
1142 { \
1143 &xen_ ## name, \
1144 PARAVIRT_PATCH_TYPE_BR_ ## type, \
1145 }
1146 PARAVIRT_BR_TARGET(switch_to, SWITCH_TO),
1147 PARAVIRT_BR_TARGET(leave_syscall, LEAVE_SYSCALL),
1148 PARAVIRT_BR_TARGET(work_processed_syscall, WORK_PROCESSED_SYSCALL),
1149 PARAVIRT_BR_TARGET(leave_kernel, LEAVE_KERNEL),
1150};
1151
1152static void __init
1153xen_patch_branch(unsigned long tag, unsigned long type)
1154{
1155 const unsigned long nelem =
1156 sizeof(xen_branch_target) / sizeof(xen_branch_target[0]);
1157 __paravirt_patch_apply_branch(tag, type, xen_branch_target, nelem);
1158}
diff --git a/arch/m32r/kernel/process.c b/arch/m32r/kernel/process.c
index 7103d91e1a2f..3e876f0baebc 100644
--- a/arch/m32r/kernel/process.c
+++ b/arch/m32r/kernel/process.c
@@ -225,7 +225,7 @@ int dump_fpu(struct pt_regs *regs, elf_fpregset_t *fpu)
225 return 0; /* Task didn't use the fpu at all. */ 225 return 0; /* Task didn't use the fpu at all. */
226} 226}
227 227
228int copy_thread(int nr, unsigned long clone_flags, unsigned long spu, 228int copy_thread(unsigned long clone_flags, unsigned long spu,
229 unsigned long unused, struct task_struct *tsk, struct pt_regs *regs) 229 unsigned long unused, struct task_struct *tsk, struct pt_regs *regs)
230{ 230{
231 struct pt_regs *childregs = task_pt_regs(tsk); 231 struct pt_regs *childregs = task_pt_regs(tsk);
diff --git a/arch/m68k/include/asm/bootinfo.h b/arch/m68k/include/asm/bootinfo.h
index fedf3e326121..fb8a06b9ab6a 100644
--- a/arch/m68k/include/asm/bootinfo.h
+++ b/arch/m68k/include/asm/bootinfo.h
@@ -1,5 +1,378 @@
1#ifdef __uClinux__ 1/*
2#include "bootinfo_no.h" 2** asm/bootinfo.h -- Definition of the Linux/m68k boot information structure
3#else 3**
4#include "bootinfo_mm.h" 4** Copyright 1992 by Greg Harp
5**
6** This file is subject to the terms and conditions of the GNU General Public
7** License. See the file COPYING in the main directory of this archive
8** for more details.
9**
10** Created 09/29/92 by Greg Harp
11**
12** 5/2/94 Roman Hodek:
13** Added bi_atari part of the machine dependent union bi_un; for now it
14** contains just a model field to distinguish between TT and Falcon.
15** 26/7/96 Roman Zippel:
16** Renamed to setup.h; added some useful macros to allow gcc some
17** optimizations if possible.
18** 5/10/96 Geert Uytterhoeven:
19** Redesign of the boot information structure; renamed to bootinfo.h again
20** 27/11/96 Geert Uytterhoeven:
21** Backwards compatibility with bootinfo interface version 1.0
22*/
23
24#ifndef _M68K_BOOTINFO_H
25#define _M68K_BOOTINFO_H
26
27
28 /*
29 * Bootinfo definitions
30 *
31 * This is an easily parsable and extendable structure containing all
32 * information to be passed from the bootstrap to the kernel.
33 *
34 * This way I hope to keep all future changes back/forewards compatible.
35 * Thus, keep your fingers crossed...
36 *
37 * This structure is copied right after the kernel bss by the bootstrap
38 * routine.
39 */
40
41#ifndef __ASSEMBLY__
42
43struct bi_record {
44 unsigned short tag; /* tag ID */
45 unsigned short size; /* size of record (in bytes) */
46 unsigned long data[0]; /* data */
47};
48
49#endif /* __ASSEMBLY__ */
50
51
52 /*
53 * Tag Definitions
54 *
55 * Machine independent tags start counting from 0x0000
56 * Machine dependent tags start counting from 0x8000
57 */
58
59#define BI_LAST 0x0000 /* last record (sentinel) */
60#define BI_MACHTYPE 0x0001 /* machine type (u_long) */
61#define BI_CPUTYPE 0x0002 /* cpu type (u_long) */
62#define BI_FPUTYPE 0x0003 /* fpu type (u_long) */
63#define BI_MMUTYPE 0x0004 /* mmu type (u_long) */
64#define BI_MEMCHUNK 0x0005 /* memory chunk address and size */
65 /* (struct mem_info) */
66#define BI_RAMDISK 0x0006 /* ramdisk address and size */
67 /* (struct mem_info) */
68#define BI_COMMAND_LINE 0x0007 /* kernel command line parameters */
69 /* (string) */
70
71 /*
72 * Amiga-specific tags
73 */
74
75#define BI_AMIGA_MODEL 0x8000 /* model (u_long) */
76#define BI_AMIGA_AUTOCON 0x8001 /* AutoConfig device */
77 /* (struct ConfigDev) */
78#define BI_AMIGA_CHIP_SIZE 0x8002 /* size of Chip RAM (u_long) */
79#define BI_AMIGA_VBLANK 0x8003 /* VBLANK frequency (u_char) */
80#define BI_AMIGA_PSFREQ 0x8004 /* power supply frequency (u_char) */
81#define BI_AMIGA_ECLOCK 0x8005 /* EClock frequency (u_long) */
82#define BI_AMIGA_CHIPSET 0x8006 /* native chipset present (u_long) */
83#define BI_AMIGA_SERPER 0x8007 /* serial port period (u_short) */
84
85 /*
86 * Atari-specific tags
87 */
88
89#define BI_ATARI_MCH_COOKIE 0x8000 /* _MCH cookie from TOS (u_long) */
90#define BI_ATARI_MCH_TYPE 0x8001 /* special machine type (u_long) */
91 /* (values are ATARI_MACH_* defines */
92
93/* mch_cookie values (upper word) */
94#define ATARI_MCH_ST 0
95#define ATARI_MCH_STE 1
96#define ATARI_MCH_TT 2
97#define ATARI_MCH_FALCON 3
98
99/* mch_type values */
100#define ATARI_MACH_NORMAL 0 /* no special machine type */
101#define ATARI_MACH_MEDUSA 1 /* Medusa 040 */
102#define ATARI_MACH_HADES 2 /* Hades 040 or 060 */
103#define ATARI_MACH_AB40 3 /* Afterburner040 on Falcon */
104
105 /*
106 * VME-specific tags
107 */
108
109#define BI_VME_TYPE 0x8000 /* VME sub-architecture (u_long) */
110#define BI_VME_BRDINFO 0x8001 /* VME board information (struct) */
111
112/* BI_VME_TYPE codes */
113#define VME_TYPE_TP34V 0x0034 /* Tadpole TP34V */
114#define VME_TYPE_MVME147 0x0147 /* Motorola MVME147 */
115#define VME_TYPE_MVME162 0x0162 /* Motorola MVME162 */
116#define VME_TYPE_MVME166 0x0166 /* Motorola MVME166 */
117#define VME_TYPE_MVME167 0x0167 /* Motorola MVME167 */
118#define VME_TYPE_MVME172 0x0172 /* Motorola MVME172 */
119#define VME_TYPE_MVME177 0x0177 /* Motorola MVME177 */
120#define VME_TYPE_BVME4000 0x4000 /* BVM Ltd. BVME4000 */
121#define VME_TYPE_BVME6000 0x6000 /* BVM Ltd. BVME6000 */
122
123/* BI_VME_BRDINFO is a 32 byte struct as returned by the Bug code on
124 * Motorola VME boards. Contains board number, Bug version, board
125 * configuration options, etc. See include/asm/mvme16xhw.h for details.
126 */
127
128
129 /*
130 * Macintosh-specific tags (all u_long)
131 */
132
133#define BI_MAC_MODEL 0x8000 /* Mac Gestalt ID (model type) */
134#define BI_MAC_VADDR 0x8001 /* Mac video base address */
135#define BI_MAC_VDEPTH 0x8002 /* Mac video depth */
136#define BI_MAC_VROW 0x8003 /* Mac video rowbytes */
137#define BI_MAC_VDIM 0x8004 /* Mac video dimensions */
138#define BI_MAC_VLOGICAL 0x8005 /* Mac video logical base */
139#define BI_MAC_SCCBASE 0x8006 /* Mac SCC base address */
140#define BI_MAC_BTIME 0x8007 /* Mac boot time */
141#define BI_MAC_GMTBIAS 0x8008 /* Mac GMT timezone offset */
142#define BI_MAC_MEMSIZE 0x8009 /* Mac RAM size (sanity check) */
143#define BI_MAC_CPUID 0x800a /* Mac CPU type (sanity check) */
144#define BI_MAC_ROMBASE 0x800b /* Mac system ROM base address */
145
146 /*
147 * Macintosh hardware profile data - unused, see macintosh.h for
148 * resonable type values
149 */
150
151#define BI_MAC_VIA1BASE 0x8010 /* Mac VIA1 base address (always present) */
152#define BI_MAC_VIA2BASE 0x8011 /* Mac VIA2 base address (type varies) */
153#define BI_MAC_VIA2TYPE 0x8012 /* Mac VIA2 type (VIA, RBV, OSS) */
154#define BI_MAC_ADBTYPE 0x8013 /* Mac ADB interface type */
155#define BI_MAC_ASCBASE 0x8014 /* Mac Apple Sound Chip base address */
156#define BI_MAC_SCSI5380 0x8015 /* Mac NCR 5380 SCSI (base address, multi) */
157#define BI_MAC_SCSIDMA 0x8016 /* Mac SCSI DMA (base address) */
158#define BI_MAC_SCSI5396 0x8017 /* Mac NCR 53C96 SCSI (base address, multi) */
159#define BI_MAC_IDETYPE 0x8018 /* Mac IDE interface type */
160#define BI_MAC_IDEBASE 0x8019 /* Mac IDE interface base address */
161#define BI_MAC_NUBUS 0x801a /* Mac Nubus type (none, regular, pseudo) */
162#define BI_MAC_SLOTMASK 0x801b /* Mac Nubus slots present */
163#define BI_MAC_SCCTYPE 0x801c /* Mac SCC serial type (normal, IOP) */
164#define BI_MAC_ETHTYPE 0x801d /* Mac builtin ethernet type (Sonic, MACE */
165#define BI_MAC_ETHBASE 0x801e /* Mac builtin ethernet base address */
166#define BI_MAC_PMU 0x801f /* Mac power management / poweroff hardware */
167#define BI_MAC_IOP_SWIM 0x8020 /* Mac SWIM floppy IOP */
168#define BI_MAC_IOP_ADB 0x8021 /* Mac ADB IOP */
169
170 /*
171 * Mac: compatibility with old booter data format (temporarily)
172 * Fields unused with the new bootinfo can be deleted now; instead of
173 * adding new fields the struct might be splitted into a hardware address
174 * part and a hardware type part
175 */
176
177#ifndef __ASSEMBLY__
178
179struct mac_booter_data
180{
181 unsigned long videoaddr;
182 unsigned long videorow;
183 unsigned long videodepth;
184 unsigned long dimensions;
185 unsigned long args;
186 unsigned long boottime;
187 unsigned long gmtbias;
188 unsigned long bootver;
189 unsigned long videological;
190 unsigned long sccbase;
191 unsigned long id;
192 unsigned long memsize;
193 unsigned long serialmf;
194 unsigned long serialhsk;
195 unsigned long serialgpi;
196 unsigned long printmf;
197 unsigned long printhsk;
198 unsigned long printgpi;
199 unsigned long cpuid;
200 unsigned long rombase;
201 unsigned long adbdelay;
202 unsigned long timedbra;
203};
204
205extern struct mac_booter_data
206 mac_bi_data;
207
5#endif 208#endif
209
210 /*
211 * Apollo-specific tags
212 */
213
214#define BI_APOLLO_MODEL 0x8000 /* model (u_long) */
215
216 /*
217 * HP300-specific tags
218 */
219
220#define BI_HP300_MODEL 0x8000 /* model (u_long) */
221#define BI_HP300_UART_SCODE 0x8001 /* UART select code (u_long) */
222#define BI_HP300_UART_ADDR 0x8002 /* phys. addr of UART (u_long) */
223
224 /*
225 * Stuff for bootinfo interface versioning
226 *
227 * At the start of kernel code, a 'struct bootversion' is located.
228 * bootstrap checks for a matching version of the interface before booting
229 * a kernel, to avoid user confusion if kernel and bootstrap don't work
230 * together :-)
231 *
232 * If incompatible changes are made to the bootinfo interface, the major
233 * number below should be stepped (and the minor reset to 0) for the
234 * appropriate machine. If a change is backward-compatible, the minor
235 * should be stepped. "Backwards-compatible" means that booting will work,
236 * but certain features may not.
237 */
238
239#define BOOTINFOV_MAGIC 0x4249561A /* 'BIV^Z' */
240#define MK_BI_VERSION(major,minor) (((major)<<16)+(minor))
241#define BI_VERSION_MAJOR(v) (((v) >> 16) & 0xffff)
242#define BI_VERSION_MINOR(v) ((v) & 0xffff)
243
244#ifndef __ASSEMBLY__
245
246struct bootversion {
247 unsigned short branch;
248 unsigned long magic;
249 struct {
250 unsigned long machtype;
251 unsigned long version;
252 } machversions[0];
253};
254
255#endif /* __ASSEMBLY__ */
256
257#define AMIGA_BOOTI_VERSION MK_BI_VERSION( 2, 0 )
258#define ATARI_BOOTI_VERSION MK_BI_VERSION( 2, 1 )
259#define MAC_BOOTI_VERSION MK_BI_VERSION( 2, 0 )
260#define MVME147_BOOTI_VERSION MK_BI_VERSION( 2, 0 )
261#define MVME16x_BOOTI_VERSION MK_BI_VERSION( 2, 0 )
262#define BVME6000_BOOTI_VERSION MK_BI_VERSION( 2, 0 )
263#define Q40_BOOTI_VERSION MK_BI_VERSION( 2, 0 )
264#define HP300_BOOTI_VERSION MK_BI_VERSION( 2, 0 )
265
266#ifdef BOOTINFO_COMPAT_1_0
267
268 /*
269 * Backwards compatibility with bootinfo interface version 1.0
270 */
271
272#define COMPAT_AMIGA_BOOTI_VERSION MK_BI_VERSION( 1, 0 )
273#define COMPAT_ATARI_BOOTI_VERSION MK_BI_VERSION( 1, 0 )
274#define COMPAT_MAC_BOOTI_VERSION MK_BI_VERSION( 1, 0 )
275
276#include <linux/zorro.h>
277
278#define COMPAT_NUM_AUTO 16
279
280struct compat_bi_Amiga {
281 int model;
282 int num_autocon;
283 struct ConfigDev autocon[COMPAT_NUM_AUTO];
284 unsigned long chip_size;
285 unsigned char vblank;
286 unsigned char psfreq;
287 unsigned long eclock;
288 unsigned long chipset;
289 unsigned long hw_present;
290};
291
292struct compat_bi_Atari {
293 unsigned long hw_present;
294 unsigned long mch_cookie;
295};
296
297#ifndef __ASSEMBLY__
298
299struct compat_bi_Macintosh
300{
301 unsigned long videoaddr;
302 unsigned long videorow;
303 unsigned long videodepth;
304 unsigned long dimensions;
305 unsigned long args;
306 unsigned long boottime;
307 unsigned long gmtbias;
308 unsigned long bootver;
309 unsigned long videological;
310 unsigned long sccbase;
311 unsigned long id;
312 unsigned long memsize;
313 unsigned long serialmf;
314 unsigned long serialhsk;
315 unsigned long serialgpi;
316 unsigned long printmf;
317 unsigned long printhsk;
318 unsigned long printgpi;
319 unsigned long cpuid;
320 unsigned long rombase;
321 unsigned long adbdelay;
322 unsigned long timedbra;
323};
324
325#endif
326
327struct compat_mem_info {
328 unsigned long addr;
329 unsigned long size;
330};
331
332#define COMPAT_NUM_MEMINFO 4
333
334#define COMPAT_CPUB_68020 0
335#define COMPAT_CPUB_68030 1
336#define COMPAT_CPUB_68040 2
337#define COMPAT_CPUB_68060 3
338#define COMPAT_FPUB_68881 5
339#define COMPAT_FPUB_68882 6
340#define COMPAT_FPUB_68040 7
341#define COMPAT_FPUB_68060 8
342
343#define COMPAT_CPU_68020 (1<<COMPAT_CPUB_68020)
344#define COMPAT_CPU_68030 (1<<COMPAT_CPUB_68030)
345#define COMPAT_CPU_68040 (1<<COMPAT_CPUB_68040)
346#define COMPAT_CPU_68060 (1<<COMPAT_CPUB_68060)
347#define COMPAT_CPU_MASK (31)
348#define COMPAT_FPU_68881 (1<<COMPAT_FPUB_68881)
349#define COMPAT_FPU_68882 (1<<COMPAT_FPUB_68882)
350#define COMPAT_FPU_68040 (1<<COMPAT_FPUB_68040)
351#define COMPAT_FPU_68060 (1<<COMPAT_FPUB_68060)
352#define COMPAT_FPU_MASK (0xfe0)
353
354#define COMPAT_CL_SIZE (256)
355
356struct compat_bootinfo {
357 unsigned long machtype;
358 unsigned long cputype;
359 struct compat_mem_info memory[COMPAT_NUM_MEMINFO];
360 int num_memory;
361 unsigned long ramdisk_size;
362 unsigned long ramdisk_addr;
363 char command_line[COMPAT_CL_SIZE];
364 union {
365 struct compat_bi_Amiga bi_ami;
366 struct compat_bi_Atari bi_ata;
367 struct compat_bi_Macintosh bi_mac;
368 } bi_un;
369};
370
371#define bi_amiga bi_un.bi_ami
372#define bi_atari bi_un.bi_ata
373#define bi_mac bi_un.bi_mac
374
375#endif /* BOOTINFO_COMPAT_1_0 */
376
377
378#endif /* _M68K_BOOTINFO_H */
diff --git a/arch/m68k/include/asm/bootinfo_mm.h b/arch/m68k/include/asm/bootinfo_mm.h
deleted file mode 100644
index fb8a06b9ab6a..000000000000
--- a/arch/m68k/include/asm/bootinfo_mm.h
+++ /dev/null
@@ -1,378 +0,0 @@
1/*
2** asm/bootinfo.h -- Definition of the Linux/m68k boot information structure
3**
4** Copyright 1992 by Greg Harp
5**
6** This file is subject to the terms and conditions of the GNU General Public
7** License. See the file COPYING in the main directory of this archive
8** for more details.
9**
10** Created 09/29/92 by Greg Harp
11**
12** 5/2/94 Roman Hodek:
13** Added bi_atari part of the machine dependent union bi_un; for now it
14** contains just a model field to distinguish between TT and Falcon.
15** 26/7/96 Roman Zippel:
16** Renamed to setup.h; added some useful macros to allow gcc some
17** optimizations if possible.
18** 5/10/96 Geert Uytterhoeven:
19** Redesign of the boot information structure; renamed to bootinfo.h again
20** 27/11/96 Geert Uytterhoeven:
21** Backwards compatibility with bootinfo interface version 1.0
22*/
23
24#ifndef _M68K_BOOTINFO_H
25#define _M68K_BOOTINFO_H
26
27
28 /*
29 * Bootinfo definitions
30 *
31 * This is an easily parsable and extendable structure containing all
32 * information to be passed from the bootstrap to the kernel.
33 *
34 * This way I hope to keep all future changes back/forewards compatible.
35 * Thus, keep your fingers crossed...
36 *
37 * This structure is copied right after the kernel bss by the bootstrap
38 * routine.
39 */
40
41#ifndef __ASSEMBLY__
42
43struct bi_record {
44 unsigned short tag; /* tag ID */
45 unsigned short size; /* size of record (in bytes) */
46 unsigned long data[0]; /* data */
47};
48
49#endif /* __ASSEMBLY__ */
50
51
52 /*
53 * Tag Definitions
54 *
55 * Machine independent tags start counting from 0x0000
56 * Machine dependent tags start counting from 0x8000
57 */
58
59#define BI_LAST 0x0000 /* last record (sentinel) */
60#define BI_MACHTYPE 0x0001 /* machine type (u_long) */
61#define BI_CPUTYPE 0x0002 /* cpu type (u_long) */
62#define BI_FPUTYPE 0x0003 /* fpu type (u_long) */
63#define BI_MMUTYPE 0x0004 /* mmu type (u_long) */
64#define BI_MEMCHUNK 0x0005 /* memory chunk address and size */
65 /* (struct mem_info) */
66#define BI_RAMDISK 0x0006 /* ramdisk address and size */
67 /* (struct mem_info) */
68#define BI_COMMAND_LINE 0x0007 /* kernel command line parameters */
69 /* (string) */
70
71 /*
72 * Amiga-specific tags
73 */
74
75#define BI_AMIGA_MODEL 0x8000 /* model (u_long) */
76#define BI_AMIGA_AUTOCON 0x8001 /* AutoConfig device */
77 /* (struct ConfigDev) */
78#define BI_AMIGA_CHIP_SIZE 0x8002 /* size of Chip RAM (u_long) */
79#define BI_AMIGA_VBLANK 0x8003 /* VBLANK frequency (u_char) */
80#define BI_AMIGA_PSFREQ 0x8004 /* power supply frequency (u_char) */
81#define BI_AMIGA_ECLOCK 0x8005 /* EClock frequency (u_long) */
82#define BI_AMIGA_CHIPSET 0x8006 /* native chipset present (u_long) */
83#define BI_AMIGA_SERPER 0x8007 /* serial port period (u_short) */
84
85 /*
86 * Atari-specific tags
87 */
88
89#define BI_ATARI_MCH_COOKIE 0x8000 /* _MCH cookie from TOS (u_long) */
90#define BI_ATARI_MCH_TYPE 0x8001 /* special machine type (u_long) */
91 /* (values are ATARI_MACH_* defines */
92
93/* mch_cookie values (upper word) */
94#define ATARI_MCH_ST 0
95#define ATARI_MCH_STE 1
96#define ATARI_MCH_TT 2
97#define ATARI_MCH_FALCON 3
98
99/* mch_type values */
100#define ATARI_MACH_NORMAL 0 /* no special machine type */
101#define ATARI_MACH_MEDUSA 1 /* Medusa 040 */
102#define ATARI_MACH_HADES 2 /* Hades 040 or 060 */
103#define ATARI_MACH_AB40 3 /* Afterburner040 on Falcon */
104
105 /*
106 * VME-specific tags
107 */
108
109#define BI_VME_TYPE 0x8000 /* VME sub-architecture (u_long) */
110#define BI_VME_BRDINFO 0x8001 /* VME board information (struct) */
111
112/* BI_VME_TYPE codes */
113#define VME_TYPE_TP34V 0x0034 /* Tadpole TP34V */
114#define VME_TYPE_MVME147 0x0147 /* Motorola MVME147 */
115#define VME_TYPE_MVME162 0x0162 /* Motorola MVME162 */
116#define VME_TYPE_MVME166 0x0166 /* Motorola MVME166 */
117#define VME_TYPE_MVME167 0x0167 /* Motorola MVME167 */
118#define VME_TYPE_MVME172 0x0172 /* Motorola MVME172 */
119#define VME_TYPE_MVME177 0x0177 /* Motorola MVME177 */
120#define VME_TYPE_BVME4000 0x4000 /* BVM Ltd. BVME4000 */
121#define VME_TYPE_BVME6000 0x6000 /* BVM Ltd. BVME6000 */
122
123/* BI_VME_BRDINFO is a 32 byte struct as returned by the Bug code on
124 * Motorola VME boards. Contains board number, Bug version, board
125 * configuration options, etc. See include/asm/mvme16xhw.h for details.
126 */
127
128
129 /*
130 * Macintosh-specific tags (all u_long)
131 */
132
133#define BI_MAC_MODEL 0x8000 /* Mac Gestalt ID (model type) */
134#define BI_MAC_VADDR 0x8001 /* Mac video base address */
135#define BI_MAC_VDEPTH 0x8002 /* Mac video depth */
136#define BI_MAC_VROW 0x8003 /* Mac video rowbytes */
137#define BI_MAC_VDIM 0x8004 /* Mac video dimensions */
138#define BI_MAC_VLOGICAL 0x8005 /* Mac video logical base */
139#define BI_MAC_SCCBASE 0x8006 /* Mac SCC base address */
140#define BI_MAC_BTIME 0x8007 /* Mac boot time */
141#define BI_MAC_GMTBIAS 0x8008 /* Mac GMT timezone offset */
142#define BI_MAC_MEMSIZE 0x8009 /* Mac RAM size (sanity check) */
143#define BI_MAC_CPUID 0x800a /* Mac CPU type (sanity check) */
144#define BI_MAC_ROMBASE 0x800b /* Mac system ROM base address */
145
146 /*
147 * Macintosh hardware profile data - unused, see macintosh.h for
148 * resonable type values
149 */
150
151#define BI_MAC_VIA1BASE 0x8010 /* Mac VIA1 base address (always present) */
152#define BI_MAC_VIA2BASE 0x8011 /* Mac VIA2 base address (type varies) */
153#define BI_MAC_VIA2TYPE 0x8012 /* Mac VIA2 type (VIA, RBV, OSS) */
154#define BI_MAC_ADBTYPE 0x8013 /* Mac ADB interface type */
155#define BI_MAC_ASCBASE 0x8014 /* Mac Apple Sound Chip base address */
156#define BI_MAC_SCSI5380 0x8015 /* Mac NCR 5380 SCSI (base address, multi) */
157#define BI_MAC_SCSIDMA 0x8016 /* Mac SCSI DMA (base address) */
158#define BI_MAC_SCSI5396 0x8017 /* Mac NCR 53C96 SCSI (base address, multi) */
159#define BI_MAC_IDETYPE 0x8018 /* Mac IDE interface type */
160#define BI_MAC_IDEBASE 0x8019 /* Mac IDE interface base address */
161#define BI_MAC_NUBUS 0x801a /* Mac Nubus type (none, regular, pseudo) */
162#define BI_MAC_SLOTMASK 0x801b /* Mac Nubus slots present */
163#define BI_MAC_SCCTYPE 0x801c /* Mac SCC serial type (normal, IOP) */
164#define BI_MAC_ETHTYPE 0x801d /* Mac builtin ethernet type (Sonic, MACE */
165#define BI_MAC_ETHBASE 0x801e /* Mac builtin ethernet base address */
166#define BI_MAC_PMU 0x801f /* Mac power management / poweroff hardware */
167#define BI_MAC_IOP_SWIM 0x8020 /* Mac SWIM floppy IOP */
168#define BI_MAC_IOP_ADB 0x8021 /* Mac ADB IOP */
169
170 /*
171 * Mac: compatibility with old booter data format (temporarily)
172 * Fields unused with the new bootinfo can be deleted now; instead of
173 * adding new fields the struct might be splitted into a hardware address
174 * part and a hardware type part
175 */
176
177#ifndef __ASSEMBLY__
178
179struct mac_booter_data
180{
181 unsigned long videoaddr;
182 unsigned long videorow;
183 unsigned long videodepth;
184 unsigned long dimensions;
185 unsigned long args;
186 unsigned long boottime;
187 unsigned long gmtbias;
188 unsigned long bootver;
189 unsigned long videological;
190 unsigned long sccbase;
191 unsigned long id;
192 unsigned long memsize;
193 unsigned long serialmf;
194 unsigned long serialhsk;
195 unsigned long serialgpi;
196 unsigned long printmf;
197 unsigned long printhsk;
198 unsigned long printgpi;
199 unsigned long cpuid;
200 unsigned long rombase;
201 unsigned long adbdelay;
202 unsigned long timedbra;
203};
204
205extern struct mac_booter_data
206 mac_bi_data;
207
208#endif
209
210 /*
211 * Apollo-specific tags
212 */
213
214#define BI_APOLLO_MODEL 0x8000 /* model (u_long) */
215
216 /*
217 * HP300-specific tags
218 */
219
220#define BI_HP300_MODEL 0x8000 /* model (u_long) */
221#define BI_HP300_UART_SCODE 0x8001 /* UART select code (u_long) */
222#define BI_HP300_UART_ADDR 0x8002 /* phys. addr of UART (u_long) */
223
224 /*
225 * Stuff for bootinfo interface versioning
226 *
227 * At the start of kernel code, a 'struct bootversion' is located.
228 * bootstrap checks for a matching version of the interface before booting
229 * a kernel, to avoid user confusion if kernel and bootstrap don't work
230 * together :-)
231 *
232 * If incompatible changes are made to the bootinfo interface, the major
233 * number below should be stepped (and the minor reset to 0) for the
234 * appropriate machine. If a change is backward-compatible, the minor
235 * should be stepped. "Backwards-compatible" means that booting will work,
236 * but certain features may not.
237 */
238
239#define BOOTINFOV_MAGIC 0x4249561A /* 'BIV^Z' */
240#define MK_BI_VERSION(major,minor) (((major)<<16)+(minor))
241#define BI_VERSION_MAJOR(v) (((v) >> 16) & 0xffff)
242#define BI_VERSION_MINOR(v) ((v) & 0xffff)
243
244#ifndef __ASSEMBLY__
245
246struct bootversion {
247 unsigned short branch;
248 unsigned long magic;
249 struct {
250 unsigned long machtype;
251 unsigned long version;
252 } machversions[0];
253};
254
255#endif /* __ASSEMBLY__ */
256
257#define AMIGA_BOOTI_VERSION MK_BI_VERSION( 2, 0 )
258#define ATARI_BOOTI_VERSION MK_BI_VERSION( 2, 1 )
259#define MAC_BOOTI_VERSION MK_BI_VERSION( 2, 0 )
260#define MVME147_BOOTI_VERSION MK_BI_VERSION( 2, 0 )
261#define MVME16x_BOOTI_VERSION MK_BI_VERSION( 2, 0 )
262#define BVME6000_BOOTI_VERSION MK_BI_VERSION( 2, 0 )
263#define Q40_BOOTI_VERSION MK_BI_VERSION( 2, 0 )
264#define HP300_BOOTI_VERSION MK_BI_VERSION( 2, 0 )
265
266#ifdef BOOTINFO_COMPAT_1_0
267
268 /*
269 * Backwards compatibility with bootinfo interface version 1.0
270 */
271
272#define COMPAT_AMIGA_BOOTI_VERSION MK_BI_VERSION( 1, 0 )
273#define COMPAT_ATARI_BOOTI_VERSION MK_BI_VERSION( 1, 0 )
274#define COMPAT_MAC_BOOTI_VERSION MK_BI_VERSION( 1, 0 )
275
276#include <linux/zorro.h>
277
278#define COMPAT_NUM_AUTO 16
279
280struct compat_bi_Amiga {
281 int model;
282 int num_autocon;
283 struct ConfigDev autocon[COMPAT_NUM_AUTO];
284 unsigned long chip_size;
285 unsigned char vblank;
286 unsigned char psfreq;
287 unsigned long eclock;
288 unsigned long chipset;
289 unsigned long hw_present;
290};
291
292struct compat_bi_Atari {
293 unsigned long hw_present;
294 unsigned long mch_cookie;
295};
296
297#ifndef __ASSEMBLY__
298
299struct compat_bi_Macintosh
300{
301 unsigned long videoaddr;
302 unsigned long videorow;
303 unsigned long videodepth;
304 unsigned long dimensions;
305 unsigned long args;
306 unsigned long boottime;
307 unsigned long gmtbias;
308 unsigned long bootver;
309 unsigned long videological;
310 unsigned long sccbase;
311 unsigned long id;
312 unsigned long memsize;
313 unsigned long serialmf;
314 unsigned long serialhsk;
315 unsigned long serialgpi;
316 unsigned long printmf;
317 unsigned long printhsk;
318 unsigned long printgpi;
319 unsigned long cpuid;
320 unsigned long rombase;
321 unsigned long adbdelay;
322 unsigned long timedbra;
323};
324
325#endif
326
327struct compat_mem_info {
328 unsigned long addr;
329 unsigned long size;
330};
331
332#define COMPAT_NUM_MEMINFO 4
333
334#define COMPAT_CPUB_68020 0
335#define COMPAT_CPUB_68030 1
336#define COMPAT_CPUB_68040 2
337#define COMPAT_CPUB_68060 3
338#define COMPAT_FPUB_68881 5
339#define COMPAT_FPUB_68882 6
340#define COMPAT_FPUB_68040 7
341#define COMPAT_FPUB_68060 8
342
343#define COMPAT_CPU_68020 (1<<COMPAT_CPUB_68020)
344#define COMPAT_CPU_68030 (1<<COMPAT_CPUB_68030)
345#define COMPAT_CPU_68040 (1<<COMPAT_CPUB_68040)
346#define COMPAT_CPU_68060 (1<<COMPAT_CPUB_68060)
347#define COMPAT_CPU_MASK (31)
348#define COMPAT_FPU_68881 (1<<COMPAT_FPUB_68881)
349#define COMPAT_FPU_68882 (1<<COMPAT_FPUB_68882)
350#define COMPAT_FPU_68040 (1<<COMPAT_FPUB_68040)
351#define COMPAT_FPU_68060 (1<<COMPAT_FPUB_68060)
352#define COMPAT_FPU_MASK (0xfe0)
353
354#define COMPAT_CL_SIZE (256)
355
356struct compat_bootinfo {
357 unsigned long machtype;
358 unsigned long cputype;
359 struct compat_mem_info memory[COMPAT_NUM_MEMINFO];
360 int num_memory;
361 unsigned long ramdisk_size;
362 unsigned long ramdisk_addr;
363 char command_line[COMPAT_CL_SIZE];
364 union {
365 struct compat_bi_Amiga bi_ami;
366 struct compat_bi_Atari bi_ata;
367 struct compat_bi_Macintosh bi_mac;
368 } bi_un;
369};
370
371#define bi_amiga bi_un.bi_ami
372#define bi_atari bi_un.bi_ata
373#define bi_mac bi_un.bi_mac
374
375#endif /* BOOTINFO_COMPAT_1_0 */
376
377
378#endif /* _M68K_BOOTINFO_H */
diff --git a/arch/m68k/include/asm/bootinfo_no.h b/arch/m68k/include/asm/bootinfo_no.h
deleted file mode 100644
index c12e526f5189..000000000000
--- a/arch/m68k/include/asm/bootinfo_no.h
+++ /dev/null
@@ -1,2 +0,0 @@
1
2/* Nothing for m68knommu */
diff --git a/arch/m68k/include/asm/bug.h b/arch/m68k/include/asm/bug.h
index 997e0944ebc1..ef9a2e47352f 100644
--- a/arch/m68k/include/asm/bug.h
+++ b/arch/m68k/include/asm/bug.h
@@ -1,5 +1,30 @@
1#ifdef __uClinux__ 1#ifndef _M68K_BUG_H
2#include "bug_no.h" 2#define _M68K_BUG_H
3
4#ifdef CONFIG_MMU
5#ifdef CONFIG_BUG
6#ifdef CONFIG_DEBUG_BUGVERBOSE
7#ifndef CONFIG_SUN3
8#define BUG() do { \
9 printk("kernel BUG at %s:%d!\n", __FILE__, __LINE__); \
10 __builtin_trap(); \
11} while (0)
3#else 12#else
4#include "bug_mm.h" 13#define BUG() do { \
14 printk("kernel BUG at %s:%d!\n", __FILE__, __LINE__); \
15 panic("BUG!"); \
16} while (0)
17#endif
18#else
19#define BUG() do { \
20 __builtin_trap(); \
21} while (0)
22#endif
23
24#define HAVE_ARCH_BUG
25#endif
26#endif /* CONFIG_MMU */
27
28#include <asm-generic/bug.h>
29
5#endif 30#endif
diff --git a/arch/m68k/include/asm/bug_mm.h b/arch/m68k/include/asm/bug_mm.h
deleted file mode 100644
index e5b528deb8a8..000000000000
--- a/arch/m68k/include/asm/bug_mm.h
+++ /dev/null
@@ -1,29 +0,0 @@
1#ifndef _M68K_BUG_H
2#define _M68K_BUG_H
3
4
5#ifdef CONFIG_BUG
6#ifdef CONFIG_DEBUG_BUGVERBOSE
7#ifndef CONFIG_SUN3
8#define BUG() do { \
9 printk("kernel BUG at %s:%d!\n", __FILE__, __LINE__); \
10 __builtin_trap(); \
11} while (0)
12#else
13#define BUG() do { \
14 printk("kernel BUG at %s:%d!\n", __FILE__, __LINE__); \
15 panic("BUG!"); \
16} while (0)
17#endif
18#else
19#define BUG() do { \
20 __builtin_trap(); \
21} while (0)
22#endif
23
24#define HAVE_ARCH_BUG
25#endif
26
27#include <asm-generic/bug.h>
28
29#endif
diff --git a/arch/m68k/include/asm/bug_no.h b/arch/m68k/include/asm/bug_no.h
deleted file mode 100644
index 70e7dc0af21a..000000000000
--- a/arch/m68k/include/asm/bug_no.h
+++ /dev/null
@@ -1,4 +0,0 @@
1#ifndef _M68KNOMMU_BUG_H
2#define _M68KNOMMU_BUG_H
3#include <asm-generic/bug.h>
4#endif
diff --git a/arch/m68k/include/asm/bugs.h b/arch/m68k/include/asm/bugs.h
index 01f047d784ec..d06207b9ba5a 100644
--- a/arch/m68k/include/asm/bugs.h
+++ b/arch/m68k/include/asm/bugs.h
@@ -1,5 +1,20 @@
1#ifdef __uClinux__ 1/*
2#include "bugs_no.h" 2 * include/asm-m68k/bugs.h
3 *
4 * Copyright (C) 1994 Linus Torvalds
5 */
6
7/*
8 * This is included by init/main.c to check for architecture-dependent bugs.
9 *
10 * Needs:
11 * void check_bugs(void);
12 */
13
14#ifdef CONFIG_MMU
15extern void check_bugs(void); /* in arch/m68k/kernel/setup.c */
3#else 16#else
4#include "bugs_mm.h" 17static void check_bugs(void)
18{
19}
5#endif 20#endif
diff --git a/arch/m68k/include/asm/bugs_mm.h b/arch/m68k/include/asm/bugs_mm.h
deleted file mode 100644
index d01935592410..000000000000
--- a/arch/m68k/include/asm/bugs_mm.h
+++ /dev/null
@@ -1,14 +0,0 @@
1/*
2 * include/asm-m68k/bugs.h
3 *
4 * Copyright (C) 1994 Linus Torvalds
5 */
6
7/*
8 * This is included by init/main.c to check for architecture-dependent bugs.
9 *
10 * Needs:
11 * void check_bugs(void);
12 */
13
14extern void check_bugs(void); /* in arch/m68k/kernel/setup.c */
diff --git a/arch/m68k/include/asm/bugs_no.h b/arch/m68k/include/asm/bugs_no.h
deleted file mode 100644
index 5f382dac3a60..000000000000
--- a/arch/m68k/include/asm/bugs_no.h
+++ /dev/null
@@ -1,16 +0,0 @@
1/*
2 * include/asm-m68k/bugs.h
3 *
4 * Copyright (C) 1994 Linus Torvalds
5 */
6
7/*
8 * This is included by init/main.c to check for architecture-dependent bugs.
9 *
10 * Needs:
11 * void check_bugs(void);
12 */
13
14static void check_bugs(void)
15{
16}
diff --git a/arch/m68k/include/asm/cache.h b/arch/m68k/include/asm/cache.h
index 599c29bc8f40..fed3fd30de7e 100644
--- a/arch/m68k/include/asm/cache.h
+++ b/arch/m68k/include/asm/cache.h
@@ -1,5 +1,11 @@
1#ifdef __uClinux__ 1/*
2#include "cache_no.h" 2 * include/asm-m68k/cache.h
3#else 3 */
4#include "cache_mm.h" 4#ifndef __ARCH_M68K_CACHE_H
5#define __ARCH_M68K_CACHE_H
6
7/* bytes per L1 cache line */
8#define L1_CACHE_SHIFT 4
9#define L1_CACHE_BYTES (1<< L1_CACHE_SHIFT)
10
5#endif 11#endif
diff --git a/arch/m68k/include/asm/cache_mm.h b/arch/m68k/include/asm/cache_mm.h
deleted file mode 100644
index fed3fd30de7e..000000000000
--- a/arch/m68k/include/asm/cache_mm.h
+++ /dev/null
@@ -1,11 +0,0 @@
1/*
2 * include/asm-m68k/cache.h
3 */
4#ifndef __ARCH_M68K_CACHE_H
5#define __ARCH_M68K_CACHE_H
6
7/* bytes per L1 cache line */
8#define L1_CACHE_SHIFT 4
9#define L1_CACHE_BYTES (1<< L1_CACHE_SHIFT)
10
11#endif
diff --git a/arch/m68k/include/asm/cache_no.h b/arch/m68k/include/asm/cache_no.h
deleted file mode 100644
index 24e9eace5f8c..000000000000
--- a/arch/m68k/include/asm/cache_no.h
+++ /dev/null
@@ -1,12 +0,0 @@
1#ifndef __ARCH_M68KNOMMU_CACHE_H
2#define __ARCH_M68KNOMMU_CACHE_H
3
4/* bytes per L1 cache line */
5#define L1_CACHE_BYTES 16 /* this need to be at least 1 */
6
7/* m68k-elf-gcc 2.95.2 doesn't like these */
8
9#define __cacheline_aligned
10#define ____cacheline_aligned
11
12#endif
diff --git a/arch/m68k/include/asm/current.h b/arch/m68k/include/asm/current.h
index 51b056dfaedd..91fcc5358cfe 100644
--- a/arch/m68k/include/asm/current.h
+++ b/arch/m68k/include/asm/current.h
@@ -1,5 +1,28 @@
1#ifdef __uClinux__ 1#ifndef _M68K_CURRENT_H
2#include "current_no.h" 2#define _M68K_CURRENT_H
3
4#ifdef CONFIG_MMU
5
6register struct task_struct *current __asm__("%a2");
7
3#else 8#else
4#include "current_mm.h" 9
5#endif 10/*
11 * Rather than dedicate a register (as the m68k source does), we
12 * just keep a global, we should probably just change it all to be
13 * current and lose _current_task.
14 */
15#include <linux/thread_info.h>
16
17struct task_struct;
18
19static inline struct task_struct *get_current(void)
20{
21 return(current_thread_info()->task);
22}
23
24#define current get_current()
25
26#endif /* CONFNIG_MMU */
27
28#endif /* !(_M68K_CURRENT_H) */
diff --git a/arch/m68k/include/asm/current_mm.h b/arch/m68k/include/asm/current_mm.h
deleted file mode 100644
index 8de8f8ceda61..000000000000
--- a/arch/m68k/include/asm/current_mm.h
+++ /dev/null
@@ -1,6 +0,0 @@
1#ifndef _M68K_CURRENT_H
2#define _M68K_CURRENT_H
3
4register struct task_struct *current __asm__("%a2");
5
6#endif /* !(_M68K_CURRENT_H) */
diff --git a/arch/m68k/include/asm/current_no.h b/arch/m68k/include/asm/current_no.h
deleted file mode 100644
index 53ee0f9f7cef..000000000000
--- a/arch/m68k/include/asm/current_no.h
+++ /dev/null
@@ -1,24 +0,0 @@
1#ifndef _M68KNOMMU_CURRENT_H
2#define _M68KNOMMU_CURRENT_H
3/*
4 * current.h
5 * (C) Copyright 2000, Lineo, David McCullough <davidm@uclinux.org>
6 * (C) Copyright 2002, Greg Ungerer (gerg@snapgear.com)
7 *
8 * rather than dedicate a register (as the m68k source does), we
9 * just keep a global, we should probably just change it all to be
10 * current and lose _current_task.
11 */
12
13#include <linux/thread_info.h>
14
15struct task_struct;
16
17static inline struct task_struct *get_current(void)
18{
19 return(current_thread_info()->task);
20}
21
22#define current get_current()
23
24#endif /* _M68KNOMMU_CURRENT_H */
diff --git a/arch/m68k/include/asm/div64.h b/arch/m68k/include/asm/div64.h
index d211d9f54276..edb66148a71d 100644
--- a/arch/m68k/include/asm/div64.h
+++ b/arch/m68k/include/asm/div64.h
@@ -1,5 +1,34 @@
1#ifdef __uClinux__ 1#ifndef _M68K_DIV64_H
2#include "div64_no.h" 2#define _M68K_DIV64_H
3
4#ifdef CONFIG_MMU
5
6#include <linux/types.h>
7
8/* n = n / base; return rem; */
9
10#define do_div(n, base) ({ \
11 union { \
12 unsigned long n32[2]; \
13 unsigned long long n64; \
14 } __n; \
15 unsigned long __rem, __upper; \
16 \
17 __n.n64 = (n); \
18 if ((__upper = __n.n32[0])) { \
19 asm ("divul.l %2,%1:%0" \
20 : "=d" (__n.n32[0]), "=d" (__upper) \
21 : "d" (base), "0" (__n.n32[0])); \
22 } \
23 asm ("divu.l %2,%1:%0" \
24 : "=d" (__n.n32[1]), "=d" (__rem) \
25 : "d" (base), "1" (__upper), "0" (__n.n32[1])); \
26 (n) = __n.n64; \
27 __rem; \
28})
29
3#else 30#else
4#include "div64_mm.h" 31#include <asm-generic/div64.h>
5#endif 32#endif /* CONFIG_MMU */
33
34#endif /* _M68K_DIV64_H */
diff --git a/arch/m68k/include/asm/div64_mm.h b/arch/m68k/include/asm/div64_mm.h
deleted file mode 100644
index 8243c931b5c0..000000000000
--- a/arch/m68k/include/asm/div64_mm.h
+++ /dev/null
@@ -1,28 +0,0 @@
1#ifndef _M68K_DIV64_H
2#define _M68K_DIV64_H
3
4#include <linux/types.h>
5
6/* n = n / base; return rem; */
7
8#define do_div(n, base) ({ \
9 union { \
10 unsigned long n32[2]; \
11 unsigned long long n64; \
12 } __n; \
13 unsigned long __rem, __upper; \
14 \
15 __n.n64 = (n); \
16 if ((__upper = __n.n32[0])) { \
17 asm ("divul.l %2,%1:%0" \
18 : "=d" (__n.n32[0]), "=d" (__upper) \
19 : "d" (base), "0" (__n.n32[0])); \
20 } \
21 asm ("divu.l %2,%1:%0" \
22 : "=d" (__n.n32[1]), "=d" (__rem) \
23 : "d" (base), "1" (__upper), "0" (__n.n32[1])); \
24 (n) = __n.n64; \
25 __rem; \
26})
27
28#endif /* _M68K_DIV64_H */
diff --git a/arch/m68k/include/asm/div64_no.h b/arch/m68k/include/asm/div64_no.h
deleted file mode 100644
index 6cd978cefb28..000000000000
--- a/arch/m68k/include/asm/div64_no.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-generic/div64.h>
diff --git a/arch/m68k/include/asm/dma-mapping.h b/arch/m68k/include/asm/dma-mapping.h
index f4a4c7638f89..26f505488c11 100644
--- a/arch/m68k/include/asm/dma-mapping.h
+++ b/arch/m68k/include/asm/dma-mapping.h
@@ -1,5 +1,112 @@
1#ifdef __uClinux__ 1#ifndef _M68K_DMA_MAPPING_H
2#include "dma-mapping_no.h" 2#define _M68K_DMA_MAPPING_H
3
4#include <asm/cache.h>
5
6struct scatterlist;
7
8#ifndef CONFIG_MMU_SUN3
9static inline int dma_supported(struct device *dev, u64 mask)
10{
11 return 1;
12}
13
14static inline int dma_set_mask(struct device *dev, u64 mask)
15{
16 return 0;
17}
18
19static inline int dma_get_cache_alignment(void)
20{
21 return 1 << L1_CACHE_SHIFT;
22}
23
24static inline int dma_is_consistent(struct device *dev, dma_addr_t dma_addr)
25{
26 return 0;
27}
28
29extern void *dma_alloc_coherent(struct device *, size_t,
30 dma_addr_t *, gfp_t);
31extern void dma_free_coherent(struct device *, size_t,
32 void *, dma_addr_t);
33
34static inline void *dma_alloc_noncoherent(struct device *dev, size_t size,
35 dma_addr_t *handle, gfp_t flag)
36{
37 return dma_alloc_coherent(dev, size, handle, flag);
38}
39static inline void dma_free_noncoherent(struct device *dev, size_t size,
40 void *addr, dma_addr_t handle)
41{
42 dma_free_coherent(dev, size, addr, handle);
43}
44static inline void dma_cache_sync(struct device *dev, void *vaddr, size_t size,
45 enum dma_data_direction dir)
46{
47 /* we use coherent allocation, so not much to do here. */
48}
49
50extern dma_addr_t dma_map_single(struct device *, void *, size_t,
51 enum dma_data_direction);
52static inline void dma_unmap_single(struct device *dev, dma_addr_t addr,
53 size_t size, enum dma_data_direction dir)
54{
55}
56
57extern dma_addr_t dma_map_page(struct device *, struct page *,
58 unsigned long, size_t size,
59 enum dma_data_direction);
60static inline void dma_unmap_page(struct device *dev, dma_addr_t address,
61 size_t size, enum dma_data_direction dir)
62{
63}
64
65extern int dma_map_sg(struct device *, struct scatterlist *, int,
66 enum dma_data_direction);
67static inline void dma_unmap_sg(struct device *dev, struct scatterlist *sg,
68 int nhwentries, enum dma_data_direction dir)
69{
70}
71
72extern void dma_sync_single_for_device(struct device *, dma_addr_t, size_t,
73 enum dma_data_direction);
74extern void dma_sync_sg_for_device(struct device *, struct scatterlist *, int,
75 enum dma_data_direction);
76
77static inline void dma_sync_single_range_for_device(struct device *dev,
78 dma_addr_t dma_handle, unsigned long offset, size_t size,
79 enum dma_data_direction direction)
80{
81 /* just sync everything for now */
82 dma_sync_single_for_device(dev, dma_handle, offset + size, direction);
83}
84
85static inline void dma_sync_single_for_cpu(struct device *dev, dma_addr_t handle,
86 size_t size, enum dma_data_direction dir)
87{
88}
89
90static inline void dma_sync_sg_for_cpu(struct device *dev, struct scatterlist *sg,
91 int nents, enum dma_data_direction dir)
92{
93}
94
95static inline void dma_sync_single_range_for_cpu(struct device *dev,
96 dma_addr_t dma_handle, unsigned long offset, size_t size,
97 enum dma_data_direction direction)
98{
99 /* just sync everything for now */
100 dma_sync_single_for_cpu(dev, dma_handle, offset + size, direction);
101}
102
103static inline int dma_mapping_error(struct device *dev, dma_addr_t handle)
104{
105 return 0;
106}
107
3#else 108#else
4#include "dma-mapping_mm.h" 109#include <asm-generic/dma-mapping-broken.h>
5#endif 110#endif
111
112#endif /* _M68K_DMA_MAPPING_H */
diff --git a/arch/m68k/include/asm/dma-mapping_mm.h b/arch/m68k/include/asm/dma-mapping_mm.h
deleted file mode 100644
index 26f505488c11..000000000000
--- a/arch/m68k/include/asm/dma-mapping_mm.h
+++ /dev/null
@@ -1,112 +0,0 @@
1#ifndef _M68K_DMA_MAPPING_H
2#define _M68K_DMA_MAPPING_H
3
4#include <asm/cache.h>
5
6struct scatterlist;
7
8#ifndef CONFIG_MMU_SUN3
9static inline int dma_supported(struct device *dev, u64 mask)
10{
11 return 1;
12}
13
14static inline int dma_set_mask(struct device *dev, u64 mask)
15{
16 return 0;
17}
18
19static inline int dma_get_cache_alignment(void)
20{
21 return 1 << L1_CACHE_SHIFT;
22}
23
24static inline int dma_is_consistent(struct device *dev, dma_addr_t dma_addr)
25{
26 return 0;
27}
28
29extern void *dma_alloc_coherent(struct device *, size_t,
30 dma_addr_t *, gfp_t);
31extern void dma_free_coherent(struct device *, size_t,
32 void *, dma_addr_t);
33
34static inline void *dma_alloc_noncoherent(struct device *dev, size_t size,
35 dma_addr_t *handle, gfp_t flag)
36{
37 return dma_alloc_coherent(dev, size, handle, flag);
38}
39static inline void dma_free_noncoherent(struct device *dev, size_t size,
40 void *addr, dma_addr_t handle)
41{
42 dma_free_coherent(dev, size, addr, handle);
43}
44static inline void dma_cache_sync(struct device *dev, void *vaddr, size_t size,
45 enum dma_data_direction dir)
46{
47 /* we use coherent allocation, so not much to do here. */
48}
49
50extern dma_addr_t dma_map_single(struct device *, void *, size_t,
51 enum dma_data_direction);
52static inline void dma_unmap_single(struct device *dev, dma_addr_t addr,
53 size_t size, enum dma_data_direction dir)
54{
55}
56
57extern dma_addr_t dma_map_page(struct device *, struct page *,
58 unsigned long, size_t size,
59 enum dma_data_direction);
60static inline void dma_unmap_page(struct device *dev, dma_addr_t address,
61 size_t size, enum dma_data_direction dir)
62{
63}
64
65extern int dma_map_sg(struct device *, struct scatterlist *, int,
66 enum dma_data_direction);
67static inline void dma_unmap_sg(struct device *dev, struct scatterlist *sg,
68 int nhwentries, enum dma_data_direction dir)
69{
70}
71
72extern void dma_sync_single_for_device(struct device *, dma_addr_t, size_t,
73 enum dma_data_direction);
74extern void dma_sync_sg_for_device(struct device *, struct scatterlist *, int,
75 enum dma_data_direction);
76
77static inline void dma_sync_single_range_for_device(struct device *dev,
78 dma_addr_t dma_handle, unsigned long offset, size_t size,
79 enum dma_data_direction direction)
80{
81 /* just sync everything for now */
82 dma_sync_single_for_device(dev, dma_handle, offset + size, direction);
83}
84
85static inline void dma_sync_single_for_cpu(struct device *dev, dma_addr_t handle,
86 size_t size, enum dma_data_direction dir)
87{
88}
89
90static inline void dma_sync_sg_for_cpu(struct device *dev, struct scatterlist *sg,
91 int nents, enum dma_data_direction dir)
92{
93}
94
95static inline void dma_sync_single_range_for_cpu(struct device *dev,
96 dma_addr_t dma_handle, unsigned long offset, size_t size,
97 enum dma_data_direction direction)
98{
99 /* just sync everything for now */
100 dma_sync_single_for_cpu(dev, dma_handle, offset + size, direction);
101}
102
103static inline int dma_mapping_error(struct device *dev, dma_addr_t handle)
104{
105 return 0;
106}
107
108#else
109#include <asm-generic/dma-mapping-broken.h>
110#endif
111
112#endif /* _M68K_DMA_MAPPING_H */
diff --git a/arch/m68k/include/asm/dma-mapping_no.h b/arch/m68k/include/asm/dma-mapping_no.h
deleted file mode 100644
index 1748f2bca940..000000000000
--- a/arch/m68k/include/asm/dma-mapping_no.h
+++ /dev/null
@@ -1,6 +0,0 @@
1#ifndef _M68KNOMMU_DMA_MAPPING_H
2#define _M68KNOMMU_DMA_MAPPING_H
3
4#include <asm-generic/dma-mapping-broken.h>
5
6#endif /* _M68KNOMMU_DMA_MAPPING_H */
diff --git a/arch/m68k/include/asm/elf.h b/arch/m68k/include/asm/elf.h
index 04ce488bc63f..0b0f49eb876b 100644
--- a/arch/m68k/include/asm/elf.h
+++ b/arch/m68k/include/asm/elf.h
@@ -1,5 +1,119 @@
1#ifdef __uClinux__ 1#ifndef __ASMm68k_ELF_H
2#include "elf_no.h" 2#define __ASMm68k_ELF_H
3
4/*
5 * ELF register definitions..
6 */
7
8#include <asm/ptrace.h>
9#include <asm/user.h>
10
11/*
12 * 68k ELF relocation types
13 */
14#define R_68K_NONE 0
15#define R_68K_32 1
16#define R_68K_16 2
17#define R_68K_8 3
18#define R_68K_PC32 4
19#define R_68K_PC16 5
20#define R_68K_PC8 6
21#define R_68K_GOT32 7
22#define R_68K_GOT16 8
23#define R_68K_GOT8 9
24#define R_68K_GOT32O 10
25#define R_68K_GOT16O 11
26#define R_68K_GOT8O 12
27#define R_68K_PLT32 13
28#define R_68K_PLT16 14
29#define R_68K_PLT8 15
30#define R_68K_PLT32O 16
31#define R_68K_PLT16O 17
32#define R_68K_PLT8O 18
33#define R_68K_COPY 19
34#define R_68K_GLOB_DAT 20
35#define R_68K_JMP_SLOT 21
36#define R_68K_RELATIVE 22
37
38typedef unsigned long elf_greg_t;
39
40#define ELF_NGREG (sizeof(struct user_regs_struct) / sizeof(elf_greg_t))
41typedef elf_greg_t elf_gregset_t[ELF_NGREG];
42
43typedef struct user_m68kfp_struct elf_fpregset_t;
44
45/*
46 * This is used to ensure we don't load something for the wrong architecture.
47 */
48#define elf_check_arch(x) ((x)->e_machine == EM_68K)
49
50/*
51 * These are used to set parameters in the core dumps.
52 */
53#define ELF_CLASS ELFCLASS32
54#define ELF_DATA ELFDATA2MSB
55#define ELF_ARCH EM_68K
56
57/* For SVR4/m68k the function pointer to be registered with `atexit' is
58 passed in %a1. Although my copy of the ABI has no such statement, it
59 is actually used on ASV. */
60#define ELF_PLAT_INIT(_r, load_addr) _r->a1 = 0
61
62#define USE_ELF_CORE_DUMP
63#ifndef CONFIG_SUN3
64#define ELF_EXEC_PAGESIZE 4096
3#else 65#else
4#include "elf_mm.h" 66#define ELF_EXEC_PAGESIZE 8192
67#endif
68
69/* This is the location that an ET_DYN program is loaded if exec'ed. Typical
70 use of this is to invoke "./ld.so someprog" to test out a new version of
71 the loader. We need to make sure that it is out of the way of the program
72 that it will "exec", and that there is sufficient room for the brk. */
73
74#ifndef CONFIG_SUN3
75#define ELF_ET_DYN_BASE 0xD0000000UL
76#else
77#define ELF_ET_DYN_BASE 0x0D800000UL
78#endif
79
80#define ELF_CORE_COPY_REGS(pr_reg, regs) \
81 /* Bleech. */ \
82 pr_reg[0] = regs->d1; \
83 pr_reg[1] = regs->d2; \
84 pr_reg[2] = regs->d3; \
85 pr_reg[3] = regs->d4; \
86 pr_reg[4] = regs->d5; \
87 pr_reg[7] = regs->a0; \
88 pr_reg[8] = regs->a1; \
89 pr_reg[9] = regs->a2; \
90 pr_reg[14] = regs->d0; \
91 pr_reg[15] = rdusp(); \
92 pr_reg[16] = regs->orig_d0; \
93 pr_reg[17] = regs->sr; \
94 pr_reg[18] = regs->pc; \
95 pr_reg[19] = (regs->format << 12) | regs->vector; \
96 { \
97 struct switch_stack *sw = ((struct switch_stack *)regs) - 1; \
98 pr_reg[5] = sw->d6; \
99 pr_reg[6] = sw->d7; \
100 pr_reg[10] = sw->a3; \
101 pr_reg[11] = sw->a4; \
102 pr_reg[12] = sw->a5; \
103 pr_reg[13] = sw->a6; \
104 }
105
106/* This yields a mask that user programs can use to figure out what
107 instruction set this cpu supports. */
108
109#define ELF_HWCAP (0)
110
111/* This yields a string that ld.so will use to load implementation
112 specific libraries for optimization. This is more specific in
113 intent than poking at uname or /proc/cpuinfo. */
114
115#define ELF_PLATFORM (NULL)
116
117#define SET_PERSONALITY(ex) set_personality(PER_LINUX)
118
5#endif 119#endif
diff --git a/arch/m68k/include/asm/elf_mm.h b/arch/m68k/include/asm/elf_mm.h
deleted file mode 100644
index 0b0f49eb876b..000000000000
--- a/arch/m68k/include/asm/elf_mm.h
+++ /dev/null
@@ -1,119 +0,0 @@
1#ifndef __ASMm68k_ELF_H
2#define __ASMm68k_ELF_H
3
4/*
5 * ELF register definitions..
6 */
7
8#include <asm/ptrace.h>
9#include <asm/user.h>
10
11/*
12 * 68k ELF relocation types
13 */
14#define R_68K_NONE 0
15#define R_68K_32 1
16#define R_68K_16 2
17#define R_68K_8 3
18#define R_68K_PC32 4
19#define R_68K_PC16 5
20#define R_68K_PC8 6
21#define R_68K_GOT32 7
22#define R_68K_GOT16 8
23#define R_68K_GOT8 9
24#define R_68K_GOT32O 10
25#define R_68K_GOT16O 11
26#define R_68K_GOT8O 12
27#define R_68K_PLT32 13
28#define R_68K_PLT16 14
29#define R_68K_PLT8 15
30#define R_68K_PLT32O 16
31#define R_68K_PLT16O 17
32#define R_68K_PLT8O 18
33#define R_68K_COPY 19
34#define R_68K_GLOB_DAT 20
35#define R_68K_JMP_SLOT 21
36#define R_68K_RELATIVE 22
37
38typedef unsigned long elf_greg_t;
39
40#define ELF_NGREG (sizeof(struct user_regs_struct) / sizeof(elf_greg_t))
41typedef elf_greg_t elf_gregset_t[ELF_NGREG];
42
43typedef struct user_m68kfp_struct elf_fpregset_t;
44
45/*
46 * This is used to ensure we don't load something for the wrong architecture.
47 */
48#define elf_check_arch(x) ((x)->e_machine == EM_68K)
49
50/*
51 * These are used to set parameters in the core dumps.
52 */
53#define ELF_CLASS ELFCLASS32
54#define ELF_DATA ELFDATA2MSB
55#define ELF_ARCH EM_68K
56
57/* For SVR4/m68k the function pointer to be registered with `atexit' is
58 passed in %a1. Although my copy of the ABI has no such statement, it
59 is actually used on ASV. */
60#define ELF_PLAT_INIT(_r, load_addr) _r->a1 = 0
61
62#define USE_ELF_CORE_DUMP
63#ifndef CONFIG_SUN3
64#define ELF_EXEC_PAGESIZE 4096
65#else
66#define ELF_EXEC_PAGESIZE 8192
67#endif
68
69/* This is the location that an ET_DYN program is loaded if exec'ed. Typical
70 use of this is to invoke "./ld.so someprog" to test out a new version of
71 the loader. We need to make sure that it is out of the way of the program
72 that it will "exec", and that there is sufficient room for the brk. */
73
74#ifndef CONFIG_SUN3
75#define ELF_ET_DYN_BASE 0xD0000000UL
76#else
77#define ELF_ET_DYN_BASE 0x0D800000UL
78#endif
79
80#define ELF_CORE_COPY_REGS(pr_reg, regs) \
81 /* Bleech. */ \
82 pr_reg[0] = regs->d1; \
83 pr_reg[1] = regs->d2; \
84 pr_reg[2] = regs->d3; \
85 pr_reg[3] = regs->d4; \
86 pr_reg[4] = regs->d5; \
87 pr_reg[7] = regs->a0; \
88 pr_reg[8] = regs->a1; \
89 pr_reg[9] = regs->a2; \
90 pr_reg[14] = regs->d0; \
91 pr_reg[15] = rdusp(); \
92 pr_reg[16] = regs->orig_d0; \
93 pr_reg[17] = regs->sr; \
94 pr_reg[18] = regs->pc; \
95 pr_reg[19] = (regs->format << 12) | regs->vector; \
96 { \
97 struct switch_stack *sw = ((struct switch_stack *)regs) - 1; \
98 pr_reg[5] = sw->d6; \
99 pr_reg[6] = sw->d7; \
100 pr_reg[10] = sw->a3; \
101 pr_reg[11] = sw->a4; \
102 pr_reg[12] = sw->a5; \
103 pr_reg[13] = sw->a6; \
104 }
105
106/* This yields a mask that user programs can use to figure out what
107 instruction set this cpu supports. */
108
109#define ELF_HWCAP (0)
110
111/* This yields a string that ld.so will use to load implementation
112 specific libraries for optimization. This is more specific in
113 intent than poking at uname or /proc/cpuinfo. */
114
115#define ELF_PLATFORM (NULL)
116
117#define SET_PERSONALITY(ex) set_personality(PER_LINUX)
118
119#endif
diff --git a/arch/m68k/include/asm/elf_no.h b/arch/m68k/include/asm/elf_no.h
deleted file mode 100644
index b8046837f384..000000000000
--- a/arch/m68k/include/asm/elf_no.h
+++ /dev/null
@@ -1,110 +0,0 @@
1#ifndef __ASMm68k_ELF_H
2#define __ASMm68k_ELF_H
3
4/*
5 * ELF register definitions..
6 */
7
8#include <asm/ptrace.h>
9#include <asm/user.h>
10
11/*
12 * 68k ELF relocation types
13 */
14#define R_68K_NONE 0
15#define R_68K_32 1
16#define R_68K_16 2
17#define R_68K_8 3
18#define R_68K_PC32 4
19#define R_68K_PC16 5
20#define R_68K_PC8 6
21#define R_68K_GOT32 7
22#define R_68K_GOT16 8
23#define R_68K_GOT8 9
24#define R_68K_GOT32O 10
25#define R_68K_GOT16O 11
26#define R_68K_GOT8O 12
27#define R_68K_PLT32 13
28#define R_68K_PLT16 14
29#define R_68K_PLT8 15
30#define R_68K_PLT32O 16
31#define R_68K_PLT16O 17
32#define R_68K_PLT8O 18
33#define R_68K_COPY 19
34#define R_68K_GLOB_DAT 20
35#define R_68K_JMP_SLOT 21
36#define R_68K_RELATIVE 22
37
38typedef unsigned long elf_greg_t;
39
40#define ELF_NGREG (sizeof(struct user_regs_struct) / sizeof(elf_greg_t))
41typedef elf_greg_t elf_gregset_t[ELF_NGREG];
42
43typedef struct user_m68kfp_struct elf_fpregset_t;
44
45/*
46 * This is used to ensure we don't load something for the wrong architecture.
47 */
48#define elf_check_arch(x) ((x)->e_machine == EM_68K)
49
50/*
51 * These are used to set parameters in the core dumps.
52 */
53#define ELF_CLASS ELFCLASS32
54#define ELF_DATA ELFDATA2MSB
55#define ELF_ARCH EM_68K
56
57/* For SVR4/m68k the function pointer to be registered with `atexit' is
58 passed in %a1. Although my copy of the ABI has no such statement, it
59 is actually used on ASV. */
60#define ELF_PLAT_INIT(_r, load_addr) _r->a1 = 0
61
62#define USE_ELF_CORE_DUMP
63#define ELF_EXEC_PAGESIZE 4096
64
65/* This is the location that an ET_DYN program is loaded if exec'ed. Typical
66 use of this is to invoke "./ld.so someprog" to test out a new version of
67 the loader. We need to make sure that it is out of the way of the program
68 that it will "exec", and that there is sufficient room for the brk. */
69
70#define ELF_ET_DYN_BASE 0xD0000000UL
71
72#define ELF_CORE_COPY_REGS(pr_reg, regs) \
73 /* Bleech. */ \
74 pr_reg[0] = regs->d1; \
75 pr_reg[1] = regs->d2; \
76 pr_reg[2] = regs->d3; \
77 pr_reg[3] = regs->d4; \
78 pr_reg[4] = regs->d5; \
79 pr_reg[7] = regs->a0; \
80 pr_reg[8] = regs->a1; \
81 pr_reg[14] = regs->d0; \
82 pr_reg[15] = rdusp(); \
83 pr_reg[16] = 0 /* regs->orig_d0 */; \
84 pr_reg[17] = regs->sr; \
85 pr_reg[18] = regs->pc; \
86 /* pr_reg[19] = (regs->format << 12) | regs->vector; */ \
87 { \
88 struct switch_stack *sw = ((struct switch_stack *)regs) - 1; \
89 pr_reg[5] = sw->d6; \
90 pr_reg[6] = sw->d7; \
91 pr_reg[10] = sw->a3; \
92 pr_reg[11] = sw->a4; \
93 pr_reg[12] = sw->a5; \
94 pr_reg[13] = sw->a6; \
95 }
96
97/* This yields a mask that user programs can use to figure out what
98 instruction set this cpu supports. */
99
100#define ELF_HWCAP (0)
101
102/* This yields a string that ld.so will use to load implementation
103 specific libraries for optimization. This is more specific in
104 intent than poking at uname or /proc/cpuinfo. */
105
106#define ELF_PLATFORM (NULL)
107
108#define SET_PERSONALITY(ex) set_personality(PER_LINUX)
109
110#endif
diff --git a/arch/m68k/include/asm/fb.h b/arch/m68k/include/asm/fb.h
index 97bcaefd2064..be4e4c6797e8 100644
--- a/arch/m68k/include/asm/fb.h
+++ b/arch/m68k/include/asm/fb.h
@@ -1,5 +1,38 @@
1#ifdef __uClinux__ 1#ifndef _ASM_FB_H_
2#include "fb_no.h" 2#define _ASM_FB_H_
3
4#include <linux/fb.h>
5#include <linux/fs.h>
6#include <asm/page.h>
7#include <asm/setup.h>
8
9#ifdef CONFIG_MMU
10#ifdef CONFIG_SUN3
11static inline void fb_pgprotect(struct file *file, struct vm_area_struct *vma,
12 unsigned long off)
13{
14 pgprot_val(vma->vm_page_prot) |= SUN3_PAGE_NOCACHE;
15}
3#else 16#else
4#include "fb_mm.h" 17static inline void fb_pgprotect(struct file *file, struct vm_area_struct *vma,
5#endif 18 unsigned long off)
19{
20 if (CPU_IS_020_OR_030)
21 pgprot_val(vma->vm_page_prot) |= _PAGE_NOCACHE030;
22 if (CPU_IS_040_OR_060) {
23 pgprot_val(vma->vm_page_prot) &= _CACHEMASK040;
24 /* Use no-cache mode, serialized */
25 pgprot_val(vma->vm_page_prot) |= _PAGE_NOCACHE_S;
26 }
27}
28#endif /* CONFIG_SUN3 */
29#else
30#define fb_pgprotect(...) do {} while (0)
31#endif /* CONFIG_MMU */
32
33static inline int fb_is_primary_device(struct fb_info *info)
34{
35 return 0;
36}
37
38#endif /* _ASM_FB_H_ */
diff --git a/arch/m68k/include/asm/fb_mm.h b/arch/m68k/include/asm/fb_mm.h
deleted file mode 100644
index 380b97ae8157..000000000000
--- a/arch/m68k/include/asm/fb_mm.h
+++ /dev/null
@@ -1,34 +0,0 @@
1#ifndef _ASM_FB_H_
2#define _ASM_FB_H_
3
4#include <linux/fb.h>
5#include <linux/fs.h>
6#include <asm/page.h>
7#include <asm/setup.h>
8
9#ifdef CONFIG_SUN3
10static inline void fb_pgprotect(struct file *file, struct vm_area_struct *vma,
11 unsigned long off)
12{
13 pgprot_val(vma->vm_page_prot) |= SUN3_PAGE_NOCACHE;
14}
15#else
16static inline void fb_pgprotect(struct file *file, struct vm_area_struct *vma,
17 unsigned long off)
18{
19 if (CPU_IS_020_OR_030)
20 pgprot_val(vma->vm_page_prot) |= _PAGE_NOCACHE030;
21 if (CPU_IS_040_OR_060) {
22 pgprot_val(vma->vm_page_prot) &= _CACHEMASK040;
23 /* Use no-cache mode, serialized */
24 pgprot_val(vma->vm_page_prot) |= _PAGE_NOCACHE_S;
25 }
26}
27#endif /* CONFIG_SUN3 */
28
29static inline int fb_is_primary_device(struct fb_info *info)
30{
31 return 0;
32}
33
34#endif /* _ASM_FB_H_ */
diff --git a/arch/m68k/include/asm/fb_no.h b/arch/m68k/include/asm/fb_no.h
deleted file mode 100644
index c7df38030992..000000000000
--- a/arch/m68k/include/asm/fb_no.h
+++ /dev/null
@@ -1,12 +0,0 @@
1#ifndef _ASM_FB_H_
2#define _ASM_FB_H_
3#include <linux/fb.h>
4
5#define fb_pgprotect(...) do {} while (0)
6
7static inline int fb_is_primary_device(struct fb_info *info)
8{
9 return 0;
10}
11
12#endif /* _ASM_FB_H_ */
diff --git a/arch/m68k/include/asm/fpu.h b/arch/m68k/include/asm/fpu.h
index e19bc5ed9c37..ffb6b8cfc6d5 100644
--- a/arch/m68k/include/asm/fpu.h
+++ b/arch/m68k/include/asm/fpu.h
@@ -1,5 +1,21 @@
1#ifdef __uClinux__ 1#ifndef __M68K_FPU_H
2#include "fpu_no.h" 2#define __M68K_FPU_H
3
4
5/*
6 * MAX floating point unit state size (FSAVE/FRESTORE)
7 */
8
9#if defined(CONFIG_M68020) || defined(CONFIG_M68030)
10#define FPSTATESIZE (216)
11#elif defined(CONFIG_M68040)
12#define FPSTATESIZE (96)
13#elif defined(CONFIG_M68KFPU_EMU)
14#define FPSTATESIZE (28)
15#elif defined(CONFIG_M68060)
16#define FPSTATESIZE (12)
3#else 17#else
4#include "fpu_mm.h" 18#define FPSTATESIZE (0)
5#endif 19#endif
20
21#endif /* __M68K_FPU_H */
diff --git a/arch/m68k/include/asm/fpu_mm.h b/arch/m68k/include/asm/fpu_mm.h
deleted file mode 100644
index ffb6b8cfc6d5..000000000000
--- a/arch/m68k/include/asm/fpu_mm.h
+++ /dev/null
@@ -1,21 +0,0 @@
1#ifndef __M68K_FPU_H
2#define __M68K_FPU_H
3
4
5/*
6 * MAX floating point unit state size (FSAVE/FRESTORE)
7 */
8
9#if defined(CONFIG_M68020) || defined(CONFIG_M68030)
10#define FPSTATESIZE (216)
11#elif defined(CONFIG_M68040)
12#define FPSTATESIZE (96)
13#elif defined(CONFIG_M68KFPU_EMU)
14#define FPSTATESIZE (28)
15#elif defined(CONFIG_M68060)
16#define FPSTATESIZE (12)
17#else
18#define FPSTATESIZE (0)
19#endif
20
21#endif /* __M68K_FPU_H */
diff --git a/arch/m68k/include/asm/fpu_no.h b/arch/m68k/include/asm/fpu_no.h
deleted file mode 100644
index b16b2e4fca2a..000000000000
--- a/arch/m68k/include/asm/fpu_no.h
+++ /dev/null
@@ -1,21 +0,0 @@
1#ifndef __M68KNOMMU_FPU_H
2#define __M68KNOMMU_FPU_H
3
4
5/*
6 * MAX floating point unit state size (FSAVE/FRESTORE)
7 */
8#if defined(CONFIG_M68020) || defined(CONFIG_M68030)
9#define FPSTATESIZE (216/sizeof(unsigned char))
10#elif defined(CONFIG_M68040)
11#define FPSTATESIZE (96/sizeof(unsigned char))
12#elif defined(CONFIG_M68KFPU_EMU)
13#define FPSTATESIZE (28/sizeof(unsigned char))
14#elif defined(CONFIG_M68060)
15#define FPSTATESIZE (12/sizeof(unsigned char))
16#else
17/* Assume no FP unit present then... */
18#define FPSTATESIZE (2) /* dummy size */
19#endif
20
21#endif /* __M68K_FPU_H */
diff --git a/arch/m68k/include/asm/hw_irq.h b/arch/m68k/include/asm/hw_irq.h
index e19526015890..eacef0951fbf 100644
--- a/arch/m68k/include/asm/hw_irq.h
+++ b/arch/m68k/include/asm/hw_irq.h
@@ -1,5 +1,6 @@
1#ifdef __uClinux__ 1#ifndef __ASM_M68K_HW_IRQ_H
2#include "hw_irq_no.h" 2#define __ASM_M68K_HW_IRQ_H
3#else 3
4#include "hw_irq_mm.h" 4/* Dummy include. */
5
5#endif 6#endif
diff --git a/arch/m68k/include/asm/hw_irq_mm.h b/arch/m68k/include/asm/hw_irq_mm.h
deleted file mode 100644
index eacef0951fbf..000000000000
--- a/arch/m68k/include/asm/hw_irq_mm.h
+++ /dev/null
@@ -1,6 +0,0 @@
1#ifndef __ASM_M68K_HW_IRQ_H
2#define __ASM_M68K_HW_IRQ_H
3
4/* Dummy include. */
5
6#endif
diff --git a/arch/m68k/include/asm/hw_irq_no.h b/arch/m68k/include/asm/hw_irq_no.h
deleted file mode 100644
index f3ec9e5ae049..000000000000
--- a/arch/m68k/include/asm/hw_irq_no.h
+++ /dev/null
@@ -1,4 +0,0 @@
1#ifndef __M68KNOMMU_HW_IRQ_H__
2#define __M68KNOMMU_HW_IRQ_H__
3
4#endif /* __M68KNOMMU_HW_IRQ_H__ */
diff --git a/arch/m68k/include/asm/kmap_types.h b/arch/m68k/include/asm/kmap_types.h
index 045d9fd122a2..c843c63d3801 100644
--- a/arch/m68k/include/asm/kmap_types.h
+++ b/arch/m68k/include/asm/kmap_types.h
@@ -1,5 +1,21 @@
1#ifdef __uClinux__ 1#ifndef __ASM_M68K_KMAP_TYPES_H
2#include "kmap_types_no.h" 2#define __ASM_M68K_KMAP_TYPES_H
3#else 3
4#include "kmap_types_mm.h" 4enum km_type {
5#endif 5 KM_BOUNCE_READ,
6 KM_SKB_SUNRPC_DATA,
7 KM_SKB_DATA_SOFTIRQ,
8 KM_USER0,
9 KM_USER1,
10 KM_BIO_SRC_IRQ,
11 KM_BIO_DST_IRQ,
12 KM_PTE0,
13 KM_PTE1,
14 KM_IRQ0,
15 KM_IRQ1,
16 KM_SOFTIRQ0,
17 KM_SOFTIRQ1,
18 KM_TYPE_NR
19};
20
21#endif /* __ASM_M68K_KMAP_TYPES_H */
diff --git a/arch/m68k/include/asm/kmap_types_mm.h b/arch/m68k/include/asm/kmap_types_mm.h
deleted file mode 100644
index c843c63d3801..000000000000
--- a/arch/m68k/include/asm/kmap_types_mm.h
+++ /dev/null
@@ -1,21 +0,0 @@
1#ifndef __ASM_M68K_KMAP_TYPES_H
2#define __ASM_M68K_KMAP_TYPES_H
3
4enum km_type {
5 KM_BOUNCE_READ,
6 KM_SKB_SUNRPC_DATA,
7 KM_SKB_DATA_SOFTIRQ,
8 KM_USER0,
9 KM_USER1,
10 KM_BIO_SRC_IRQ,
11 KM_BIO_DST_IRQ,
12 KM_PTE0,
13 KM_PTE1,
14 KM_IRQ0,
15 KM_IRQ1,
16 KM_SOFTIRQ0,
17 KM_SOFTIRQ1,
18 KM_TYPE_NR
19};
20
21#endif /* __ASM_M68K_KMAP_TYPES_H */
diff --git a/arch/m68k/include/asm/kmap_types_no.h b/arch/m68k/include/asm/kmap_types_no.h
deleted file mode 100644
index bfb6707575d1..000000000000
--- a/arch/m68k/include/asm/kmap_types_no.h
+++ /dev/null
@@ -1,21 +0,0 @@
1#ifndef __ASM_M68K_KMAP_TYPES_H
2#define __ASM_M68K_KMAP_TYPES_H
3
4enum km_type {
5 KM_BOUNCE_READ,
6 KM_SKB_SUNRPC_DATA,
7 KM_SKB_DATA_SOFTIRQ,
8 KM_USER0,
9 KM_USER1,
10 KM_BIO_SRC_IRQ,
11 KM_BIO_DST_IRQ,
12 KM_PTE0,
13 KM_PTE1,
14 KM_IRQ0,
15 KM_IRQ1,
16 KM_SOFTIRQ0,
17 KM_SOFTIRQ1,
18 KM_TYPE_NR
19};
20
21#endif
diff --git a/arch/m68k/include/asm/m532xsim.h b/arch/m68k/include/asm/m532xsim.h
index 1835fd20a82c..ce603451b55e 100644
--- a/arch/m68k/include/asm/m532xsim.h
+++ b/arch/m68k/include/asm/m532xsim.h
@@ -16,6 +16,7 @@
16#define MCFINT_VECBASE 64 16#define MCFINT_VECBASE 64
17#define MCFINT_UART0 26 /* Interrupt number for UART0 */ 17#define MCFINT_UART0 26 /* Interrupt number for UART0 */
18#define MCFINT_UART1 27 /* Interrupt number for UART1 */ 18#define MCFINT_UART1 27 /* Interrupt number for UART1 */
19#define MCFINT_UART2 28 /* Interrupt number for UART2 */
19 20
20#define MCF_WTM_WCR MCF_REG16(0xFC098000) 21#define MCF_WTM_WCR MCF_REG16(0xFC098000)
21 22
diff --git a/arch/m68k/include/asm/mc146818rtc.h b/arch/m68k/include/asm/mc146818rtc.h
index fb90dcf78426..9f70a01f73dc 100644
--- a/arch/m68k/include/asm/mc146818rtc.h
+++ b/arch/m68k/include/asm/mc146818rtc.h
@@ -1,5 +1,26 @@
1#ifdef __uClinux__ 1/*
2#include "mc146818rtc_no.h" 2 * Machine dependent access functions for RTC registers.
3#else 3 */
4#include "mc146818rtc_mm.h" 4#ifndef _ASM_MC146818RTC_H
5#endif 5#define _ASM_MC146818RTC_H
6
7
8#ifdef CONFIG_ATARI
9/* RTC in Atari machines */
10
11#include <asm/atarihw.h>
12
13#define RTC_PORT(x) (TT_RTC_BAS + 2*(x))
14#define RTC_ALWAYS_BCD 0
15
16#define CMOS_READ(addr) ({ \
17atari_outb_p((addr),RTC_PORT(0)); \
18atari_inb_p(RTC_PORT(1)); \
19})
20#define CMOS_WRITE(val, addr) ({ \
21atari_outb_p((addr),RTC_PORT(0)); \
22atari_outb_p((val),RTC_PORT(1)); \
23})
24#endif /* CONFIG_ATARI */
25
26#endif /* _ASM_MC146818RTC_H */
diff --git a/arch/m68k/include/asm/mc146818rtc_mm.h b/arch/m68k/include/asm/mc146818rtc_mm.h
deleted file mode 100644
index 9f70a01f73dc..000000000000
--- a/arch/m68k/include/asm/mc146818rtc_mm.h
+++ /dev/null
@@ -1,26 +0,0 @@
1/*
2 * Machine dependent access functions for RTC registers.
3 */
4#ifndef _ASM_MC146818RTC_H
5#define _ASM_MC146818RTC_H
6
7
8#ifdef CONFIG_ATARI
9/* RTC in Atari machines */
10
11#include <asm/atarihw.h>
12
13#define RTC_PORT(x) (TT_RTC_BAS + 2*(x))
14#define RTC_ALWAYS_BCD 0
15
16#define CMOS_READ(addr) ({ \
17atari_outb_p((addr),RTC_PORT(0)); \
18atari_inb_p(RTC_PORT(1)); \
19})
20#define CMOS_WRITE(val, addr) ({ \
21atari_outb_p((addr),RTC_PORT(0)); \
22atari_outb_p((val),RTC_PORT(1)); \
23})
24#endif /* CONFIG_ATARI */
25
26#endif /* _ASM_MC146818RTC_H */
diff --git a/arch/m68k/include/asm/mc146818rtc_no.h b/arch/m68k/include/asm/mc146818rtc_no.h
deleted file mode 100644
index 907a0481a140..000000000000
--- a/arch/m68k/include/asm/mc146818rtc_no.h
+++ /dev/null
@@ -1,9 +0,0 @@
1/*
2 * Machine dependent access functions for RTC registers.
3 */
4#ifndef _M68KNOMMU_MC146818RTC_H
5#define _M68KNOMMU_MC146818RTC_H
6
7/* empty include file to satisfy the include in genrtc.c/ide-geometry.c */
8
9#endif /* _M68KNOMMU_MC146818RTC_H */
diff --git a/arch/m68k/include/asm/mcfpci.h b/arch/m68k/include/asm/mcfpci.h
deleted file mode 100644
index f1507dd06ec6..000000000000
--- a/arch/m68k/include/asm/mcfpci.h
+++ /dev/null
@@ -1,119 +0,0 @@
1/****************************************************************************/
2
3/*
4 * mcfpci.h -- PCI bridge on ColdFire eval boards.
5 *
6 * (C) Copyright 2000, Greg Ungerer (gerg@snapgear.com)
7 * (C) Copyright 2000, Lineo Inc. (www.lineo.com)
8 */
9
10/****************************************************************************/
11#ifndef mcfpci_h
12#define mcfpci_h
13/****************************************************************************/
14
15
16#ifdef CONFIG_PCI
17
18/*
19 * Address regions in the PCI address space are not mapped into the
20 * normal memory space of the ColdFire. They must be accessed via
21 * handler routines. This is easy for I/O space (inb/outb/etc) but
22 * needs some code changes to support ordinary memory. Interrupts
23 * also need to be vectored through the PCI handler first, then it
24 * will call the actual driver sub-handlers.
25 */
26
27/*
28 * Un-define all the standard I/O access routines.
29 */
30#undef inb
31#undef inw
32#undef inl
33#undef inb_p
34#undef inw_p
35#undef insb
36#undef insw
37#undef insl
38#undef outb
39#undef outw
40#undef outl
41#undef outb_p
42#undef outw_p
43#undef outsb
44#undef outsw
45#undef outsl
46
47#undef request_irq
48#undef free_irq
49
50#undef bus_to_virt
51#undef virt_to_bus
52
53
54/*
55 * Re-direct all I/O memory accesses functions to PCI specific ones.
56 */
57#define inb pci_inb
58#define inw pci_inw
59#define inl pci_inl
60#define inb_p pci_inb
61#define inw_p pci_inw
62#define insb pci_insb
63#define insw pci_insw
64#define insl pci_insl
65
66#define outb pci_outb
67#define outw pci_outw
68#define outl pci_outl
69#define outb_p pci_outb
70#define outw_p pci_outw
71#define outsb pci_outsb
72#define outsw pci_outsw
73#define outsl pci_outsl
74
75#define request_irq pci_request_irq
76#define free_irq pci_free_irq
77
78#define virt_to_bus pci_virt_to_bus
79#define bus_to_virt pci_bus_to_virt
80
81#define CONFIG_COMEMPCI 1
82
83
84/*
85 * Prototypes of the real PCI functions (defined in bios32.c).
86 */
87unsigned char pci_inb(unsigned int addr);
88unsigned short pci_inw(unsigned int addr);
89unsigned int pci_inl(unsigned int addr);
90void pci_insb(void *addr, void *buf, int len);
91void pci_insw(void *addr, void *buf, int len);
92void pci_insl(void *addr, void *buf, int len);
93
94void pci_outb(unsigned char val, unsigned int addr);
95void pci_outw(unsigned short val, unsigned int addr);
96void pci_outl(unsigned int val, unsigned int addr);
97void pci_outsb(void *addr, void *buf, int len);
98void pci_outsw(void *addr, void *buf, int len);
99void pci_outsl(void *addr, void *buf, int len);
100
101int pci_request_irq(unsigned int irq,
102 void (*handler)(int, void *, struct pt_regs *),
103 unsigned long flags,
104 const char *device,
105 void *dev_id);
106void pci_free_irq(unsigned int irq, void *dev_id);
107
108void *pci_bmalloc(int size);
109void pci_bmfree(void *bmp, int len);
110void pci_copytoshmem(unsigned long bmp, void *src, int size);
111void pci_copyfromshmem(void *dst, unsigned long bmp, int size);
112unsigned long pci_virt_to_bus(volatile void *address);
113void *pci_bus_to_virt(unsigned long address);
114void pci_bmcpyto(void *dst, void *src, int len);
115void pci_bmcpyfrom(void *dst, void *src, int len);
116
117#endif /* CONFIG_PCI */
118/****************************************************************************/
119#endif /* mcfpci_h */
diff --git a/arch/m68k/include/asm/mmu.h b/arch/m68k/include/asm/mmu.h
index a81d3946675f..8a11a63ee15a 100644
--- a/arch/m68k/include/asm/mmu.h
+++ b/arch/m68k/include/asm/mmu.h
@@ -1,5 +1,13 @@
1#ifdef __uClinux__ 1#ifndef __MMU_H
2#include "mmu_no.h" 2#define __MMU_H
3
4#ifdef CONFIG_MMU
5/* Default "unsigned long" context */
6typedef unsigned long mm_context_t;
3#else 7#else
4#include "mmu_mm.h" 8typedef struct {
9 unsigned long end_brk;
10} mm_context_t;
11#endif
12
5#endif 13#endif
diff --git a/arch/m68k/include/asm/mmu_context.h b/arch/m68k/include/asm/mmu_context.h
index b440928fc6c7..7d4341e55a99 100644
--- a/arch/m68k/include/asm/mmu_context.h
+++ b/arch/m68k/include/asm/mmu_context.h
@@ -1,5 +1,175 @@
1#ifdef __uClinux__ 1#ifndef __M68K_MMU_CONTEXT_H
2#include "mmu_context_no.h" 2#define __M68K_MMU_CONTEXT_H
3
4#include <asm-generic/mm_hooks.h>
5
6static inline void enter_lazy_tlb(struct mm_struct *mm, struct task_struct *tsk)
7{
8}
9
10#ifdef CONFIG_MMU
11#ifndef CONFIG_SUN3
12
13#include <asm/setup.h>
14#include <asm/page.h>
15#include <asm/pgalloc.h>
16
17static inline int init_new_context(struct task_struct *tsk,
18 struct mm_struct *mm)
19{
20 mm->context = virt_to_phys(mm->pgd);
21 return 0;
22}
23
24#define destroy_context(mm) do { } while(0)
25
26static inline void switch_mm_0230(struct mm_struct *mm)
27{
28 unsigned long crp[2] = {
29 0x80000000 | _PAGE_TABLE, mm->context
30 };
31 unsigned long tmp;
32
33 asm volatile (".chip 68030");
34
35 /* flush MC68030/MC68020 caches (they are virtually addressed) */
36 asm volatile (
37 "movec %%cacr,%0;"
38 "orw %1,%0; "
39 "movec %0,%%cacr"
40 : "=d" (tmp) : "di" (FLUSH_I_AND_D));
41
42 /* Switch the root pointer. For a 030-only kernel,
43 * avoid flushing the whole ATC, we only need to
44 * flush the user entries. The 68851 does this by
45 * itself. Avoid a runtime check here.
46 */
47 asm volatile (
48#ifdef CPU_M68030_ONLY
49 "pmovefd %0,%%crp; "
50 "pflush #0,#4"
3#else 51#else
4#include "mmu_context_mm.h" 52 "pmove %0,%%crp"
5#endif 53#endif
54 : : "m" (crp[0]));
55
56 asm volatile (".chip 68k");
57}
58
59static inline void switch_mm_0460(struct mm_struct *mm)
60{
61 asm volatile (".chip 68040");
62
63 /* flush address translation cache (user entries) */
64 asm volatile ("pflushan");
65
66 /* switch the root pointer */
67 asm volatile ("movec %0,%%urp" : : "r" (mm->context));
68
69 if (CPU_IS_060) {
70 unsigned long tmp;
71
72 /* clear user entries in the branch cache */
73 asm volatile (
74 "movec %%cacr,%0; "
75 "orl %1,%0; "
76 "movec %0,%%cacr"
77 : "=d" (tmp): "di" (0x00200000));
78 }
79
80 asm volatile (".chip 68k");
81}
82
83static inline void switch_mm(struct mm_struct *prev, struct mm_struct *next, struct task_struct *tsk)
84{
85 if (prev != next) {
86 if (CPU_IS_020_OR_030)
87 switch_mm_0230(next);
88 else
89 switch_mm_0460(next);
90 }
91}
92
93#define deactivate_mm(tsk,mm) do { } while (0)
94
95static inline void activate_mm(struct mm_struct *prev_mm,
96 struct mm_struct *next_mm)
97{
98 next_mm->context = virt_to_phys(next_mm->pgd);
99
100 if (CPU_IS_020_OR_030)
101 switch_mm_0230(next_mm);
102 else
103 switch_mm_0460(next_mm);
104}
105
106#else /* CONFIG_SUN3 */
107#include <asm/sun3mmu.h>
108#include <linux/sched.h>
109
110extern unsigned long get_free_context(struct mm_struct *mm);
111extern void clear_context(unsigned long context);
112
113/* set the context for a new task to unmapped */
114static inline int init_new_context(struct task_struct *tsk, struct mm_struct *mm)
115{
116 mm->context = SUN3_INVALID_CONTEXT;
117 return 0;
118}
119
120/* find the context given to this process, and if it hasn't already
121 got one, go get one for it. */
122static inline void get_mmu_context(struct mm_struct *mm)
123{
124 if(mm->context == SUN3_INVALID_CONTEXT)
125 mm->context = get_free_context(mm);
126}
127
128/* flush context if allocated... */
129static inline void destroy_context(struct mm_struct *mm)
130{
131 if(mm->context != SUN3_INVALID_CONTEXT)
132 clear_context(mm->context);
133}
134
135static inline void activate_context(struct mm_struct *mm)
136{
137 get_mmu_context(mm);
138 sun3_put_context(mm->context);
139}
140
141static inline void switch_mm(struct mm_struct *prev, struct mm_struct *next, struct task_struct *tsk)
142{
143 activate_context(tsk->mm);
144}
145
146#define deactivate_mm(tsk,mm) do { } while (0)
147
148static inline void activate_mm(struct mm_struct *prev_mm,
149 struct mm_struct *next_mm)
150{
151 activate_context(next_mm);
152}
153
154#endif
155#else /* !CONFIG_MMU */
156
157static inline int init_new_context(struct task_struct *tsk, struct mm_struct *mm)
158{
159 return 0;
160}
161
162
163static inline void switch_mm(struct mm_struct *prev, struct mm_struct *next, struct task_struct *tsk)
164{
165}
166
167#define destroy_context(mm) do { } while (0)
168#define deactivate_mm(tsk,mm) do { } while (0)
169
170static inline void activate_mm(struct mm_struct *prev_mm, struct mm_struct *next_mm)
171{
172}
173
174#endif /* CONFIG_MMU */
175#endif /* __M68K_MMU_CONTEXT_H */
diff --git a/arch/m68k/include/asm/mmu_context_mm.h b/arch/m68k/include/asm/mmu_context_mm.h
deleted file mode 100644
index 894dacbcee14..000000000000
--- a/arch/m68k/include/asm/mmu_context_mm.h
+++ /dev/null
@@ -1,154 +0,0 @@
1#ifndef __M68K_MMU_CONTEXT_H
2#define __M68K_MMU_CONTEXT_H
3
4#include <asm-generic/mm_hooks.h>
5
6static inline void enter_lazy_tlb(struct mm_struct *mm, struct task_struct *tsk)
7{
8}
9
10#ifndef CONFIG_SUN3
11
12#include <asm/setup.h>
13#include <asm/page.h>
14#include <asm/pgalloc.h>
15
16static inline int init_new_context(struct task_struct *tsk,
17 struct mm_struct *mm)
18{
19 mm->context = virt_to_phys(mm->pgd);
20 return 0;
21}
22
23#define destroy_context(mm) do { } while(0)
24
25static inline void switch_mm_0230(struct mm_struct *mm)
26{
27 unsigned long crp[2] = {
28 0x80000000 | _PAGE_TABLE, mm->context
29 };
30 unsigned long tmp;
31
32 asm volatile (".chip 68030");
33
34 /* flush MC68030/MC68020 caches (they are virtually addressed) */
35 asm volatile (
36 "movec %%cacr,%0;"
37 "orw %1,%0; "
38 "movec %0,%%cacr"
39 : "=d" (tmp) : "di" (FLUSH_I_AND_D));
40
41 /* Switch the root pointer. For a 030-only kernel,
42 * avoid flushing the whole ATC, we only need to
43 * flush the user entries. The 68851 does this by
44 * itself. Avoid a runtime check here.
45 */
46 asm volatile (
47#ifdef CPU_M68030_ONLY
48 "pmovefd %0,%%crp; "
49 "pflush #0,#4"
50#else
51 "pmove %0,%%crp"
52#endif
53 : : "m" (crp[0]));
54
55 asm volatile (".chip 68k");
56}
57
58static inline void switch_mm_0460(struct mm_struct *mm)
59{
60 asm volatile (".chip 68040");
61
62 /* flush address translation cache (user entries) */
63 asm volatile ("pflushan");
64
65 /* switch the root pointer */
66 asm volatile ("movec %0,%%urp" : : "r" (mm->context));
67
68 if (CPU_IS_060) {
69 unsigned long tmp;
70
71 /* clear user entries in the branch cache */
72 asm volatile (
73 "movec %%cacr,%0; "
74 "orl %1,%0; "
75 "movec %0,%%cacr"
76 : "=d" (tmp): "di" (0x00200000));
77 }
78
79 asm volatile (".chip 68k");
80}
81
82static inline void switch_mm(struct mm_struct *prev, struct mm_struct *next, struct task_struct *tsk)
83{
84 if (prev != next) {
85 if (CPU_IS_020_OR_030)
86 switch_mm_0230(next);
87 else
88 switch_mm_0460(next);
89 }
90}
91
92#define deactivate_mm(tsk,mm) do { } while (0)
93
94static inline void activate_mm(struct mm_struct *prev_mm,
95 struct mm_struct *next_mm)
96{
97 next_mm->context = virt_to_phys(next_mm->pgd);
98
99 if (CPU_IS_020_OR_030)
100 switch_mm_0230(next_mm);
101 else
102 switch_mm_0460(next_mm);
103}
104
105#else /* CONFIG_SUN3 */
106#include <asm/sun3mmu.h>
107#include <linux/sched.h>
108
109extern unsigned long get_free_context(struct mm_struct *mm);
110extern void clear_context(unsigned long context);
111
112/* set the context for a new task to unmapped */
113static inline int init_new_context(struct task_struct *tsk, struct mm_struct *mm)
114{
115 mm->context = SUN3_INVALID_CONTEXT;
116 return 0;
117}
118
119/* find the context given to this process, and if it hasn't already
120 got one, go get one for it. */
121static inline void get_mmu_context(struct mm_struct *mm)
122{
123 if(mm->context == SUN3_INVALID_CONTEXT)
124 mm->context = get_free_context(mm);
125}
126
127/* flush context if allocated... */
128static inline void destroy_context(struct mm_struct *mm)
129{
130 if(mm->context != SUN3_INVALID_CONTEXT)
131 clear_context(mm->context);
132}
133
134static inline void activate_context(struct mm_struct *mm)
135{
136 get_mmu_context(mm);
137 sun3_put_context(mm->context);
138}
139
140static inline void switch_mm(struct mm_struct *prev, struct mm_struct *next, struct task_struct *tsk)
141{
142 activate_context(tsk->mm);
143}
144
145#define deactivate_mm(tsk,mm) do { } while (0)
146
147static inline void activate_mm(struct mm_struct *prev_mm,
148 struct mm_struct *next_mm)
149{
150 activate_context(next_mm);
151}
152
153#endif
154#endif
diff --git a/arch/m68k/include/asm/mmu_context_no.h b/arch/m68k/include/asm/mmu_context_no.h
deleted file mode 100644
index 9ccee4278c97..000000000000
--- a/arch/m68k/include/asm/mmu_context_no.h
+++ /dev/null
@@ -1,33 +0,0 @@
1#ifndef __M68KNOMMU_MMU_CONTEXT_H
2#define __M68KNOMMU_MMU_CONTEXT_H
3
4#include <asm/setup.h>
5#include <asm/page.h>
6#include <asm/pgalloc.h>
7#include <asm-generic/mm_hooks.h>
8
9static inline void enter_lazy_tlb(struct mm_struct *mm, struct task_struct *tsk)
10{
11}
12
13static inline int
14init_new_context(struct task_struct *tsk, struct mm_struct *mm)
15{
16 // mm->context = virt_to_phys(mm->pgd);
17 return(0);
18}
19
20#define destroy_context(mm) do { } while(0)
21
22static inline void switch_mm(struct mm_struct *prev, struct mm_struct *next, struct task_struct *tsk)
23{
24}
25
26#define deactivate_mm(tsk,mm) do { } while (0)
27
28static inline void activate_mm(struct mm_struct *prev_mm,
29 struct mm_struct *next_mm)
30{
31}
32
33#endif
diff --git a/arch/m68k/include/asm/mmu_mm.h b/arch/m68k/include/asm/mmu_mm.h
deleted file mode 100644
index ccd36d26615a..000000000000
--- a/arch/m68k/include/asm/mmu_mm.h
+++ /dev/null
@@ -1,7 +0,0 @@
1#ifndef __MMU_H
2#define __MMU_H
3
4/* Default "unsigned long" context */
5typedef unsigned long mm_context_t;
6
7#endif
diff --git a/arch/m68k/include/asm/mmu_no.h b/arch/m68k/include/asm/mmu_no.h
deleted file mode 100644
index e2da1e6f09fe..000000000000
--- a/arch/m68k/include/asm/mmu_no.h
+++ /dev/null
@@ -1,10 +0,0 @@
1#ifndef __M68KNOMMU_MMU_H
2#define __M68KNOMMU_MMU_H
3
4/* Copyright (C) 2002, David McCullough <davidm@snapgear.com> */
5
6typedef struct {
7 unsigned long end_brk;
8} mm_context_t;
9
10#endif /* __M68KNOMMU_MMU_H */
diff --git a/arch/m68k/include/asm/module.h b/arch/m68k/include/asm/module.h
index 79b59d137dd0..5f21e11071bd 100644
--- a/arch/m68k/include/asm/module.h
+++ b/arch/m68k/include/asm/module.h
@@ -1,5 +1,48 @@
1#ifdef __uClinux__ 1#ifndef _ASM_M68K_MODULE_H
2#include "module_no.h" 2#define _ASM_M68K_MODULE_H
3
4#ifdef CONFIG_MMU
5
6struct mod_arch_specific {
7 struct m68k_fixup_info *fixup_start, *fixup_end;
8};
9
10#define MODULE_ARCH_INIT { \
11 .fixup_start = __start_fixup, \
12 .fixup_end = __stop_fixup, \
13}
14
15
16enum m68k_fixup_type {
17 m68k_fixup_memoffset,
18 m68k_fixup_vnode_shift,
19};
20
21struct m68k_fixup_info {
22 enum m68k_fixup_type type;
23 void *addr;
24};
25
26#define m68k_fixup(type, addr) \
27 " .section \".m68k_fixup\",\"aw\"\n" \
28 " .long " #type "," #addr "\n" \
29 " .previous\n"
30
31extern struct m68k_fixup_info __start_fixup[], __stop_fixup[];
32
33struct module;
34extern void module_fixup(struct module *mod, struct m68k_fixup_info *start,
35 struct m68k_fixup_info *end);
36
3#else 37#else
4#include "module_mm.h" 38
5#endif 39struct mod_arch_specific {
40};
41
42#endif /* CONFIG_MMU */
43
44#define Elf_Shdr Elf32_Shdr
45#define Elf_Sym Elf32_Sym
46#define Elf_Ehdr Elf32_Ehdr
47
48#endif /* _ASM_M68K_MODULE_H */
diff --git a/arch/m68k/include/asm/module_mm.h b/arch/m68k/include/asm/module_mm.h
deleted file mode 100644
index 382d20a6fc18..000000000000
--- a/arch/m68k/include/asm/module_mm.h
+++ /dev/null
@@ -1,39 +0,0 @@
1#ifndef _ASM_M68K_MODULE_H
2#define _ASM_M68K_MODULE_H
3
4struct mod_arch_specific {
5 struct m68k_fixup_info *fixup_start, *fixup_end;
6};
7
8#define MODULE_ARCH_INIT { \
9 .fixup_start = __start_fixup, \
10 .fixup_end = __stop_fixup, \
11}
12
13#define Elf_Shdr Elf32_Shdr
14#define Elf_Sym Elf32_Sym
15#define Elf_Ehdr Elf32_Ehdr
16
17
18enum m68k_fixup_type {
19 m68k_fixup_memoffset,
20 m68k_fixup_vnode_shift,
21};
22
23struct m68k_fixup_info {
24 enum m68k_fixup_type type;
25 void *addr;
26};
27
28#define m68k_fixup(type, addr) \
29 " .section \".m68k_fixup\",\"aw\"\n" \
30 " .long " #type "," #addr "\n" \
31 " .previous\n"
32
33extern struct m68k_fixup_info __start_fixup[], __stop_fixup[];
34
35struct module;
36extern void module_fixup(struct module *mod, struct m68k_fixup_info *start,
37 struct m68k_fixup_info *end);
38
39#endif /* _ASM_M68K_MODULE_H */
diff --git a/arch/m68k/include/asm/module_no.h b/arch/m68k/include/asm/module_no.h
deleted file mode 100644
index 2e45ab50b232..000000000000
--- a/arch/m68k/include/asm/module_no.h
+++ /dev/null
@@ -1,11 +0,0 @@
1#ifndef ASM_M68KNOMMU_MODULE_H
2#define ASM_M68KNOMMU_MODULE_H
3
4struct mod_arch_specific {
5};
6
7#define Elf_Shdr Elf32_Shdr
8#define Elf_Sym Elf32_Sym
9#define Elf_Ehdr Elf32_Ehdr
10
11#endif /* ASM_M68KNOMMU_MODULE_H */
diff --git a/arch/m68k/include/asm/page_offset.h b/arch/m68k/include/asm/page_offset.h
index 66455c849fbb..1780152d81da 100644
--- a/arch/m68k/include/asm/page_offset.h
+++ b/arch/m68k/include/asm/page_offset.h
@@ -1,5 +1,11 @@
1#ifdef __uClinux__ 1/* This handles the memory map.. */
2#include "page_offset_no.h" 2
3#ifdef CONFIG_MMU
4#ifndef CONFIG_SUN3
5#define PAGE_OFFSET_RAW 0x00000000
3#else 6#else
4#include "page_offset_mm.h" 7#define PAGE_OFFSET_RAW 0x0E000000
8#endif
9#else
10#define PAGE_OFFSET_RAW CONFIG_RAMBASE
5#endif 11#endif
diff --git a/arch/m68k/include/asm/page_offset_mm.h b/arch/m68k/include/asm/page_offset_mm.h
deleted file mode 100644
index 1cbdb7f30ac2..000000000000
--- a/arch/m68k/include/asm/page_offset_mm.h
+++ /dev/null
@@ -1,8 +0,0 @@
1
2/* This handles the memory map.. */
3#ifndef CONFIG_SUN3
4#define PAGE_OFFSET_RAW 0x00000000
5#else
6#define PAGE_OFFSET_RAW 0x0E000000
7#endif
8
diff --git a/arch/m68k/include/asm/page_offset_no.h b/arch/m68k/include/asm/page_offset_no.h
deleted file mode 100644
index d4e73e0ba646..000000000000
--- a/arch/m68k/include/asm/page_offset_no.h
+++ /dev/null
@@ -1,5 +0,0 @@
1
2
3/* This handles the memory map.. */
4#define PAGE_OFFSET_RAW CONFIG_RAMBASE
5
diff --git a/arch/m68k/include/asm/pci.h b/arch/m68k/include/asm/pci.h
index dbea95373080..4ad0aea48ab4 100644
--- a/arch/m68k/include/asm/pci.h
+++ b/arch/m68k/include/asm/pci.h
@@ -1,5 +1,12 @@
1#ifdef __uClinux__ 1#ifndef _ASM_M68K_PCI_H
2#include "pci_no.h" 2#define _ASM_M68K_PCI_H
3#else 3
4#include "pci_mm.h" 4#include <asm-generic/pci-dma-compat.h>
5#endif 5
6/* The PCI address space does equal the physical memory
7 * address space. The networking and block device layers use
8 * this boolean for bounce buffer decisions.
9 */
10#define PCI_DMA_BUS_IS_PHYS (1)
11
12#endif /* _ASM_M68K_PCI_H */
diff --git a/arch/m68k/include/asm/pci_mm.h b/arch/m68k/include/asm/pci_mm.h
deleted file mode 100644
index 4ad0aea48ab4..000000000000
--- a/arch/m68k/include/asm/pci_mm.h
+++ /dev/null
@@ -1,12 +0,0 @@
1#ifndef _ASM_M68K_PCI_H
2#define _ASM_M68K_PCI_H
3
4#include <asm-generic/pci-dma-compat.h>
5
6/* The PCI address space does equal the physical memory
7 * address space. The networking and block device layers use
8 * this boolean for bounce buffer decisions.
9 */
10#define PCI_DMA_BUS_IS_PHYS (1)
11
12#endif /* _ASM_M68K_PCI_H */
diff --git a/arch/m68k/include/asm/pci_no.h b/arch/m68k/include/asm/pci_no.h
deleted file mode 100644
index 9abbc03c73ee..000000000000
--- a/arch/m68k/include/asm/pci_no.h
+++ /dev/null
@@ -1,29 +0,0 @@
1#ifndef M68KNOMMU_PCI_H
2#define M68KNOMMU_PCI_H
3
4#include <asm/pci_mm.h>
5
6#ifdef CONFIG_COMEMPCI
7/*
8 * These are pretty much arbitary with the CoMEM implementation.
9 * We have the whole address space to ourselves.
10 */
11#define PCIBIOS_MIN_IO 0x100
12#define PCIBIOS_MIN_MEM 0x00010000
13
14#define pcibios_scan_all_fns(a, b) 0
15
16/*
17 * Return whether the given PCI device DMA address mask can
18 * be supported properly. For example, if your device can
19 * only drive the low 24-bits during PCI bus mastering, then
20 * you would pass 0x00ffffff as the mask to this function.
21 */
22static inline int pci_dma_supported(struct pci_dev *hwdev, u64 mask)
23{
24 return 1;
25}
26
27#endif /* CONFIG_COMEMPCI */
28
29#endif /* M68KNOMMU_PCI_H */
diff --git a/arch/m68k/include/asm/pgalloc.h b/arch/m68k/include/asm/pgalloc.h
index 059cb73e78fc..c294aad8a900 100644
--- a/arch/m68k/include/asm/pgalloc.h
+++ b/arch/m68k/include/asm/pgalloc.h
@@ -1,5 +1,19 @@
1#ifdef __uClinux__ 1#ifndef M68K_PGALLOC_H
2#include "pgalloc_no.h" 2#define M68K_PGALLOC_H
3
4#include <linux/mm.h>
5#include <linux/highmem.h>
6#include <asm/setup.h>
7
8#ifdef CONFIG_MMU
9#include <asm/virtconvert.h>
10#ifdef CONFIG_SUN3
11#include <asm/sun3_pgalloc.h>
3#else 12#else
4#include "pgalloc_mm.h" 13#include <asm/motorola_pgalloc.h>
5#endif 14#endif
15
16extern void m68k_setup_node(int node);
17#endif
18
19#endif /* M68K_PGALLOC_H */
diff --git a/arch/m68k/include/asm/pgalloc_mm.h b/arch/m68k/include/asm/pgalloc_mm.h
deleted file mode 100644
index 4cb1a57ab763..000000000000
--- a/arch/m68k/include/asm/pgalloc_mm.h
+++ /dev/null
@@ -1,19 +0,0 @@
1
2#ifndef M68K_PGALLOC_H
3#define M68K_PGALLOC_H
4
5#include <linux/mm.h>
6#include <linux/highmem.h>
7#include <asm/setup.h>
8#include <asm/virtconvert.h>
9
10
11#ifdef CONFIG_SUN3
12#include <asm/sun3_pgalloc.h>
13#else
14#include <asm/motorola_pgalloc.h>
15#endif
16
17extern void m68k_setup_node(int node);
18
19#endif /* M68K_PGALLOC_H */
diff --git a/arch/m68k/include/asm/pgalloc_no.h b/arch/m68k/include/asm/pgalloc_no.h
deleted file mode 100644
index d6352f671ec0..000000000000
--- a/arch/m68k/include/asm/pgalloc_no.h
+++ /dev/null
@@ -1,8 +0,0 @@
1#ifndef _M68KNOMMU_PGALLOC_H
2#define _M68KNOMMU_PGALLOC_H
3
4#include <asm/setup.h>
5
6#define check_pgt_cache() do { } while (0)
7
8#endif /* _M68KNOMMU_PGALLOC_H */
diff --git a/arch/m68k/include/asm/pgtable_no.h b/arch/m68k/include/asm/pgtable_no.h
index 46251016e821..bf86b29fe64a 100644
--- a/arch/m68k/include/asm/pgtable_no.h
+++ b/arch/m68k/include/asm/pgtable_no.h
@@ -67,4 +67,6 @@ extern unsigned int kobjsize(const void *objp);
67 67
68#include <asm-generic/pgtable.h> 68#include <asm-generic/pgtable.h>
69 69
70#define check_pgt_cache() do { } while (0)
71
70#endif /* _M68KNOMMU_PGTABLE_H */ 72#endif /* _M68KNOMMU_PGTABLE_H */
diff --git a/arch/m68k/include/asm/rtc.h b/arch/m68k/include/asm/rtc.h
index 5d3e03859844..a4d08ea122ee 100644
--- a/arch/m68k/include/asm/rtc.h
+++ b/arch/m68k/include/asm/rtc.h
@@ -36,13 +36,16 @@ static inline unsigned int get_rtc_time(struct rtc_time *time)
36 * RTC has RTC_DAY_OF_WEEK, we ignore it, as it is only updated 36 * RTC has RTC_DAY_OF_WEEK, we ignore it, as it is only updated
37 * by the RTC when initially set to a non-zero value. 37 * by the RTC when initially set to a non-zero value.
38 */ 38 */
39 mach_hwclk(0, time); 39 if (mach_hwclk)
40 mach_hwclk(0, time);
40 return RTC_24H; 41 return RTC_24H;
41} 42}
42 43
43static inline int set_rtc_time(struct rtc_time *time) 44static inline int set_rtc_time(struct rtc_time *time)
44{ 45{
45 return mach_hwclk(1, time); 46 if (mach_hwclk)
47 return mach_hwclk(1, time);
48 return -EINVAL;
46} 49}
47 50
48static inline unsigned int get_rtc_ss(void) 51static inline unsigned int get_rtc_ss(void)
diff --git a/arch/m68k/include/asm/scatterlist.h b/arch/m68k/include/asm/scatterlist.h
index b7e528636252..e27ad902b1cf 100644
--- a/arch/m68k/include/asm/scatterlist.h
+++ b/arch/m68k/include/asm/scatterlist.h
@@ -1,5 +1,23 @@
1#ifdef __uClinux__ 1#ifndef _M68K_SCATTERLIST_H
2#include "scatterlist_no.h" 2#define _M68K_SCATTERLIST_H
3#else 3
4#include "scatterlist_mm.h" 4#include <linux/types.h>
5
6struct scatterlist {
7#ifdef CONFIG_DEBUG_SG
8 unsigned long sg_magic;
5#endif 9#endif
10 unsigned long page_link;
11 unsigned int offset;
12 unsigned int length;
13
14 dma_addr_t dma_address; /* A place to hang host-specific addresses at. */
15};
16
17/* This is bogus and should go away. */
18#define ISA_DMA_THRESHOLD (0x00ffffff)
19
20#define sg_dma_address(sg) ((sg)->dma_address)
21#define sg_dma_len(sg) ((sg)->length)
22
23#endif /* !(_M68K_SCATTERLIST_H) */
diff --git a/arch/m68k/include/asm/scatterlist_mm.h b/arch/m68k/include/asm/scatterlist_mm.h
deleted file mode 100644
index d3a7a0edfeca..000000000000
--- a/arch/m68k/include/asm/scatterlist_mm.h
+++ /dev/null
@@ -1,23 +0,0 @@
1#ifndef _M68K_SCATTERLIST_H
2#define _M68K_SCATTERLIST_H
3
4#include <linux/types.h>
5
6struct scatterlist {
7#ifdef CONFIG_DEBUG_SG
8 unsigned long sg_magic;
9#endif
10 unsigned long page_link;
11 unsigned int offset;
12 unsigned int length;
13
14 __u32 dma_address; /* A place to hang host-specific addresses at. */
15};
16
17/* This is bogus and should go away. */
18#define ISA_DMA_THRESHOLD (0x00ffffff)
19
20#define sg_dma_address(sg) ((sg)->dma_address)
21#define sg_dma_len(sg) ((sg)->length)
22
23#endif /* !(_M68K_SCATTERLIST_H) */
diff --git a/arch/m68k/include/asm/scatterlist_no.h b/arch/m68k/include/asm/scatterlist_no.h
deleted file mode 100644
index afc4788b0d2c..000000000000
--- a/arch/m68k/include/asm/scatterlist_no.h
+++ /dev/null
@@ -1,22 +0,0 @@
1#ifndef _M68KNOMMU_SCATTERLIST_H
2#define _M68KNOMMU_SCATTERLIST_H
3
4#include <linux/mm.h>
5#include <asm/types.h>
6
7struct scatterlist {
8#ifdef CONFIG_DEBUG_SG
9 unsigned long sg_magic;
10#endif
11 unsigned long page_link;
12 unsigned int offset;
13 dma_addr_t dma_address;
14 unsigned int length;
15};
16
17#define sg_dma_address(sg) ((sg)->dma_address)
18#define sg_dma_len(sg) ((sg)->length)
19
20#define ISA_DMA_THRESHOLD (0xffffffff)
21
22#endif /* !(_M68KNOMMU_SCATTERLIST_H) */
diff --git a/arch/m68k/include/asm/segment.h b/arch/m68k/include/asm/segment.h
index 82583bc004bd..ee959219fdfe 100644
--- a/arch/m68k/include/asm/segment.h
+++ b/arch/m68k/include/asm/segment.h
@@ -1,5 +1,63 @@
1#ifdef __uClinux__ 1#ifndef _M68K_SEGMENT_H
2#include "segment_no.h" 2#define _M68K_SEGMENT_H
3
4/* define constants */
5/* Address spaces (FC0-FC2) */
6#define USER_DATA (1)
7#ifndef __USER_DS
8#define __USER_DS (USER_DATA)
9#endif
10#define USER_PROGRAM (2)
11#define SUPER_DATA (5)
12#ifndef __KERNEL_DS
13#define __KERNEL_DS (SUPER_DATA)
14#endif
15#define SUPER_PROGRAM (6)
16#define CPU_SPACE (7)
17
18#ifndef __ASSEMBLY__
19
20typedef struct {
21 unsigned long seg;
22} mm_segment_t;
23
24#define MAKE_MM_SEG(s) ((mm_segment_t) { (s) })
25#define USER_DS MAKE_MM_SEG(__USER_DS)
26#define KERNEL_DS MAKE_MM_SEG(__KERNEL_DS)
27
28/*
29 * Get/set the SFC/DFC registers for MOVES instructions
30 */
31
32static inline mm_segment_t get_fs(void)
33{
34#ifdef CONFIG_MMU
35 mm_segment_t _v;
36 __asm__ ("movec %/dfc,%0":"=r" (_v.seg):);
37
38 return _v;
3#else 39#else
4#include "segment_mm.h" 40 return USER_DS;
41#endif
42}
43
44static inline mm_segment_t get_ds(void)
45{
46 /* return the supervisor data space code */
47 return KERNEL_DS;
48}
49
50static inline void set_fs(mm_segment_t val)
51{
52#ifdef CONFIG_MMU
53 __asm__ __volatile__ ("movec %0,%/sfc\n\t"
54 "movec %0,%/dfc\n\t"
55 : /* no outputs */ : "r" (val.seg) : "memory");
5#endif 56#endif
57}
58
59#define segment_eq(a,b) ((a).seg == (b).seg)
60
61#endif /* __ASSEMBLY__ */
62
63#endif /* _M68K_SEGMENT_H */
diff --git a/arch/m68k/include/asm/segment_mm.h b/arch/m68k/include/asm/segment_mm.h
deleted file mode 100644
index 7b0b2d3127f9..000000000000
--- a/arch/m68k/include/asm/segment_mm.h
+++ /dev/null
@@ -1,57 +0,0 @@
1#ifndef _M68K_SEGMENT_H
2#define _M68K_SEGMENT_H
3
4/* define constants */
5/* Address spaces (FC0-FC2) */
6#define USER_DATA (1)
7#ifndef __USER_DS
8#define __USER_DS (USER_DATA)
9#endif
10#define USER_PROGRAM (2)
11#define SUPER_DATA (5)
12#ifndef __KERNEL_DS
13#define __KERNEL_DS (SUPER_DATA)
14#endif
15#define SUPER_PROGRAM (6)
16#define CPU_SPACE (7)
17
18#ifndef __ASSEMBLY__
19
20typedef struct {
21 unsigned long seg;
22} mm_segment_t;
23
24#define MAKE_MM_SEG(s) ((mm_segment_t) { (s) })
25#define USER_DS MAKE_MM_SEG(__USER_DS)
26#define KERNEL_DS MAKE_MM_SEG(__KERNEL_DS)
27
28/*
29 * Get/set the SFC/DFC registers for MOVES instructions
30 */
31
32static inline mm_segment_t get_fs(void)
33{
34 mm_segment_t _v;
35 __asm__ ("movec %/dfc,%0":"=r" (_v.seg):);
36
37 return _v;
38}
39
40static inline mm_segment_t get_ds(void)
41{
42 /* return the supervisor data space code */
43 return KERNEL_DS;
44}
45
46static inline void set_fs(mm_segment_t val)
47{
48 __asm__ __volatile__ ("movec %0,%/sfc\n\t"
49 "movec %0,%/dfc\n\t"
50 : /* no outputs */ : "r" (val.seg) : "memory");
51}
52
53#define segment_eq(a,b) ((a).seg == (b).seg)
54
55#endif /* __ASSEMBLY__ */
56
57#endif /* _M68K_SEGMENT_H */
diff --git a/arch/m68k/include/asm/segment_no.h b/arch/m68k/include/asm/segment_no.h
deleted file mode 100644
index 42318ebec7ec..000000000000
--- a/arch/m68k/include/asm/segment_no.h
+++ /dev/null
@@ -1,51 +0,0 @@
1#ifndef _M68K_SEGMENT_H
2#define _M68K_SEGMENT_H
3
4/* define constants */
5/* Address spaces (FC0-FC2) */
6#define USER_DATA (1)
7#ifndef __USER_DS
8#define __USER_DS (USER_DATA)
9#endif
10#define USER_PROGRAM (2)
11#define SUPER_DATA (5)
12#ifndef __KERNEL_DS
13#define __KERNEL_DS (SUPER_DATA)
14#endif
15#define SUPER_PROGRAM (6)
16#define CPU_SPACE (7)
17
18#ifndef __ASSEMBLY__
19
20typedef struct {
21 unsigned long seg;
22} mm_segment_t;
23
24#define MAKE_MM_SEG(s) ((mm_segment_t) { (s) })
25#define USER_DS MAKE_MM_SEG(__USER_DS)
26#define KERNEL_DS MAKE_MM_SEG(__KERNEL_DS)
27
28/*
29 * Get/set the SFC/DFC registers for MOVES instructions
30 */
31
32static inline mm_segment_t get_fs(void)
33{
34 return USER_DS;
35}
36
37static inline mm_segment_t get_ds(void)
38{
39 /* return the supervisor data space code */
40 return KERNEL_DS;
41}
42
43static inline void set_fs(mm_segment_t val)
44{
45}
46
47#define segment_eq(a,b) ((a).seg == (b).seg)
48
49#endif /* __ASSEMBLY__ */
50
51#endif /* _M68K_SEGMENT_H */
diff --git a/arch/m68k/include/asm/timex.h b/arch/m68k/include/asm/timex.h
index 719762980578..b87f2f278f67 100644
--- a/arch/m68k/include/asm/timex.h
+++ b/arch/m68k/include/asm/timex.h
@@ -1,5 +1,18 @@
1#ifdef __uClinux__ 1/*
2#include "timex_no.h" 2 * linux/include/asm-m68k/timex.h
3#else 3 *
4#include "timex_mm.h" 4 * m68k architecture timex specifications
5 */
6#ifndef _ASMm68k_TIMEX_H
7#define _ASMm68k_TIMEX_H
8
9#define CLOCK_TICK_RATE 1193180 /* Underlying HZ */
10
11typedef unsigned long cycles_t;
12
13static inline cycles_t get_cycles(void)
14{
15 return 0;
16}
17
5#endif 18#endif
diff --git a/arch/m68k/include/asm/timex_mm.h b/arch/m68k/include/asm/timex_mm.h
deleted file mode 100644
index b87f2f278f67..000000000000
--- a/arch/m68k/include/asm/timex_mm.h
+++ /dev/null
@@ -1,18 +0,0 @@
1/*
2 * linux/include/asm-m68k/timex.h
3 *
4 * m68k architecture timex specifications
5 */
6#ifndef _ASMm68k_TIMEX_H
7#define _ASMm68k_TIMEX_H
8
9#define CLOCK_TICK_RATE 1193180 /* Underlying HZ */
10
11typedef unsigned long cycles_t;
12
13static inline cycles_t get_cycles(void)
14{
15 return 0;
16}
17
18#endif
diff --git a/arch/m68k/include/asm/timex_no.h b/arch/m68k/include/asm/timex_no.h
deleted file mode 100644
index 109050f3fe91..000000000000
--- a/arch/m68k/include/asm/timex_no.h
+++ /dev/null
@@ -1,23 +0,0 @@
1/*
2 * linux/include/asm-m68knommu/timex.h
3 *
4 * m68knommu architecture timex specifications
5 */
6#ifndef _ASM_M68KNOMMU_TIMEX_H
7#define _ASM_M68KNOMMU_TIMEX_H
8
9#ifdef CONFIG_COLDFIRE
10#include <asm/coldfire.h>
11#define CLOCK_TICK_RATE MCF_CLK
12#else
13#define CLOCK_TICK_RATE 1193180 /* Underlying HZ */
14#endif
15
16typedef unsigned long cycles_t;
17
18static inline cycles_t get_cycles(void)
19{
20 return 0;
21}
22
23#endif
diff --git a/arch/m68k/include/asm/tlbflush.h b/arch/m68k/include/asm/tlbflush.h
index b6f93b30951e..a6b4ed4fc90f 100644
--- a/arch/m68k/include/asm/tlbflush.h
+++ b/arch/m68k/include/asm/tlbflush.h
@@ -1,5 +1,267 @@
1#ifdef __uClinux__ 1#ifndef _M68K_TLBFLUSH_H
2#include "tlbflush_no.h" 2#define _M68K_TLBFLUSH_H
3
4#ifdef CONFIG_MMU
5#ifndef CONFIG_SUN3
6
7#include <asm/current.h>
8
9static inline void flush_tlb_kernel_page(void *addr)
10{
11 if (CPU_IS_040_OR_060) {
12 mm_segment_t old_fs = get_fs();
13 set_fs(KERNEL_DS);
14 __asm__ __volatile__(".chip 68040\n\t"
15 "pflush (%0)\n\t"
16 ".chip 68k"
17 : : "a" (addr));
18 set_fs(old_fs);
19 } else if (CPU_IS_020_OR_030)
20 __asm__ __volatile__("pflush #4,#4,(%0)" : : "a" (addr));
21}
22
23/*
24 * flush all user-space atc entries.
25 */
26static inline void __flush_tlb(void)
27{
28 if (CPU_IS_040_OR_060)
29 __asm__ __volatile__(".chip 68040\n\t"
30 "pflushan\n\t"
31 ".chip 68k");
32 else if (CPU_IS_020_OR_030)
33 __asm__ __volatile__("pflush #0,#4");
34}
35
36static inline void __flush_tlb040_one(unsigned long addr)
37{
38 __asm__ __volatile__(".chip 68040\n\t"
39 "pflush (%0)\n\t"
40 ".chip 68k"
41 : : "a" (addr));
42}
43
44static inline void __flush_tlb_one(unsigned long addr)
45{
46 if (CPU_IS_040_OR_060)
47 __flush_tlb040_one(addr);
48 else if (CPU_IS_020_OR_030)
49 __asm__ __volatile__("pflush #0,#4,(%0)" : : "a" (addr));
50}
51
52#define flush_tlb() __flush_tlb()
53
54/*
55 * flush all atc entries (both kernel and user-space entries).
56 */
57static inline void flush_tlb_all(void)
58{
59 if (CPU_IS_040_OR_060)
60 __asm__ __volatile__(".chip 68040\n\t"
61 "pflusha\n\t"
62 ".chip 68k");
63 else if (CPU_IS_020_OR_030)
64 __asm__ __volatile__("pflusha");
65}
66
67static inline void flush_tlb_mm(struct mm_struct *mm)
68{
69 if (mm == current->active_mm)
70 __flush_tlb();
71}
72
73static inline void flush_tlb_page(struct vm_area_struct *vma, unsigned long addr)
74{
75 if (vma->vm_mm == current->active_mm) {
76 mm_segment_t old_fs = get_fs();
77 set_fs(USER_DS);
78 __flush_tlb_one(addr);
79 set_fs(old_fs);
80 }
81}
82
83static inline void flush_tlb_range(struct vm_area_struct *vma,
84 unsigned long start, unsigned long end)
85{
86 if (vma->vm_mm == current->active_mm)
87 __flush_tlb();
88}
89
90static inline void flush_tlb_kernel_range(unsigned long start, unsigned long end)
91{
92 flush_tlb_all();
93}
94
3#else 95#else
4#include "tlbflush_mm.h" 96
97
98/* Reserved PMEGs. */
99extern char sun3_reserved_pmeg[SUN3_PMEGS_NUM];
100extern unsigned long pmeg_vaddr[SUN3_PMEGS_NUM];
101extern unsigned char pmeg_alloc[SUN3_PMEGS_NUM];
102extern unsigned char pmeg_ctx[SUN3_PMEGS_NUM];
103
104/* Flush all userspace mappings one by one... (why no flush command,
105 sun?) */
106static inline void flush_tlb_all(void)
107{
108 unsigned long addr;
109 unsigned char ctx, oldctx;
110
111 oldctx = sun3_get_context();
112 for(addr = 0x00000000; addr < TASK_SIZE; addr += SUN3_PMEG_SIZE) {
113 for(ctx = 0; ctx < 8; ctx++) {
114 sun3_put_context(ctx);
115 sun3_put_segmap(addr, SUN3_INVALID_PMEG);
116 }
117 }
118
119 sun3_put_context(oldctx);
120 /* erase all of the userspace pmeg maps, we've clobbered them
121 all anyway */
122 for(addr = 0; addr < SUN3_INVALID_PMEG; addr++) {
123 if(pmeg_alloc[addr] == 1) {
124 pmeg_alloc[addr] = 0;
125 pmeg_ctx[addr] = 0;
126 pmeg_vaddr[addr] = 0;
127 }
128 }
129
130}
131
132/* Clear user TLB entries within the context named in mm */
133static inline void flush_tlb_mm (struct mm_struct *mm)
134{
135 unsigned char oldctx;
136 unsigned char seg;
137 unsigned long i;
138
139 oldctx = sun3_get_context();
140 sun3_put_context(mm->context);
141
142 for(i = 0; i < TASK_SIZE; i += SUN3_PMEG_SIZE) {
143 seg = sun3_get_segmap(i);
144 if(seg == SUN3_INVALID_PMEG)
145 continue;
146
147 sun3_put_segmap(i, SUN3_INVALID_PMEG);
148 pmeg_alloc[seg] = 0;
149 pmeg_ctx[seg] = 0;
150 pmeg_vaddr[seg] = 0;
151 }
152
153 sun3_put_context(oldctx);
154
155}
156
157/* Flush a single TLB page. In this case, we're limited to flushing a
158 single PMEG */
159static inline void flush_tlb_page (struct vm_area_struct *vma,
160 unsigned long addr)
161{
162 unsigned char oldctx;
163 unsigned char i;
164
165 oldctx = sun3_get_context();
166 sun3_put_context(vma->vm_mm->context);
167 addr &= ~SUN3_PMEG_MASK;
168 if((i = sun3_get_segmap(addr)) != SUN3_INVALID_PMEG)
169 {
170 pmeg_alloc[i] = 0;
171 pmeg_ctx[i] = 0;
172 pmeg_vaddr[i] = 0;
173 sun3_put_segmap (addr, SUN3_INVALID_PMEG);
174 }
175 sun3_put_context(oldctx);
176
177}
178/* Flush a range of pages from TLB. */
179
180static inline void flush_tlb_range (struct vm_area_struct *vma,
181 unsigned long start, unsigned long end)
182{
183 struct mm_struct *mm = vma->vm_mm;
184 unsigned char seg, oldctx;
185
186 start &= ~SUN3_PMEG_MASK;
187
188 oldctx = sun3_get_context();
189 sun3_put_context(mm->context);
190
191 while(start < end)
192 {
193 if((seg = sun3_get_segmap(start)) == SUN3_INVALID_PMEG)
194 goto next;
195 if(pmeg_ctx[seg] == mm->context) {
196 pmeg_alloc[seg] = 0;
197 pmeg_ctx[seg] = 0;
198 pmeg_vaddr[seg] = 0;
199 }
200 sun3_put_segmap(start, SUN3_INVALID_PMEG);
201 next:
202 start += SUN3_PMEG_SIZE;
203 }
204}
205
206static inline void flush_tlb_kernel_range(unsigned long start, unsigned long end)
207{
208 flush_tlb_all();
209}
210
211/* Flush kernel page from TLB. */
212static inline void flush_tlb_kernel_page (unsigned long addr)
213{
214 sun3_put_segmap (addr & ~(SUN3_PMEG_SIZE - 1), SUN3_INVALID_PMEG);
215}
216
5#endif 217#endif
218
219#else /* !CONFIG_MMU */
220
221/*
222 * flush all user-space atc entries.
223 */
224static inline void __flush_tlb(void)
225{
226 BUG();
227}
228
229static inline void __flush_tlb_one(unsigned long addr)
230{
231 BUG();
232}
233
234#define flush_tlb() __flush_tlb()
235
236/*
237 * flush all atc entries (both kernel and user-space entries).
238 */
239static inline void flush_tlb_all(void)
240{
241 BUG();
242}
243
244static inline void flush_tlb_mm(struct mm_struct *mm)
245{
246 BUG();
247}
248
249static inline void flush_tlb_page(struct vm_area_struct *vma, unsigned long addr)
250{
251 BUG();
252}
253
254static inline void flush_tlb_range(struct mm_struct *mm,
255 unsigned long start, unsigned long end)
256{
257 BUG();
258}
259
260static inline void flush_tlb_kernel_page(unsigned long addr)
261{
262 BUG();
263}
264
265#endif /* CONFIG_MMU */
266
267#endif /* _M68K_TLBFLUSH_H */
diff --git a/arch/m68k/include/asm/tlbflush_mm.h b/arch/m68k/include/asm/tlbflush_mm.h
deleted file mode 100644
index acb6bf21a321..000000000000
--- a/arch/m68k/include/asm/tlbflush_mm.h
+++ /dev/null
@@ -1,219 +0,0 @@
1#ifndef _M68K_TLBFLUSH_H
2#define _M68K_TLBFLUSH_H
3
4
5#ifndef CONFIG_SUN3
6
7#include <asm/current.h>
8
9static inline void flush_tlb_kernel_page(void *addr)
10{
11 if (CPU_IS_040_OR_060) {
12 mm_segment_t old_fs = get_fs();
13 set_fs(KERNEL_DS);
14 __asm__ __volatile__(".chip 68040\n\t"
15 "pflush (%0)\n\t"
16 ".chip 68k"
17 : : "a" (addr));
18 set_fs(old_fs);
19 } else if (CPU_IS_020_OR_030)
20 __asm__ __volatile__("pflush #4,#4,(%0)" : : "a" (addr));
21}
22
23/*
24 * flush all user-space atc entries.
25 */
26static inline void __flush_tlb(void)
27{
28 if (CPU_IS_040_OR_060)
29 __asm__ __volatile__(".chip 68040\n\t"
30 "pflushan\n\t"
31 ".chip 68k");
32 else if (CPU_IS_020_OR_030)
33 __asm__ __volatile__("pflush #0,#4");
34}
35
36static inline void __flush_tlb040_one(unsigned long addr)
37{
38 __asm__ __volatile__(".chip 68040\n\t"
39 "pflush (%0)\n\t"
40 ".chip 68k"
41 : : "a" (addr));
42}
43
44static inline void __flush_tlb_one(unsigned long addr)
45{
46 if (CPU_IS_040_OR_060)
47 __flush_tlb040_one(addr);
48 else if (CPU_IS_020_OR_030)
49 __asm__ __volatile__("pflush #0,#4,(%0)" : : "a" (addr));
50}
51
52#define flush_tlb() __flush_tlb()
53
54/*
55 * flush all atc entries (both kernel and user-space entries).
56 */
57static inline void flush_tlb_all(void)
58{
59 if (CPU_IS_040_OR_060)
60 __asm__ __volatile__(".chip 68040\n\t"
61 "pflusha\n\t"
62 ".chip 68k");
63 else if (CPU_IS_020_OR_030)
64 __asm__ __volatile__("pflusha");
65}
66
67static inline void flush_tlb_mm(struct mm_struct *mm)
68{
69 if (mm == current->active_mm)
70 __flush_tlb();
71}
72
73static inline void flush_tlb_page(struct vm_area_struct *vma, unsigned long addr)
74{
75 if (vma->vm_mm == current->active_mm) {
76 mm_segment_t old_fs = get_fs();
77 set_fs(USER_DS);
78 __flush_tlb_one(addr);
79 set_fs(old_fs);
80 }
81}
82
83static inline void flush_tlb_range(struct vm_area_struct *vma,
84 unsigned long start, unsigned long end)
85{
86 if (vma->vm_mm == current->active_mm)
87 __flush_tlb();
88}
89
90static inline void flush_tlb_kernel_range(unsigned long start, unsigned long end)
91{
92 flush_tlb_all();
93}
94
95#else
96
97
98/* Reserved PMEGs. */
99extern char sun3_reserved_pmeg[SUN3_PMEGS_NUM];
100extern unsigned long pmeg_vaddr[SUN3_PMEGS_NUM];
101extern unsigned char pmeg_alloc[SUN3_PMEGS_NUM];
102extern unsigned char pmeg_ctx[SUN3_PMEGS_NUM];
103
104/* Flush all userspace mappings one by one... (why no flush command,
105 sun?) */
106static inline void flush_tlb_all(void)
107{
108 unsigned long addr;
109 unsigned char ctx, oldctx;
110
111 oldctx = sun3_get_context();
112 for(addr = 0x00000000; addr < TASK_SIZE; addr += SUN3_PMEG_SIZE) {
113 for(ctx = 0; ctx < 8; ctx++) {
114 sun3_put_context(ctx);
115 sun3_put_segmap(addr, SUN3_INVALID_PMEG);
116 }
117 }
118
119 sun3_put_context(oldctx);
120 /* erase all of the userspace pmeg maps, we've clobbered them
121 all anyway */
122 for(addr = 0; addr < SUN3_INVALID_PMEG; addr++) {
123 if(pmeg_alloc[addr] == 1) {
124 pmeg_alloc[addr] = 0;
125 pmeg_ctx[addr] = 0;
126 pmeg_vaddr[addr] = 0;
127 }
128 }
129
130}
131
132/* Clear user TLB entries within the context named in mm */
133static inline void flush_tlb_mm (struct mm_struct *mm)
134{
135 unsigned char oldctx;
136 unsigned char seg;
137 unsigned long i;
138
139 oldctx = sun3_get_context();
140 sun3_put_context(mm->context);
141
142 for(i = 0; i < TASK_SIZE; i += SUN3_PMEG_SIZE) {
143 seg = sun3_get_segmap(i);
144 if(seg == SUN3_INVALID_PMEG)
145 continue;
146
147 sun3_put_segmap(i, SUN3_INVALID_PMEG);
148 pmeg_alloc[seg] = 0;
149 pmeg_ctx[seg] = 0;
150 pmeg_vaddr[seg] = 0;
151 }
152
153 sun3_put_context(oldctx);
154
155}
156
157/* Flush a single TLB page. In this case, we're limited to flushing a
158 single PMEG */
159static inline void flush_tlb_page (struct vm_area_struct *vma,
160 unsigned long addr)
161{
162 unsigned char oldctx;
163 unsigned char i;
164
165 oldctx = sun3_get_context();
166 sun3_put_context(vma->vm_mm->context);
167 addr &= ~SUN3_PMEG_MASK;
168 if((i = sun3_get_segmap(addr)) != SUN3_INVALID_PMEG)
169 {
170 pmeg_alloc[i] = 0;
171 pmeg_ctx[i] = 0;
172 pmeg_vaddr[i] = 0;
173 sun3_put_segmap (addr, SUN3_INVALID_PMEG);
174 }
175 sun3_put_context(oldctx);
176
177}
178/* Flush a range of pages from TLB. */
179
180static inline void flush_tlb_range (struct vm_area_struct *vma,
181 unsigned long start, unsigned long end)
182{
183 struct mm_struct *mm = vma->vm_mm;
184 unsigned char seg, oldctx;
185
186 start &= ~SUN3_PMEG_MASK;
187
188 oldctx = sun3_get_context();
189 sun3_put_context(mm->context);
190
191 while(start < end)
192 {
193 if((seg = sun3_get_segmap(start)) == SUN3_INVALID_PMEG)
194 goto next;
195 if(pmeg_ctx[seg] == mm->context) {
196 pmeg_alloc[seg] = 0;
197 pmeg_ctx[seg] = 0;
198 pmeg_vaddr[seg] = 0;
199 }
200 sun3_put_segmap(start, SUN3_INVALID_PMEG);
201 next:
202 start += SUN3_PMEG_SIZE;
203 }
204}
205
206static inline void flush_tlb_kernel_range(unsigned long start, unsigned long end)
207{
208 flush_tlb_all();
209}
210
211/* Flush kernel page from TLB. */
212static inline void flush_tlb_kernel_page (unsigned long addr)
213{
214 sun3_put_segmap (addr & ~(SUN3_PMEG_SIZE - 1), SUN3_INVALID_PMEG);
215}
216
217#endif
218
219#endif /* _M68K_TLBFLUSH_H */
diff --git a/arch/m68k/include/asm/tlbflush_no.h b/arch/m68k/include/asm/tlbflush_no.h
deleted file mode 100644
index a470cfb803eb..000000000000
--- a/arch/m68k/include/asm/tlbflush_no.h
+++ /dev/null
@@ -1,55 +0,0 @@
1#ifndef _M68KNOMMU_TLBFLUSH_H
2#define _M68KNOMMU_TLBFLUSH_H
3
4/*
5 * Copyright (C) 2000 Lineo, David McCullough <davidm@uclinux.org>
6 * Copyright (C) 2000-2002, Greg Ungerer <gerg@snapgear.com>
7 */
8
9#include <asm/setup.h>
10
11/*
12 * flush all user-space atc entries.
13 */
14static inline void __flush_tlb(void)
15{
16 BUG();
17}
18
19static inline void __flush_tlb_one(unsigned long addr)
20{
21 BUG();
22}
23
24#define flush_tlb() __flush_tlb()
25
26/*
27 * flush all atc entries (both kernel and user-space entries).
28 */
29static inline void flush_tlb_all(void)
30{
31 BUG();
32}
33
34static inline void flush_tlb_mm(struct mm_struct *mm)
35{
36 BUG();
37}
38
39static inline void flush_tlb_page(struct vm_area_struct *vma, unsigned long addr)
40{
41 BUG();
42}
43
44static inline void flush_tlb_range(struct mm_struct *mm,
45 unsigned long start, unsigned long end)
46{
47 BUG();
48}
49
50static inline void flush_tlb_kernel_page(unsigned long addr)
51{
52 BUG();
53}
54
55#endif /* _M68KNOMMU_TLBFLUSH_H */
diff --git a/arch/m68k/include/asm/ucontext.h b/arch/m68k/include/asm/ucontext.h
index b53cd160c0b3..e4e22669edc0 100644
--- a/arch/m68k/include/asm/ucontext.h
+++ b/arch/m68k/include/asm/ucontext.h
@@ -1,5 +1,30 @@
1#ifdef __uClinux__ 1#ifndef _M68K_UCONTEXT_H
2#include "ucontext_no.h" 2#define _M68K_UCONTEXT_H
3#else 3
4#include "ucontext_mm.h" 4typedef int greg_t;
5#define NGREG 18
6typedef greg_t gregset_t[NGREG];
7
8typedef struct fpregset {
9 int f_fpcntl[3];
10 int f_fpregs[8*3];
11} fpregset_t;
12
13struct mcontext {
14 int version;
15 gregset_t gregs;
16 fpregset_t fpregs;
17};
18
19#define MCONTEXT_VERSION 2
20
21struct ucontext {
22 unsigned long uc_flags;
23 struct ucontext *uc_link;
24 stack_t uc_stack;
25 struct mcontext uc_mcontext;
26 unsigned long uc_filler[80];
27 sigset_t uc_sigmask; /* mask last for extensibility */
28};
29
5#endif 30#endif
diff --git a/arch/m68k/include/asm/ucontext_mm.h b/arch/m68k/include/asm/ucontext_mm.h
deleted file mode 100644
index e4e22669edc0..000000000000
--- a/arch/m68k/include/asm/ucontext_mm.h
+++ /dev/null
@@ -1,30 +0,0 @@
1#ifndef _M68K_UCONTEXT_H
2#define _M68K_UCONTEXT_H
3
4typedef int greg_t;
5#define NGREG 18
6typedef greg_t gregset_t[NGREG];
7
8typedef struct fpregset {
9 int f_fpcntl[3];
10 int f_fpregs[8*3];
11} fpregset_t;
12
13struct mcontext {
14 int version;
15 gregset_t gregs;
16 fpregset_t fpregs;
17};
18
19#define MCONTEXT_VERSION 2
20
21struct ucontext {
22 unsigned long uc_flags;
23 struct ucontext *uc_link;
24 stack_t uc_stack;
25 struct mcontext uc_mcontext;
26 unsigned long uc_filler[80];
27 sigset_t uc_sigmask; /* mask last for extensibility */
28};
29
30#endif
diff --git a/arch/m68k/include/asm/ucontext_no.h b/arch/m68k/include/asm/ucontext_no.h
deleted file mode 100644
index 713a27f901cd..000000000000
--- a/arch/m68k/include/asm/ucontext_no.h
+++ /dev/null
@@ -1,32 +0,0 @@
1#ifndef _M68KNOMMU_UCONTEXT_H
2#define _M68KNOMMU_UCONTEXT_H
3
4typedef int greg_t;
5#define NGREG 18
6typedef greg_t gregset_t[NGREG];
7
8typedef struct fpregset {
9 int f_pcr;
10 int f_psr;
11 int f_fpiaddr;
12 int f_fpregs[8][3];
13} fpregset_t;
14
15struct mcontext {
16 int version;
17 gregset_t gregs;
18 fpregset_t fpregs;
19};
20
21#define MCONTEXT_VERSION 2
22
23struct ucontext {
24 unsigned long uc_flags;
25 struct ucontext *uc_link;
26 stack_t uc_stack;
27 struct mcontext uc_mcontext;
28 unsigned long uc_filler[80];
29 sigset_t uc_sigmask; /* mask last for extensibility */
30};
31
32#endif
diff --git a/arch/m68k/include/asm/unaligned.h b/arch/m68k/include/asm/unaligned.h
index c640bba3bdf4..019caa740c21 100644
--- a/arch/m68k/include/asm/unaligned.h
+++ b/arch/m68k/include/asm/unaligned.h
@@ -1,5 +1,25 @@
1#ifdef __uClinux__ 1#ifndef _ASM_M68K_UNALIGNED_H
2#include "unaligned_no.h" 2#define _ASM_M68K_UNALIGNED_H
3
4
5#ifdef CONFIG_COLDFIRE
6#include <linux/unaligned/be_struct.h>
7#include <linux/unaligned/le_byteshift.h>
8#include <linux/unaligned/generic.h>
9
10#define get_unaligned __get_unaligned_be
11#define put_unaligned __put_unaligned_be
12
3#else 13#else
4#include "unaligned_mm.h" 14/*
15 * The m68k can do unaligned accesses itself.
16 */
17#include <linux/unaligned/access_ok.h>
18#include <linux/unaligned/generic.h>
19
20#define get_unaligned __get_unaligned_be
21#define put_unaligned __put_unaligned_be
22
5#endif 23#endif
24
25#endif /* _ASM_M68K_UNALIGNED_H */
diff --git a/arch/m68k/include/asm/unaligned_mm.h b/arch/m68k/include/asm/unaligned_mm.h
deleted file mode 100644
index 77698f2dc33c..000000000000
--- a/arch/m68k/include/asm/unaligned_mm.h
+++ /dev/null
@@ -1,13 +0,0 @@
1#ifndef _ASM_M68K_UNALIGNED_H
2#define _ASM_M68K_UNALIGNED_H
3
4/*
5 * The m68k can do unaligned accesses itself.
6 */
7#include <linux/unaligned/access_ok.h>
8#include <linux/unaligned/generic.h>
9
10#define get_unaligned __get_unaligned_be
11#define put_unaligned __put_unaligned_be
12
13#endif /* _ASM_M68K_UNALIGNED_H */
diff --git a/arch/m68k/include/asm/unaligned_no.h b/arch/m68k/include/asm/unaligned_no.h
deleted file mode 100644
index eb1ea4cb9a59..000000000000
--- a/arch/m68k/include/asm/unaligned_no.h
+++ /dev/null
@@ -1,25 +0,0 @@
1#ifndef _ASM_M68KNOMMU_UNALIGNED_H
2#define _ASM_M68KNOMMU_UNALIGNED_H
3
4
5#ifdef CONFIG_COLDFIRE
6#include <linux/unaligned/be_struct.h>
7#include <linux/unaligned/le_byteshift.h>
8#include <linux/unaligned/generic.h>
9
10#define get_unaligned __get_unaligned_be
11#define put_unaligned __put_unaligned_be
12
13#else
14/*
15 * The m68k can do unaligned accesses itself.
16 */
17#include <linux/unaligned/access_ok.h>
18#include <linux/unaligned/generic.h>
19
20#define get_unaligned __get_unaligned_be
21#define put_unaligned __put_unaligned_be
22
23#endif
24
25#endif /* _ASM_M68KNOMMU_UNALIGNED_H */
diff --git a/arch/m68k/kernel/process.c b/arch/m68k/kernel/process.c
index 632ce016014d..ec37fb56c127 100644
--- a/arch/m68k/kernel/process.c
+++ b/arch/m68k/kernel/process.c
@@ -233,7 +233,7 @@ asmlinkage int m68k_clone(struct pt_regs *regs)
233 parent_tidptr, child_tidptr); 233 parent_tidptr, child_tidptr);
234} 234}
235 235
236int copy_thread(int nr, unsigned long clone_flags, unsigned long usp, 236int copy_thread(unsigned long clone_flags, unsigned long usp,
237 unsigned long unused, 237 unsigned long unused,
238 struct task_struct * p, struct pt_regs * regs) 238 struct task_struct * p, struct pt_regs * regs)
239{ 239{
diff --git a/arch/m68k/kernel/time.c b/arch/m68k/kernel/time.c
index 7db41594d7b6..54d980795fc4 100644
--- a/arch/m68k/kernel/time.c
+++ b/arch/m68k/kernel/time.c
@@ -18,6 +18,7 @@
18#include <linux/string.h> 18#include <linux/string.h>
19#include <linux/mm.h> 19#include <linux/mm.h>
20#include <linux/rtc.h> 20#include <linux/rtc.h>
21#include <linux/platform_device.h>
21 22
22#include <asm/machdep.h> 23#include <asm/machdep.h>
23#include <asm/io.h> 24#include <asm/io.h>
@@ -159,3 +160,20 @@ int do_settimeofday(struct timespec *tv)
159} 160}
160 161
161EXPORT_SYMBOL(do_settimeofday); 162EXPORT_SYMBOL(do_settimeofday);
163
164
165static int __init rtc_init(void)
166{
167 struct platform_device *pdev;
168
169 if (!mach_hwclk)
170 return -ENODEV;
171
172 pdev = platform_device_register_simple("rtc-generic", -1, NULL, 0);
173 if (IS_ERR(pdev))
174 return PTR_ERR(pdev);
175
176 return 0;
177}
178
179module_init(rtc_init);
diff --git a/arch/m68knommu/Makefile b/arch/m68knommu/Makefile
index fd0fb303d885..ce404bc9ccbd 100644
--- a/arch/m68knommu/Makefile
+++ b/arch/m68knommu/Makefile
@@ -88,18 +88,18 @@ export PLATFORM BOARD MODEL CPUCLASS
88# 88#
89# Some CFLAG additions based on specific CPU type. 89# Some CFLAG additions based on specific CPU type.
90# 90#
91cflags-$(CONFIG_M5206) := -m5200 91cflags-$(CONFIG_M5206) := $(call cc-option,-mcpu=5206,-m5200)
92cflags-$(CONFIG_M5206e) := -m5200 92cflags-$(CONFIG_M5206e) := $(call cc-option,-m5206e,-m5200)
93cflags-$(CONFIG_M520x) := -m5307 93cflags-$(CONFIG_M520x) := $(call cc-option,-mcpu=5208,-m5200)
94cflags-$(CONFIG_M523x) := $(call cc-option,-mcpu=523x,-m5307) 94cflags-$(CONFIG_M523x) := $(call cc-option,-mcpu=523x,-m5307)
95cflags-$(CONFIG_M5249) := -m5200 95cflags-$(CONFIG_M5249) := $(call cc-option,-mcpu=5249,-m5200)
96cflags-$(CONFIG_M5271) := $(call cc-option,-mcpu=5271,-m5307) 96cflags-$(CONFIG_M5271) := $(call cc-option,-mcpu=5271,-m5307)
97cflags-$(CONFIG_M5272) := -m5307 97cflags-$(CONFIG_M5272) := $(call cc-option,-mcpu=5271,-m5200)
98cflags-$(CONFIG_M5275) := $(call cc-option,-mcpu=5275,-m5307) 98cflags-$(CONFIG_M5275) := $(call cc-option,-mcpu=5275,-m5307)
99cflags-$(CONFIG_M528x) := $(call cc-option,-m528x,-m5307) 99cflags-$(CONFIG_M528x) := $(call cc-option,-m528x,-m5307)
100cflags-$(CONFIG_M5307) := -m5307 100cflags-$(CONFIG_M5307) := $(call cc-option,-m5307,-m5200)
101cflags-$(CONFIG_M532x) := $(call cc-option,-mcpu=532x,-m5307) 101cflags-$(CONFIG_M532x) := $(call cc-option,-mcpu=532x,-m5307)
102cflags-$(CONFIG_M5407) := -m5200 102cflags-$(CONFIG_M5407) := $(call cc-option,-m5407,-m5200)
103cflags-$(CONFIG_M68328) := -m68000 103cflags-$(CONFIG_M68328) := -m68000
104cflags-$(CONFIG_M68EZ328) := -m68000 104cflags-$(CONFIG_M68EZ328) := -m68000
105cflags-$(CONFIG_M68VZ328) := -m68000 105cflags-$(CONFIG_M68VZ328) := -m68000
diff --git a/arch/m68knommu/kernel/dma.c b/arch/m68knommu/kernel/dma.c
index e10eafc52789..936125806638 100644
--- a/arch/m68knommu/kernel/dma.c
+++ b/arch/m68knommu/kernel/dma.c
@@ -9,10 +9,11 @@
9#include <linux/mm.h> 9#include <linux/mm.h>
10#include <linux/string.h> 10#include <linux/string.h>
11#include <linux/device.h> 11#include <linux/device.h>
12#include <linux/dma-mapping.h>
12#include <asm/io.h> 13#include <asm/io.h>
13 14
14void *dma_alloc_coherent(struct device *dev, size_t size, 15void *dma_alloc_coherent(struct device *dev, size_t size,
15 dma_addr_t *dma_handle, int gfp) 16 dma_addr_t *dma_handle, gfp_t gfp)
16{ 17{
17 void *ret; 18 void *ret;
18 /* ignore region specifiers */ 19 /* ignore region specifiers */
@@ -34,3 +35,8 @@ void dma_free_coherent(struct device *dev, size_t size,
34{ 35{
35 free_pages((unsigned long)vaddr, get_order(size)); 36 free_pages((unsigned long)vaddr, get_order(size));
36} 37}
38
39void dma_sync_single_for_cpu(struct device *dev, dma_addr_t handle, size_t size, enum dma_data_direction dir)
40{
41}
42
diff --git a/arch/m68knommu/kernel/irq.c b/arch/m68knommu/kernel/irq.c
index bba1bb48a21f..56e0f4c55a67 100644
--- a/arch/m68knommu/kernel/irq.c
+++ b/arch/m68knommu/kernel/irq.c
@@ -23,7 +23,7 @@ asmlinkage void do_IRQ(int irq, struct pt_regs *regs)
23 struct pt_regs *oldregs = set_irq_regs(regs); 23 struct pt_regs *oldregs = set_irq_regs(regs);
24 24
25 irq_enter(); 25 irq_enter();
26 __do_IRQ(irq); 26 generic_handle_irq(irq);
27 irq_exit(); 27 irq_exit();
28 28
29 set_irq_regs(oldregs); 29 set_irq_regs(oldregs);
diff --git a/arch/m68knommu/kernel/process.c b/arch/m68knommu/kernel/process.c
index 3f2d7745f31e..1e96c6eb6312 100644
--- a/arch/m68knommu/kernel/process.c
+++ b/arch/m68knommu/kernel/process.c
@@ -199,7 +199,7 @@ asmlinkage int m68k_clone(struct pt_regs *regs)
199 return do_fork(clone_flags, newsp, regs, 0, NULL, NULL); 199 return do_fork(clone_flags, newsp, regs, 0, NULL, NULL);
200} 200}
201 201
202int copy_thread(int nr, unsigned long clone_flags, 202int copy_thread(unsigned long clone_flags,
203 unsigned long usp, unsigned long topstk, 203 unsigned long usp, unsigned long topstk,
204 struct task_struct * p, struct pt_regs * regs) 204 struct task_struct * p, struct pt_regs * regs)
205{ 205{
diff --git a/arch/m68knommu/mm/init.c b/arch/m68knommu/mm/init.c
index 3bf249c53e41..7befc0c357e0 100644
--- a/arch/m68knommu/mm/init.c
+++ b/arch/m68knommu/mm/init.c
@@ -111,11 +111,7 @@ void __init paging_init(void)
111 { 111 {
112 unsigned long zones_size[MAX_NR_ZONES] = {0, }; 112 unsigned long zones_size[MAX_NR_ZONES] = {0, };
113 113
114 zones_size[ZONE_DMA] = 0 >> PAGE_SHIFT; 114 zones_size[ZONE_DMA] = (end_mem - PAGE_OFFSET) >> PAGE_SHIFT;
115 zones_size[ZONE_NORMAL] = (end_mem - PAGE_OFFSET) >> PAGE_SHIFT;
116#ifdef CONFIG_HIGHMEM
117 zones_size[ZONE_HIGHMEM] = 0;
118#endif
119 free_area_init(zones_size); 115 free_area_init(zones_size);
120 } 116 }
121} 117}
diff --git a/arch/m68knommu/platform/5249/config.c b/arch/m68knommu/platform/5249/config.c
index d299f7b8768a..9eab19d01eb1 100644
--- a/arch/m68knommu/platform/5249/config.c
+++ b/arch/m68knommu/platform/5249/config.c
@@ -32,7 +32,8 @@ static struct mcf_platform_uart m5249_uart_platform[] = {
32 { 32 {
33 .mapbase = MCF_MBAR + MCFUART_BASE2, 33 .mapbase = MCF_MBAR + MCFUART_BASE2,
34 .irq = 74, 34 .irq = 74,
35 } 35 },
36 { },
36}; 37};
37 38
38static struct platform_device m5249_uart = { 39static struct platform_device m5249_uart = {
@@ -50,12 +51,12 @@ static struct platform_device *m5249_devices[] __initdata = {
50static void __init m5249_uart_init_line(int line, int irq) 51static void __init m5249_uart_init_line(int line, int irq)
51{ 52{
52 if (line == 0) { 53 if (line == 0) {
53 writel(MCFSIM_ICR_LEVEL6 | MCFSIM_ICR_PRI1, MCF_MBAR + MCFSIM_UART1ICR); 54 writeb(MCFSIM_ICR_LEVEL6 | MCFSIM_ICR_PRI1, MCF_MBAR + MCFSIM_UART1ICR);
54 writeb(irq, MCFUART_BASE1 + MCFUART_UIVR); 55 writeb(irq, MCF_MBAR + MCFUART_BASE1 + MCFUART_UIVR);
55 mcf_setimr(mcf_getimr() & ~MCFSIM_IMR_UART1); 56 mcf_setimr(mcf_getimr() & ~MCFSIM_IMR_UART1);
56 } else if (line == 1) { 57 } else if (line == 1) {
57 writel(MCFSIM_ICR_LEVEL6 | MCFSIM_ICR_PRI2, MCF_MBAR + MCFSIM_UART2ICR); 58 writeb(MCFSIM_ICR_LEVEL6 | MCFSIM_ICR_PRI2, MCF_MBAR + MCFSIM_UART2ICR);
58 writeb(irq, MCFUART_BASE2 + MCFUART_UIVR); 59 writeb(irq, MCF_MBAR + MCFUART_BASE2 + MCFUART_UIVR);
59 mcf_setimr(mcf_getimr() & ~MCFSIM_IMR_UART2); 60 mcf_setimr(mcf_getimr() & ~MCFSIM_IMR_UART2);
60 } 61 }
61} 62}
diff --git a/arch/m68knommu/platform/5307/config.c b/arch/m68knommu/platform/5307/config.c
index 724faf05852a..44803bf70a6e 100644
--- a/arch/m68knommu/platform/5307/config.c
+++ b/arch/m68knommu/platform/5307/config.c
@@ -65,12 +65,12 @@ static struct platform_device *m5307_devices[] __initdata = {
65static void __init m5307_uart_init_line(int line, int irq) 65static void __init m5307_uart_init_line(int line, int irq)
66{ 66{
67 if (line == 0) { 67 if (line == 0) {
68 writel(MCFSIM_ICR_LEVEL6 | MCFSIM_ICR_PRI1, MCF_MBAR + MCFSIM_UART1ICR); 68 writeb(MCFSIM_ICR_LEVEL6 | MCFSIM_ICR_PRI1, MCF_MBAR + MCFSIM_UART1ICR);
69 writeb(irq, MCFUART_BASE1 + MCFUART_UIVR); 69 writeb(irq, MCF_MBAR + MCFUART_BASE1 + MCFUART_UIVR);
70 mcf_setimr(mcf_getimr() & ~MCFSIM_IMR_UART1); 70 mcf_setimr(mcf_getimr() & ~MCFSIM_IMR_UART1);
71 } else if (line == 1) { 71 } else if (line == 1) {
72 writel(MCFSIM_ICR_LEVEL6 | MCFSIM_ICR_PRI2, MCF_MBAR + MCFSIM_UART2ICR); 72 writeb(MCFSIM_ICR_LEVEL6 | MCFSIM_ICR_PRI2, MCF_MBAR + MCFSIM_UART2ICR);
73 writeb(irq, MCFUART_BASE2 + MCFUART_UIVR); 73 writeb(irq, MCF_MBAR + MCFUART_BASE2 + MCFUART_UIVR);
74 mcf_setimr(mcf_getimr() & ~MCFSIM_IMR_UART2); 74 mcf_setimr(mcf_getimr() & ~MCFSIM_IMR_UART2);
75 } 75 }
76} 76}
diff --git a/arch/m68knommu/platform/5407/config.c b/arch/m68knommu/platform/5407/config.c
index 648b8b778211..0ee8c1a200c8 100644
--- a/arch/m68knommu/platform/5407/config.c
+++ b/arch/m68knommu/platform/5407/config.c
@@ -56,12 +56,12 @@ static struct platform_device *m5407_devices[] __initdata = {
56static void __init m5407_uart_init_line(int line, int irq) 56static void __init m5407_uart_init_line(int line, int irq)
57{ 57{
58 if (line == 0) { 58 if (line == 0) {
59 writel(MCFSIM_ICR_LEVEL6 | MCFSIM_ICR_PRI1, MCF_MBAR + MCFSIM_UART1ICR); 59 writeb(MCFSIM_ICR_LEVEL6 | MCFSIM_ICR_PRI1, MCF_MBAR + MCFSIM_UART1ICR);
60 writeb(irq, MCFUART_BASE1 + MCFUART_UIVR); 60 writeb(irq, MCF_MBAR + MCFUART_BASE1 + MCFUART_UIVR);
61 mcf_setimr(mcf_getimr() & ~MCFSIM_IMR_UART1); 61 mcf_setimr(mcf_getimr() & ~MCFSIM_IMR_UART1);
62 } else if (line == 1) { 62 } else if (line == 1) {
63 writel(MCFSIM_ICR_LEVEL6 | MCFSIM_ICR_PRI2, MCF_MBAR + MCFSIM_UART2ICR); 63 writeb(MCFSIM_ICR_LEVEL6 | MCFSIM_ICR_PRI2, MCF_MBAR + MCFSIM_UART2ICR);
64 writeb(irq, MCFUART_BASE2 + MCFUART_UIVR); 64 writeb(irq, MCF_MBAR + MCFUART_BASE2 + MCFUART_UIVR);
65 mcf_setimr(mcf_getimr() & ~MCFSIM_IMR_UART2); 65 mcf_setimr(mcf_getimr() & ~MCFSIM_IMR_UART2);
66 } 66 }
67} 67}
diff --git a/arch/m68knommu/platform/coldfire/Makefile b/arch/m68knommu/platform/coldfire/Makefile
index 4f416a91a829..1bcb9372353f 100644
--- a/arch/m68knommu/platform/coldfire/Makefile
+++ b/arch/m68knommu/platform/coldfire/Makefile
@@ -14,7 +14,7 @@
14 14
15asflags-$(CONFIG_FULLDEBUG) := -DDEBUGGER_COMPATIBLE_CACHE=1 15asflags-$(CONFIG_FULLDEBUG) := -DDEBUGGER_COMPATIBLE_CACHE=1
16 16
17obj-$(CONFIG_COLDFIRE) += dma.o entry.o vectors.o 17obj-$(CONFIG_COLDFIRE) += clk.o dma.o entry.o vectors.o
18obj-$(CONFIG_M5206) += timers.o 18obj-$(CONFIG_M5206) += timers.o
19obj-$(CONFIG_M5206e) += timers.o 19obj-$(CONFIG_M5206e) += timers.o
20obj-$(CONFIG_M520x) += pit.o 20obj-$(CONFIG_M520x) += pit.o
diff --git a/arch/m68knommu/platform/coldfire/clk.c b/arch/m68knommu/platform/coldfire/clk.c
new file mode 100644
index 000000000000..7cdbf445b28f
--- /dev/null
+++ b/arch/m68knommu/platform/coldfire/clk.c
@@ -0,0 +1,40 @@
1/***************************************************************************/
2
3/*
4 * clk.c -- general ColdFire CPU kernel clk handling
5 *
6 * Copyright (C) 2009, Greg Ungerer (gerg@snapgear.com)
7 */
8
9/***************************************************************************/
10
11#include <linux/kernel.h>
12#include <linux/clk.h>
13#include <asm/coldfire.h>
14
15/***************************************************************************/
16
17struct clk *clk_get(struct device *dev, const char *id)
18{
19 return NULL;
20}
21
22int clk_enable(struct clk *clk)
23{
24 return 0;
25}
26
27void clk_disable(struct clk *clk)
28{
29}
30
31void clk_put(struct clk *clk)
32{
33}
34
35unsigned long clk_get_rate(struct clk *clk)
36{
37 return MCF_CLK;
38}
39
40/***************************************************************************/
diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
index dc787190430a..998e5db8cc0f 100644
--- a/arch/mips/Kconfig
+++ b/arch/mips/Kconfig
@@ -134,7 +134,7 @@ config MACH_JAZZ
134 help 134 help
135 This a family of machines based on the MIPS R4030 chipset which was 135 This a family of machines based on the MIPS R4030 chipset which was
136 used by several vendors to build RISC/os and Windows NT workstations. 136 used by several vendors to build RISC/os and Windows NT workstations.
137 Members include the Acer PICA, MIPS Magnum 4000, MIPS Millenium and 137 Members include the Acer PICA, MIPS Magnum 4000, MIPS Millennium and
138 Olivetti M700-10 workstations. 138 Olivetti M700-10 workstations.
139 139
140config LASAT 140config LASAT
diff --git a/arch/mips/include/asm/spinlock.h b/arch/mips/include/asm/spinlock.h
index 10e82441b496..5b60a09a0f08 100644
--- a/arch/mips/include/asm/spinlock.h
+++ b/arch/mips/include/asm/spinlock.h
@@ -480,6 +480,8 @@ static inline int __raw_write_trylock(raw_rwlock_t *rw)
480 return ret; 480 return ret;
481} 481}
482 482
483#define __raw_read_lock_flags(lock, flags) __raw_read_lock(lock)
484#define __raw_write_lock_flags(lock, flags) __raw_write_lock(lock)
483 485
484#define _raw_spin_relax(lock) cpu_relax() 486#define _raw_spin_relax(lock) cpu_relax()
485#define _raw_read_relax(lock) cpu_relax() 487#define _raw_read_relax(lock) cpu_relax()
diff --git a/arch/mips/include/asm/unistd.h b/arch/mips/include/asm/unistd.h
index a73e1531e151..40005010827c 100644
--- a/arch/mips/include/asm/unistd.h
+++ b/arch/mips/include/asm/unistd.h
@@ -350,16 +350,18 @@
350#define __NR_dup3 (__NR_Linux + 327) 350#define __NR_dup3 (__NR_Linux + 327)
351#define __NR_pipe2 (__NR_Linux + 328) 351#define __NR_pipe2 (__NR_Linux + 328)
352#define __NR_inotify_init1 (__NR_Linux + 329) 352#define __NR_inotify_init1 (__NR_Linux + 329)
353#define __NR_preadv (__NR_Linux + 330)
354#define __NR_pwritev (__NR_Linux + 331)
353 355
354/* 356/*
355 * Offset of the last Linux o32 flavoured syscall 357 * Offset of the last Linux o32 flavoured syscall
356 */ 358 */
357#define __NR_Linux_syscalls 329 359#define __NR_Linux_syscalls 331
358 360
359#endif /* _MIPS_SIM == _MIPS_SIM_ABI32 */ 361#endif /* _MIPS_SIM == _MIPS_SIM_ABI32 */
360 362
361#define __NR_O32_Linux 4000 363#define __NR_O32_Linux 4000
362#define __NR_O32_Linux_syscalls 329 364#define __NR_O32_Linux_syscalls 331
363 365
364#if _MIPS_SIM == _MIPS_SIM_ABI64 366#if _MIPS_SIM == _MIPS_SIM_ABI64
365 367
@@ -656,16 +658,18 @@
656#define __NR_dup3 (__NR_Linux + 286) 658#define __NR_dup3 (__NR_Linux + 286)
657#define __NR_pipe2 (__NR_Linux + 287) 659#define __NR_pipe2 (__NR_Linux + 287)
658#define __NR_inotify_init1 (__NR_Linux + 288) 660#define __NR_inotify_init1 (__NR_Linux + 288)
661#define __NR_preadv (__NR_Linux + 289)
662#define __NR_pwritev (__NR_Linux + 290)
659 663
660/* 664/*
661 * Offset of the last Linux 64-bit flavoured syscall 665 * Offset of the last Linux 64-bit flavoured syscall
662 */ 666 */
663#define __NR_Linux_syscalls 288 667#define __NR_Linux_syscalls 290
664 668
665#endif /* _MIPS_SIM == _MIPS_SIM_ABI64 */ 669#endif /* _MIPS_SIM == _MIPS_SIM_ABI64 */
666 670
667#define __NR_64_Linux 5000 671#define __NR_64_Linux 5000
668#define __NR_64_Linux_syscalls 288 672#define __NR_64_Linux_syscalls 290
669 673
670#if _MIPS_SIM == _MIPS_SIM_NABI32 674#if _MIPS_SIM == _MIPS_SIM_NABI32
671 675
@@ -966,16 +970,18 @@
966#define __NR_dup3 (__NR_Linux + 290) 970#define __NR_dup3 (__NR_Linux + 290)
967#define __NR_pipe2 (__NR_Linux + 291) 971#define __NR_pipe2 (__NR_Linux + 291)
968#define __NR_inotify_init1 (__NR_Linux + 292) 972#define __NR_inotify_init1 (__NR_Linux + 292)
973#define __NR_preadv (__NR_Linux + 293)
974#define __NR_pwritev (__NR_Linux + 294)
969 975
970/* 976/*
971 * Offset of the last N32 flavoured syscall 977 * Offset of the last N32 flavoured syscall
972 */ 978 */
973#define __NR_Linux_syscalls 292 979#define __NR_Linux_syscalls 294
974 980
975#endif /* _MIPS_SIM == _MIPS_SIM_NABI32 */ 981#endif /* _MIPS_SIM == _MIPS_SIM_NABI32 */
976 982
977#define __NR_N32_Linux 6000 983#define __NR_N32_Linux 6000
978#define __NR_N32_Linux_syscalls 292 984#define __NR_N32_Linux_syscalls 294
979 985
980#ifdef __KERNEL__ 986#ifdef __KERNEL__
981 987
diff --git a/arch/mips/kernel/process.c b/arch/mips/kernel/process.c
index ca2e4026ad20..1eaaa450e20c 100644
--- a/arch/mips/kernel/process.c
+++ b/arch/mips/kernel/process.c
@@ -99,7 +99,7 @@ void flush_thread(void)
99{ 99{
100} 100}
101 101
102int copy_thread(int nr, unsigned long clone_flags, unsigned long usp, 102int copy_thread(unsigned long clone_flags, unsigned long usp,
103 unsigned long unused, struct task_struct *p, struct pt_regs *regs) 103 unsigned long unused, struct task_struct *p, struct pt_regs *regs)
104{ 104{
105 struct thread_info *ti = task_thread_info(p); 105 struct thread_info *ti = task_thread_info(p);
diff --git a/arch/mips/kernel/scall32-o32.S b/arch/mips/kernel/scall32-o32.S
index 9ab70c3b5be6..0b31b9bda048 100644
--- a/arch/mips/kernel/scall32-o32.S
+++ b/arch/mips/kernel/scall32-o32.S
@@ -650,6 +650,8 @@ einval: li v0, -ENOSYS
650 sys sys_dup3 3 650 sys sys_dup3 3
651 sys sys_pipe2 2 651 sys sys_pipe2 2
652 sys sys_inotify_init1 1 652 sys sys_inotify_init1 1
653 sys sys_preadv 6 /* 4330 */
654 sys sys_pwritev 6
653 .endm 655 .endm
654 656
655 /* We pre-compute the number of _instruction_ bytes needed to 657 /* We pre-compute the number of _instruction_ bytes needed to
diff --git a/arch/mips/kernel/scall64-64.S b/arch/mips/kernel/scall64-64.S
index 9b4698667154..c647fd6e722f 100644
--- a/arch/mips/kernel/scall64-64.S
+++ b/arch/mips/kernel/scall64-64.S
@@ -487,4 +487,6 @@ sys_call_table:
487 PTR sys_dup3 487 PTR sys_dup3
488 PTR sys_pipe2 488 PTR sys_pipe2
489 PTR sys_inotify_init1 489 PTR sys_inotify_init1
490 PTR sys_preadv
491 PTR sys_pwritev /* 5390 */
490 .size sys_call_table,.-sys_call_table 492 .size sys_call_table,.-sys_call_table
diff --git a/arch/mips/kernel/scall64-n32.S b/arch/mips/kernel/scall64-n32.S
index f61d6b0e5731..c2c16ef9218f 100644
--- a/arch/mips/kernel/scall64-n32.S
+++ b/arch/mips/kernel/scall64-n32.S
@@ -413,4 +413,6 @@ EXPORT(sysn32_call_table)
413 PTR sys_dup3 /* 5290 */ 413 PTR sys_dup3 /* 5290 */
414 PTR sys_pipe2 414 PTR sys_pipe2
415 PTR sys_inotify_init1 415 PTR sys_inotify_init1
416 PTR sys_preadv
417 PTR sys_pwritev
416 .size sysn32_call_table,.-sysn32_call_table 418 .size sysn32_call_table,.-sysn32_call_table
diff --git a/arch/mips/kernel/scall64-o32.S b/arch/mips/kernel/scall64-o32.S
index 60997f1f69d4..002fac27021e 100644
--- a/arch/mips/kernel/scall64-o32.S
+++ b/arch/mips/kernel/scall64-o32.S
@@ -533,4 +533,6 @@ sys_call_table:
533 PTR sys_dup3 533 PTR sys_dup3
534 PTR sys_pipe2 534 PTR sys_pipe2
535 PTR sys_inotify_init1 535 PTR sys_inotify_init1
536 PTR compat_sys_preadv /* 4330 */
537 PTR compat_sys_pwritev
536 .size sys_call_table,.-sys_call_table 538 .size sys_call_table,.-sys_call_table
diff --git a/arch/mips/sgi-ip27/ip27-smp.c b/arch/mips/sgi-ip27/ip27-smp.c
index 5b47d6b65275..cbcd7eb83bd1 100644
--- a/arch/mips/sgi-ip27/ip27-smp.c
+++ b/arch/mips/sgi-ip27/ip27-smp.c
@@ -221,7 +221,7 @@ static void __init ip27_smp_setup(void)
221 * Assumption to be fixed: we're always booted on logical / physical 221 * Assumption to be fixed: we're always booted on logical / physical
222 * processor 0. While we're always running on logical processor 0 222 * processor 0. While we're always running on logical processor 0
223 * this still means this is physical processor zero; it might for 223 * this still means this is physical processor zero; it might for
224 * example be disabled in the firwware. 224 * example be disabled in the firmware.
225 */ 225 */
226 alloc_cpupda(0, 0); 226 alloc_cpupda(0, 0);
227} 227}
diff --git a/arch/mn10300/kernel/process.c b/arch/mn10300/kernel/process.c
index b28c9a60445b..234cf344cdce 100644
--- a/arch/mn10300/kernel/process.c
+++ b/arch/mn10300/kernel/process.c
@@ -193,7 +193,7 @@ void prepare_to_copy(struct task_struct *tsk)
193 * set up the kernel stack for a new thread and copy arch-specific thread 193 * set up the kernel stack for a new thread and copy arch-specific thread
194 * control information 194 * control information
195 */ 195 */
196int copy_thread(int nr, unsigned long clone_flags, 196int copy_thread(unsigned long clone_flags,
197 unsigned long c_usp, unsigned long ustk_size, 197 unsigned long c_usp, unsigned long ustk_size,
198 struct task_struct *p, struct pt_regs *kregs) 198 struct task_struct *p, struct pt_regs *kregs)
199{ 199{
diff --git a/arch/parisc/Kconfig b/arch/parisc/Kconfig
index aacf11d33723..9038f39d9d73 100644
--- a/arch/parisc/Kconfig
+++ b/arch/parisc/Kconfig
@@ -9,9 +9,13 @@ config PARISC
9 def_bool y 9 def_bool y
10 select HAVE_IDE 10 select HAVE_IDE
11 select HAVE_OPROFILE 11 select HAVE_OPROFILE
12 select HAVE_FUNCTION_TRACER if 64BIT
13 select HAVE_FUNCTION_GRAPH_TRACER if 64BIT
14 select HAVE_FUNCTION_TRACE_MCOUNT_TEST if 64BIT
12 select RTC_CLASS 15 select RTC_CLASS
13 select RTC_DRV_PARISC 16 select RTC_DRV_GENERIC
14 select INIT_ALL_POSSIBLE 17 select INIT_ALL_POSSIBLE
18 select BUG
15 help 19 help
16 The PA-RISC microprocessor is designed by Hewlett-Packard and used 20 The PA-RISC microprocessor is designed by Hewlett-Packard and used
17 in many of their workstations & servers (HP9000 700 and 800 series, 21 in many of their workstations & servers (HP9000 700 and 800 series,
@@ -75,6 +79,9 @@ config GENERIC_HARDIRQS
75config GENERIC_IRQ_PROBE 79config GENERIC_IRQ_PROBE
76 def_bool y 80 def_bool y
77 81
82config HAVE_LATENCYTOP_SUPPORT
83 def_bool y
84
78config IRQ_PER_CPU 85config IRQ_PER_CPU
79 bool 86 bool
80 default y 87 default y
@@ -83,6 +90,9 @@ config IRQ_PER_CPU
83config PM 90config PM
84 bool 91 bool
85 92
93config STACKTRACE_SUPPORT
94 def_bool y
95
86config ISA_DMA_API 96config ISA_DMA_API
87 bool 97 bool
88 98
diff --git a/arch/parisc/Makefile b/arch/parisc/Makefile
index 0d428278356d..da6f66901c92 100644
--- a/arch/parisc/Makefile
+++ b/arch/parisc/Makefile
@@ -56,7 +56,9 @@ cflags-y += -mdisable-fpregs
56 56
57# Without this, "ld -r" results in .text sections that are too big 57# Without this, "ld -r" results in .text sections that are too big
58# (> 0x40000) for branches to reach stubs. 58# (> 0x40000) for branches to reach stubs.
59cflags-y += -ffunction-sections 59ifndef CONFIG_FUNCTION_TRACER
60 cflags-y += -ffunction-sections
61endif
60 62
61# select which processor to optimise for 63# select which processor to optimise for
62cflags-$(CONFIG_PA7100) += -march=1.1 -mschedule=7100 64cflags-$(CONFIG_PA7100) += -march=1.1 -mschedule=7100
diff --git a/arch/parisc/include/asm/atomic.h b/arch/parisc/include/asm/atomic.h
index edbfe25c5fc1..ada3e5364d82 100644
--- a/arch/parisc/include/asm/atomic.h
+++ b/arch/parisc/include/asm/atomic.h
@@ -25,7 +25,7 @@
25 * Since "a" is usually an address, use one spinlock per cacheline. 25 * Since "a" is usually an address, use one spinlock per cacheline.
26 */ 26 */
27# define ATOMIC_HASH_SIZE 4 27# define ATOMIC_HASH_SIZE 4
28# define ATOMIC_HASH(a) (&(__atomic_hash[ (((unsigned long) a)/L1_CACHE_BYTES) & (ATOMIC_HASH_SIZE-1) ])) 28# define ATOMIC_HASH(a) (&(__atomic_hash[ (((unsigned long) (a))/L1_CACHE_BYTES) & (ATOMIC_HASH_SIZE-1) ]))
29 29
30extern raw_spinlock_t __atomic_hash[ATOMIC_HASH_SIZE] __lock_aligned; 30extern raw_spinlock_t __atomic_hash[ATOMIC_HASH_SIZE] __lock_aligned;
31 31
@@ -222,13 +222,13 @@ static __inline__ int atomic_add_unless(atomic_t *v, int a, int u)
222 222
223#define atomic_inc_not_zero(v) atomic_add_unless((v), 1, 0) 223#define atomic_inc_not_zero(v) atomic_add_unless((v), 1, 0)
224 224
225#define atomic_add(i,v) ((void)(__atomic_add_return( ((int)i),(v)))) 225#define atomic_add(i,v) ((void)(__atomic_add_return( ((int)(i)),(v))))
226#define atomic_sub(i,v) ((void)(__atomic_add_return(-((int)i),(v)))) 226#define atomic_sub(i,v) ((void)(__atomic_add_return(-((int)(i)),(v))))
227#define atomic_inc(v) ((void)(__atomic_add_return( 1,(v)))) 227#define atomic_inc(v) ((void)(__atomic_add_return( 1,(v))))
228#define atomic_dec(v) ((void)(__atomic_add_return( -1,(v)))) 228#define atomic_dec(v) ((void)(__atomic_add_return( -1,(v))))
229 229
230#define atomic_add_return(i,v) (__atomic_add_return( ((int)i),(v))) 230#define atomic_add_return(i,v) (__atomic_add_return( ((int)(i)),(v)))
231#define atomic_sub_return(i,v) (__atomic_add_return(-((int)i),(v))) 231#define atomic_sub_return(i,v) (__atomic_add_return(-((int)(i)),(v)))
232#define atomic_inc_return(v) (__atomic_add_return( 1,(v))) 232#define atomic_inc_return(v) (__atomic_add_return( 1,(v)))
233#define atomic_dec_return(v) (__atomic_add_return( -1,(v))) 233#define atomic_dec_return(v) (__atomic_add_return( -1,(v)))
234 234
@@ -289,13 +289,13 @@ atomic64_read(const atomic64_t *v)
289 return v->counter; 289 return v->counter;
290} 290}
291 291
292#define atomic64_add(i,v) ((void)(__atomic64_add_return( ((s64)i),(v)))) 292#define atomic64_add(i,v) ((void)(__atomic64_add_return( ((s64)(i)),(v))))
293#define atomic64_sub(i,v) ((void)(__atomic64_add_return(-((s64)i),(v)))) 293#define atomic64_sub(i,v) ((void)(__atomic64_add_return(-((s64)(i)),(v))))
294#define atomic64_inc(v) ((void)(__atomic64_add_return( 1,(v)))) 294#define atomic64_inc(v) ((void)(__atomic64_add_return( 1,(v))))
295#define atomic64_dec(v) ((void)(__atomic64_add_return( -1,(v)))) 295#define atomic64_dec(v) ((void)(__atomic64_add_return( -1,(v))))
296 296
297#define atomic64_add_return(i,v) (__atomic64_add_return( ((s64)i),(v))) 297#define atomic64_add_return(i,v) (__atomic64_add_return( ((s64)(i)),(v)))
298#define atomic64_sub_return(i,v) (__atomic64_add_return(-((s64)i),(v))) 298#define atomic64_sub_return(i,v) (__atomic64_add_return(-((s64)(i)),(v)))
299#define atomic64_inc_return(v) (__atomic64_add_return( 1,(v))) 299#define atomic64_inc_return(v) (__atomic64_add_return( 1,(v)))
300#define atomic64_dec_return(v) (__atomic64_add_return( -1,(v))) 300#define atomic64_dec_return(v) (__atomic64_add_return( -1,(v)))
301 301
diff --git a/arch/parisc/include/asm/cacheflush.h b/arch/parisc/include/asm/cacheflush.h
index b7ca6dc7fddc..724395143f26 100644
--- a/arch/parisc/include/asm/cacheflush.h
+++ b/arch/parisc/include/asm/cacheflush.h
@@ -97,6 +97,9 @@ void mark_rodata_ro(void);
97 97
98#ifdef CONFIG_PA8X00 98#ifdef CONFIG_PA8X00
99/* Only pa8800, pa8900 needs this */ 99/* Only pa8800, pa8900 needs this */
100
101#include <asm/kmap_types.h>
102
100#define ARCH_HAS_KMAP 103#define ARCH_HAS_KMAP
101 104
102void kunmap_parisc(void *addr); 105void kunmap_parisc(void *addr);
diff --git a/arch/parisc/include/asm/elf.h b/arch/parisc/include/asm/elf.h
index 7fa675799e6d..9c802eb4be84 100644
--- a/arch/parisc/include/asm/elf.h
+++ b/arch/parisc/include/asm/elf.h
@@ -168,6 +168,16 @@ typedef struct elf64_fdesc {
168 __u64 gp; 168 __u64 gp;
169} Elf64_Fdesc; 169} Elf64_Fdesc;
170 170
171#ifdef __KERNEL__
172
173#ifdef CONFIG_64BIT
174#define Elf_Fdesc Elf64_Fdesc
175#else
176#define Elf_Fdesc Elf32_Fdesc
177#endif /*CONFIG_64BIT*/
178
179#endif /*__KERNEL__*/
180
171/* Legal values for p_type field of Elf32_Phdr/Elf64_Phdr. */ 181/* Legal values for p_type field of Elf32_Phdr/Elf64_Phdr. */
172 182
173#define PT_HP_TLS (PT_LOOS + 0x0) 183#define PT_HP_TLS (PT_LOOS + 0x0)
diff --git a/arch/parisc/include/asm/ftrace.h b/arch/parisc/include/asm/ftrace.h
index 40a8c178f10d..2fa05dd6aeee 100644
--- a/arch/parisc/include/asm/ftrace.h
+++ b/arch/parisc/include/asm/ftrace.h
@@ -1 +1,25 @@
1/* empty */ 1#ifndef _ASM_PARISC_FTRACE_H
2#define _ASM_PARISC_FTRACE_H
3
4#ifndef __ASSEMBLY__
5extern void mcount(void);
6
7/*
8 * Stack of return addresses for functions of a thread.
9 * Used in struct thread_info
10 */
11struct ftrace_ret_stack {
12 unsigned long ret;
13 unsigned long func;
14 unsigned long long calltime;
15};
16
17/*
18 * Primary handler of a function return.
19 * It relays on ftrace_return_to_handler.
20 * Defined in entry.S
21 */
22extern void return_to_handler(void);
23#endif /* __ASSEMBLY__ */
24
25#endif /* _ASM_PARISC_FTRACE_H */
diff --git a/arch/parisc/include/asm/page.h b/arch/parisc/include/asm/page.h
index c3941f09a878..7bc5125d7d4c 100644
--- a/arch/parisc/include/asm/page.h
+++ b/arch/parisc/include/asm/page.h
@@ -36,16 +36,7 @@ void clear_user_page(void *page, unsigned long vaddr, struct page *pg);
36 */ 36 */
37#define STRICT_MM_TYPECHECKS 37#define STRICT_MM_TYPECHECKS
38#ifdef STRICT_MM_TYPECHECKS 38#ifdef STRICT_MM_TYPECHECKS
39typedef struct { unsigned long pte; 39typedef struct { unsigned long pte; } pte_t; /* either 32 or 64bit */
40#if !defined(CONFIG_64BIT)
41 unsigned long future_flags;
42 /* XXX: it's possible to remove future_flags and change BITS_PER_PTE_ENTRY
43 to 2, but then strangely the identical 32bit kernel boots on a
44 c3000(pa20), but not any longer on a 715(pa11).
45 Still investigating... HelgeD.
46 */
47#endif
48} pte_t; /* either 32 or 64bit */
49 40
50/* NOTE: even on 64 bits, these entries are __u32 because we allocate 41/* NOTE: even on 64 bits, these entries are __u32 because we allocate
51 * the pmd and pgd in ZONE_DMA (i.e. under 4GB) */ 42 * the pmd and pgd in ZONE_DMA (i.e. under 4GB) */
@@ -111,7 +102,7 @@ extern int npmem_ranges;
111#define BITS_PER_PMD_ENTRY 2 102#define BITS_PER_PMD_ENTRY 2
112#define BITS_PER_PGD_ENTRY 2 103#define BITS_PER_PGD_ENTRY 2
113#else 104#else
114#define BITS_PER_PTE_ENTRY 3 105#define BITS_PER_PTE_ENTRY 2
115#define BITS_PER_PMD_ENTRY 2 106#define BITS_PER_PMD_ENTRY 2
116#define BITS_PER_PGD_ENTRY BITS_PER_PMD_ENTRY 107#define BITS_PER_PGD_ENTRY BITS_PER_PMD_ENTRY
117#endif 108#endif
diff --git a/arch/parisc/include/asm/pdc.h b/arch/parisc/include/asm/pdc.h
index 430f1aeea0b8..4ca510b3c6f8 100644
--- a/arch/parisc/include/asm/pdc.h
+++ b/arch/parisc/include/asm/pdc.h
@@ -49,6 +49,8 @@
49#define PDC_MODEL_CPU_ID 6 /* returns cpu-id (only newer machines!) */ 49#define PDC_MODEL_CPU_ID 6 /* returns cpu-id (only newer machines!) */
50#define PDC_MODEL_CAPABILITIES 7 /* returns OS32/OS64-flags */ 50#define PDC_MODEL_CAPABILITIES 7 /* returns OS32/OS64-flags */
51/* Values for PDC_MODEL_CAPABILITIES non-equivalent virtual aliasing support */ 51/* Values for PDC_MODEL_CAPABILITIES non-equivalent virtual aliasing support */
52#define PDC_MODEL_OS64 (1 << 0)
53#define PDC_MODEL_OS32 (1 << 1)
52#define PDC_MODEL_IOPDIR_FDC (1 << 2) 54#define PDC_MODEL_IOPDIR_FDC (1 << 2)
53#define PDC_MODEL_NVA_MASK (3 << 4) 55#define PDC_MODEL_NVA_MASK (3 << 4)
54#define PDC_MODEL_NVA_SUPPORTED (0 << 4) 56#define PDC_MODEL_NVA_SUPPORTED (0 << 4)
@@ -341,6 +343,8 @@
341 343
342#ifdef __KERNEL__ 344#ifdef __KERNEL__
343 345
346#include <asm/page.h> /* for __PAGE_OFFSET */
347
344extern int pdc_type; 348extern int pdc_type;
345 349
346/* Values for pdc_type */ 350/* Values for pdc_type */
diff --git a/arch/parisc/include/asm/pgtable.h b/arch/parisc/include/asm/pgtable.h
index 470a4b88124d..a27d2e200fb2 100644
--- a/arch/parisc/include/asm/pgtable.h
+++ b/arch/parisc/include/asm/pgtable.h
@@ -50,11 +50,7 @@
50 printk("%s:%d: bad pgd %08lx.\n", __FILE__, __LINE__, (unsigned long)pgd_val(e)) 50 printk("%s:%d: bad pgd %08lx.\n", __FILE__, __LINE__, (unsigned long)pgd_val(e))
51 51
52/* This is the size of the initially mapped kernel memory */ 52/* This is the size of the initially mapped kernel memory */
53#ifdef CONFIG_64BIT
54#define KERNEL_INITIAL_ORDER 24 /* 0 to 1<<24 = 16MB */ 53#define KERNEL_INITIAL_ORDER 24 /* 0 to 1<<24 = 16MB */
55#else
56#define KERNEL_INITIAL_ORDER 23 /* 0 to 1<<23 = 8MB */
57#endif
58#define KERNEL_INITIAL_SIZE (1 << KERNEL_INITIAL_ORDER) 54#define KERNEL_INITIAL_SIZE (1 << KERNEL_INITIAL_ORDER)
59 55
60#if defined(CONFIG_64BIT) && defined(CONFIG_PARISC_PAGE_SIZE_4KB) 56#if defined(CONFIG_64BIT) && defined(CONFIG_PARISC_PAGE_SIZE_4KB)
@@ -91,16 +87,25 @@
91 87
92/* Definitions for 1st level */ 88/* Definitions for 1st level */
93#define PGDIR_SHIFT (PMD_SHIFT + BITS_PER_PMD) 89#define PGDIR_SHIFT (PMD_SHIFT + BITS_PER_PMD)
90#if (PGDIR_SHIFT + PAGE_SHIFT + PGD_ORDER - BITS_PER_PGD_ENTRY) > BITS_PER_LONG
91#define BITS_PER_PGD (BITS_PER_LONG - PGDIR_SHIFT)
92#else
94#define BITS_PER_PGD (PAGE_SHIFT + PGD_ORDER - BITS_PER_PGD_ENTRY) 93#define BITS_PER_PGD (PAGE_SHIFT + PGD_ORDER - BITS_PER_PGD_ENTRY)
94#endif
95#define PGDIR_SIZE (1UL << PGDIR_SHIFT) 95#define PGDIR_SIZE (1UL << PGDIR_SHIFT)
96#define PGDIR_MASK (~(PGDIR_SIZE-1)) 96#define PGDIR_MASK (~(PGDIR_SIZE-1))
97#define PTRS_PER_PGD (1UL << BITS_PER_PGD) 97#define PTRS_PER_PGD (1UL << BITS_PER_PGD)
98#define USER_PTRS_PER_PGD PTRS_PER_PGD 98#define USER_PTRS_PER_PGD PTRS_PER_PGD
99 99
100#ifdef CONFIG_64BIT
100#define MAX_ADDRBITS (PGDIR_SHIFT + BITS_PER_PGD) 101#define MAX_ADDRBITS (PGDIR_SHIFT + BITS_PER_PGD)
101#define MAX_ADDRESS (1UL << MAX_ADDRBITS) 102#define MAX_ADDRESS (1UL << MAX_ADDRBITS)
102
103#define SPACEID_SHIFT (MAX_ADDRBITS - 32) 103#define SPACEID_SHIFT (MAX_ADDRBITS - 32)
104#else
105#define MAX_ADDRBITS (BITS_PER_LONG)
106#define MAX_ADDRESS (1UL << MAX_ADDRBITS)
107#define SPACEID_SHIFT 0
108#endif
104 109
105/* This calculates the number of initial pages we need for the initial 110/* This calculates the number of initial pages we need for the initial
106 * page tables */ 111 * page tables */
diff --git a/arch/parisc/include/asm/smp.h b/arch/parisc/include/asm/smp.h
index 6ef4b7867b1b..21eb45a52629 100644
--- a/arch/parisc/include/asm/smp.h
+++ b/arch/parisc/include/asm/smp.h
@@ -29,7 +29,8 @@ extern void smp_send_reschedule(int cpu);
29extern void smp_send_all_nop(void); 29extern void smp_send_all_nop(void);
30 30
31extern void arch_send_call_function_single_ipi(int cpu); 31extern void arch_send_call_function_single_ipi(int cpu);
32extern void arch_send_call_function_ipi(cpumask_t mask); 32extern void arch_send_call_function_ipi_mask(const struct cpumask *mask);
33#define arch_send_call_function_ipi_mask arch_send_call_function_ipi_mask
33 34
34#endif /* !ASSEMBLY */ 35#endif /* !ASSEMBLY */
35 36
diff --git a/arch/parisc/include/asm/spinlock.h b/arch/parisc/include/asm/spinlock.h
index f3d2090a18dc..fae03e136fa8 100644
--- a/arch/parisc/include/asm/spinlock.h
+++ b/arch/parisc/include/asm/spinlock.h
@@ -187,6 +187,9 @@ static __inline__ int __raw_write_can_lock(raw_rwlock_t *rw)
187 return !rw->counter; 187 return !rw->counter;
188} 188}
189 189
190#define __raw_read_lock_flags(lock, flags) __raw_read_lock(lock)
191#define __raw_write_lock_flags(lock, flags) __raw_write_lock(lock)
192
190#define _raw_spin_relax(lock) cpu_relax() 193#define _raw_spin_relax(lock) cpu_relax()
191#define _raw_read_relax(lock) cpu_relax() 194#define _raw_read_relax(lock) cpu_relax()
192#define _raw_write_relax(lock) cpu_relax() 195#define _raw_write_relax(lock) cpu_relax()
diff --git a/arch/parisc/kernel/Makefile b/arch/parisc/kernel/Makefile
index 016d3fc4111c..67db0722e6ca 100644
--- a/arch/parisc/kernel/Makefile
+++ b/arch/parisc/kernel/Makefile
@@ -11,10 +11,25 @@ obj-y := cache.o pacache.o setup.o traps.o time.o irq.o \
11 process.o processor.o pdc_cons.o pdc_chassis.o unwind.o \ 11 process.o processor.o pdc_cons.o pdc_chassis.o unwind.o \
12 topology.o 12 topology.o
13 13
14ifdef CONFIG_FUNCTION_TRACER
15# Do not profile debug and lowlevel utilities
16CFLAGS_REMOVE_ftrace.o = -pg
17CFLAGS_REMOVE_cache.o = -pg
18CFLAGS_REMOVE_irq.o = -pg
19CFLAGS_REMOVE_pacache.o = -pg
20CFLAGS_REMOVE_perf.o = -pg
21CFLAGS_REMOVE_traps.o = -pg
22CFLAGS_REMOVE_unaligned.o = -pg
23CFLAGS_REMOVE_unwind.o = -pg
24endif
25
14obj-$(CONFIG_SMP) += smp.o 26obj-$(CONFIG_SMP) += smp.o
15obj-$(CONFIG_PA11) += pci-dma.o 27obj-$(CONFIG_PA11) += pci-dma.o
16obj-$(CONFIG_PCI) += pci.o 28obj-$(CONFIG_PCI) += pci.o
17obj-$(CONFIG_MODULES) += module.o 29obj-$(CONFIG_MODULES) += module.o
18obj-$(CONFIG_64BIT) += binfmt_elf32.o sys_parisc32.o signal32.o 30obj-$(CONFIG_64BIT) += binfmt_elf32.o sys_parisc32.o signal32.o
31obj-$(CONFIG_STACKTRACE)+= stacktrace.o
19# only supported for PCX-W/U in 64-bit mode at the moment 32# only supported for PCX-W/U in 64-bit mode at the moment
20obj-$(CONFIG_64BIT) += perf.o perf_asm.o 33obj-$(CONFIG_64BIT) += perf.o perf_asm.o
34obj-$(CONFIG_FUNCTION_TRACER) += ftrace.o
35obj-$(CONFIG_FUNCTION_GRAPH_TRACER) += ftrace.o
diff --git a/arch/parisc/kernel/entry.S b/arch/parisc/kernel/entry.S
index 0db9fdcb7709..ae3e70cd1e14 100644
--- a/arch/parisc/kernel/entry.S
+++ b/arch/parisc/kernel/entry.S
@@ -505,6 +505,18 @@
505 STREG \pte,0(\ptep) 505 STREG \pte,0(\ptep)
506 .endm 506 .endm
507 507
508 /* bitshift difference between a PFN (based on kernel's PAGE_SIZE)
509 * to a CPU TLB 4k PFN (4k => 12 bits to shift) */
510 #define PAGE_ADD_SHIFT (PAGE_SHIFT-12)
511
512 /* Drop prot bits and convert to page addr for iitlbt and idtlbt */
513 .macro convert_for_tlb_insert20 pte
514 extrd,u \pte,(63-ASM_PFN_PTE_SHIFT)+(63-58)+PAGE_ADD_SHIFT,\
515 64-PAGE_SHIFT-PAGE_ADD_SHIFT,\pte
516 depdi _PAGE_SIZE_ENCODING_DEFAULT,63,\
517 (63-58)+PAGE_ADD_SHIFT,\pte
518 .endm
519
508 /* Convert the pte and prot to tlb insertion values. How 520 /* Convert the pte and prot to tlb insertion values. How
509 * this happens is quite subtle, read below */ 521 * this happens is quite subtle, read below */
510 .macro make_insert_tlb spc,pte,prot 522 .macro make_insert_tlb spc,pte,prot
@@ -544,8 +556,7 @@
544 depi 1,12,1,\prot 556 depi 1,12,1,\prot
545 557
546 /* Drop prot bits and convert to page addr for iitlbt and idtlbt */ 558 /* Drop prot bits and convert to page addr for iitlbt and idtlbt */
547 extrd,u \pte,(63-ASM_PFN_PTE_SHIFT)+(63-58),64-PAGE_SHIFT,\pte 559 convert_for_tlb_insert20 \pte
548 depdi _PAGE_SIZE_ENCODING_DEFAULT,63,63-58,\pte
549 .endm 560 .endm
550 561
551 /* Identical macro to make_insert_tlb above, except it 562 /* Identical macro to make_insert_tlb above, except it
@@ -563,8 +574,8 @@
563 574
564 /* Get rid of prot bits and convert to page addr for iitlba */ 575 /* Get rid of prot bits and convert to page addr for iitlba */
565 576
566 depi _PAGE_SIZE_ENCODING_DEFAULT,31,ASM_PFN_PTE_SHIFT,\pte 577 depi 0,31,ASM_PFN_PTE_SHIFT,\pte
567 extru \pte,24,25,\pte 578 SHRREG \pte,(ASM_PFN_PTE_SHIFT-(31-26)),\pte
568 .endm 579 .endm
569 580
570 /* This is for ILP32 PA2.0 only. The TLB insertion needs 581 /* This is for ILP32 PA2.0 only. The TLB insertion needs
@@ -1244,10 +1255,9 @@ nadtlb_check_flush_20w:
1244 depdi,z 7,7,3,prot 1255 depdi,z 7,7,3,prot
1245 depdi 1,10,1,prot 1256 depdi 1,10,1,prot
1246 1257
1247 /* Get rid of prot bits and convert to page addr for idtlbt */ 1258 /* Drop prot bits from pte and convert to page addr for idtlbt */
1259 convert_for_tlb_insert20 pte
1248 1260
1249 depdi 0,63,12,pte
1250 extrd,u pte,56,52,pte
1251 idtlbt pte,prot 1261 idtlbt pte,prot
1252 1262
1253 rfir 1263 rfir
@@ -1337,8 +1347,8 @@ nadtlb_check_flush_11:
1337 1347
1338 /* Get rid of prot bits and convert to page addr for idtlba */ 1348 /* Get rid of prot bits and convert to page addr for idtlba */
1339 1349
1340 depi 0,31,12,pte 1350 depi 0,31,ASM_PFN_PTE_SHIFT,pte
1341 extru pte,24,25,pte 1351 SHRREG pte,(ASM_PFN_PTE_SHIFT-(31-26)),pte
1342 1352
1343 mfsp %sr1,t0 /* Save sr1 so we can use it in tlb inserts */ 1353 mfsp %sr1,t0 /* Save sr1 so we can use it in tlb inserts */
1344 mtsp spc,%sr1 1354 mtsp spc,%sr1
@@ -1403,10 +1413,9 @@ nadtlb_check_flush_20:
1403 depdi,z 7,7,3,prot 1413 depdi,z 7,7,3,prot
1404 depdi 1,10,1,prot 1414 depdi 1,10,1,prot
1405 1415
1406 /* Get rid of prot bits and convert to page addr for idtlbt */ 1416 /* Drop prot bits from pte and convert to page addr for idtlbt */
1417 convert_for_tlb_insert20 pte
1407 1418
1408 depdi 0,63,12,pte
1409 extrd,u pte,56,32,pte
1410 idtlbt pte,prot 1419 idtlbt pte,prot
1411 1420
1412 rfir 1421 rfir
@@ -2176,6 +2185,33 @@ syscall_do_resched:
2176ENDPROC(syscall_exit) 2185ENDPROC(syscall_exit)
2177 2186
2178 2187
2188#ifdef CONFIG_FUNCTION_TRACER
2189 .import ftrace_function_trampoline,code
2190ENTRY(_mcount)
2191 copy %r3, %arg2
2192 b ftrace_function_trampoline
2193 nop
2194ENDPROC(_mcount)
2195
2196ENTRY(return_to_handler)
2197 load32 return_trampoline, %rp
2198 copy %ret0, %arg0
2199 copy %ret1, %arg1
2200 b ftrace_return_to_handler
2201 nop
2202return_trampoline:
2203 copy %ret0, %rp
2204 copy %r23, %ret0
2205 copy %r24, %ret1
2206
2207.globl ftrace_stub
2208ftrace_stub:
2209 bv %r0(%rp)
2210 nop
2211ENDPROC(return_to_handler)
2212#endif /* CONFIG_FUNCTION_TRACER */
2213
2214
2179get_register: 2215get_register:
2180 /* 2216 /*
2181 * get_register is used by the non access tlb miss handlers to 2217 * get_register is used by the non access tlb miss handlers to
diff --git a/arch/parisc/kernel/firmware.c b/arch/parisc/kernel/firmware.c
index f6d241238a78..4c247e02d9b1 100644
--- a/arch/parisc/kernel/firmware.c
+++ b/arch/parisc/kernel/firmware.c
@@ -527,7 +527,11 @@ int pdc_model_capabilities(unsigned long *capabilities)
527 pdc_result[0] = 0; /* preset zero (call may not be implemented!) */ 527 pdc_result[0] = 0; /* preset zero (call may not be implemented!) */
528 retval = mem_pdc_call(PDC_MODEL, PDC_MODEL_CAPABILITIES, __pa(pdc_result), 0); 528 retval = mem_pdc_call(PDC_MODEL, PDC_MODEL_CAPABILITIES, __pa(pdc_result), 0);
529 convert_to_wide(pdc_result); 529 convert_to_wide(pdc_result);
530 *capabilities = pdc_result[0]; 530 if (retval == PDC_OK) {
531 *capabilities = pdc_result[0];
532 } else {
533 *capabilities = PDC_MODEL_OS32;
534 }
531 spin_unlock_irqrestore(&pdc_lock, flags); 535 spin_unlock_irqrestore(&pdc_lock, flags);
532 536
533 return retval; 537 return retval;
diff --git a/arch/parisc/kernel/ftrace.c b/arch/parisc/kernel/ftrace.c
new file mode 100644
index 000000000000..9877372ffdba
--- /dev/null
+++ b/arch/parisc/kernel/ftrace.c
@@ -0,0 +1,185 @@
1/*
2 * Code for tracing calls in Linux kernel.
3 * Copyright (C) 2009 Helge Deller <deller@gmx.de>
4 *
5 * based on code for x86 which is:
6 * Copyright (C) 2007-2008 Steven Rostedt <srostedt@redhat.com>
7 *
8 * future possible enhancements:
9 * - add CONFIG_DYNAMIC_FTRACE
10 * - add CONFIG_STACK_TRACER
11 */
12
13#include <linux/init.h>
14#include <linux/ftrace.h>
15
16#include <asm/sections.h>
17#include <asm/ftrace.h>
18
19
20
21#ifdef CONFIG_FUNCTION_GRAPH_TRACER
22
23/* Add a function return address to the trace stack on thread info.*/
24static int push_return_trace(unsigned long ret, unsigned long long time,
25 unsigned long func, int *depth)
26{
27 int index;
28
29 if (!current->ret_stack)
30 return -EBUSY;
31
32 /* The return trace stack is full */
33 if (current->curr_ret_stack == FTRACE_RETFUNC_DEPTH - 1) {
34 atomic_inc(&current->trace_overrun);
35 return -EBUSY;
36 }
37
38 index = ++current->curr_ret_stack;
39 barrier();
40 current->ret_stack[index].ret = ret;
41 current->ret_stack[index].func = func;
42 current->ret_stack[index].calltime = time;
43 *depth = index;
44
45 return 0;
46}
47
48/* Retrieve a function return address to the trace stack on thread info.*/
49static void pop_return_trace(struct ftrace_graph_ret *trace, unsigned long *ret)
50{
51 int index;
52
53 index = current->curr_ret_stack;
54
55 if (unlikely(index < 0)) {
56 ftrace_graph_stop();
57 WARN_ON(1);
58 /* Might as well panic, otherwise we have no where to go */
59 *ret = (unsigned long)
60 dereference_function_descriptor(&panic);
61 return;
62 }
63
64 *ret = current->ret_stack[index].ret;
65 trace->func = current->ret_stack[index].func;
66 trace->calltime = current->ret_stack[index].calltime;
67 trace->overrun = atomic_read(&current->trace_overrun);
68 trace->depth = index;
69 barrier();
70 current->curr_ret_stack--;
71
72}
73
74/*
75 * Send the trace to the ring-buffer.
76 * @return the original return address.
77 */
78unsigned long ftrace_return_to_handler(unsigned long retval0,
79 unsigned long retval1)
80{
81 struct ftrace_graph_ret trace;
82 unsigned long ret;
83
84 pop_return_trace(&trace, &ret);
85 trace.rettime = cpu_clock(raw_smp_processor_id());
86 ftrace_graph_return(&trace);
87
88 if (unlikely(!ret)) {
89 ftrace_graph_stop();
90 WARN_ON(1);
91 /* Might as well panic. What else to do? */
92 ret = (unsigned long)
93 dereference_function_descriptor(&panic);
94 }
95
96 /* HACK: we hand over the old functions' return values
97 in %r23 and %r24. Assembly in entry.S will take care
98 and move those to their final registers %ret0 and %ret1 */
99 asm( "copy %0, %%r23 \n\t"
100 "copy %1, %%r24 \n" : : "r" (retval0), "r" (retval1) );
101
102 return ret;
103}
104
105/*
106 * Hook the return address and push it in the stack of return addrs
107 * in current thread info.
108 */
109void prepare_ftrace_return(unsigned long *parent, unsigned long self_addr)
110{
111 unsigned long old;
112 unsigned long long calltime;
113 struct ftrace_graph_ent trace;
114
115 if (unlikely(atomic_read(&current->tracing_graph_pause)))
116 return;
117
118 old = *parent;
119 *parent = (unsigned long)
120 dereference_function_descriptor(&return_to_handler);
121
122 if (unlikely(!__kernel_text_address(old))) {
123 ftrace_graph_stop();
124 *parent = old;
125 WARN_ON(1);
126 return;
127 }
128
129 calltime = cpu_clock(raw_smp_processor_id());
130
131 if (push_return_trace(old, calltime,
132 self_addr, &trace.depth) == -EBUSY) {
133 *parent = old;
134 return;
135 }
136
137 trace.func = self_addr;
138
139 /* Only trace if the calling function expects to */
140 if (!ftrace_graph_entry(&trace)) {
141 current->curr_ret_stack--;
142 *parent = old;
143 }
144}
145
146#endif /* CONFIG_FUNCTION_GRAPH_TRACER */
147
148
149void ftrace_function_trampoline(unsigned long parent,
150 unsigned long self_addr,
151 unsigned long org_sp_gr3)
152{
153 extern ftrace_func_t ftrace_trace_function;
154
155 if (function_trace_stop)
156 return;
157
158 if (ftrace_trace_function != ftrace_stub) {
159 ftrace_trace_function(parent, self_addr);
160 return;
161 }
162#ifdef CONFIG_FUNCTION_GRAPH_TRACER
163 if (ftrace_graph_entry && ftrace_graph_return) {
164 unsigned long sp;
165 unsigned long *parent_rp;
166
167 asm volatile ("copy %%r30, %0" : "=r"(sp));
168 /* sanity check: is stack pointer which we got from
169 assembler function in entry.S in a reasonable
170 range compared to current stack pointer? */
171 if ((sp - org_sp_gr3) > 0x400)
172 return;
173
174 /* calculate pointer to %rp in stack */
175 parent_rp = (unsigned long *) org_sp_gr3 - 0x10;
176 /* sanity check: parent_rp should hold parent */
177 if (*parent_rp != parent)
178 return;
179
180 prepare_ftrace_return(parent_rp, self_addr);
181 return;
182 }
183#endif
184}
185
diff --git a/arch/parisc/kernel/irq.c b/arch/parisc/kernel/irq.c
index 1c740f5cbd63..4ea4229d765c 100644
--- a/arch/parisc/kernel/irq.c
+++ b/arch/parisc/kernel/irq.c
@@ -311,12 +311,12 @@ unsigned long txn_alloc_addr(unsigned int virt_irq)
311 next_cpu++; /* assign to "next" CPU we want this bugger on */ 311 next_cpu++; /* assign to "next" CPU we want this bugger on */
312 312
313 /* validate entry */ 313 /* validate entry */
314 while ((next_cpu < NR_CPUS) && 314 while ((next_cpu < nr_cpu_ids) &&
315 (!per_cpu(cpu_data, next_cpu).txn_addr || 315 (!per_cpu(cpu_data, next_cpu).txn_addr ||
316 !cpu_online(next_cpu))) 316 !cpu_online(next_cpu)))
317 next_cpu++; 317 next_cpu++;
318 318
319 if (next_cpu >= NR_CPUS) 319 if (next_cpu >= nr_cpu_ids)
320 next_cpu = 0; /* nothing else, assign monarch */ 320 next_cpu = 0; /* nothing else, assign monarch */
321 321
322 return txn_affinity_addr(virt_irq, next_cpu); 322 return txn_affinity_addr(virt_irq, next_cpu);
diff --git a/arch/parisc/kernel/module.c b/arch/parisc/kernel/module.c
index 9013243cecca..ecd1c5024447 100644
--- a/arch/parisc/kernel/module.c
+++ b/arch/parisc/kernel/module.c
@@ -61,9 +61,7 @@
61#include <linux/string.h> 61#include <linux/string.h>
62#include <linux/kernel.h> 62#include <linux/kernel.h>
63#include <linux/bug.h> 63#include <linux/bug.h>
64#include <linux/uaccess.h>
65 64
66#include <asm/sections.h>
67#include <asm/unwind.h> 65#include <asm/unwind.h>
68 66
69#if 0 67#if 0
@@ -115,8 +113,6 @@ struct got_entry {
115 Elf32_Addr addr; 113 Elf32_Addr addr;
116}; 114};
117 115
118#define Elf_Fdesc Elf32_Fdesc
119
120struct stub_entry { 116struct stub_entry {
121 Elf32_Word insns[2]; /* each stub entry has two insns */ 117 Elf32_Word insns[2]; /* each stub entry has two insns */
122}; 118};
@@ -125,8 +121,6 @@ struct got_entry {
125 Elf64_Addr addr; 121 Elf64_Addr addr;
126}; 122};
127 123
128#define Elf_Fdesc Elf64_Fdesc
129
130struct stub_entry { 124struct stub_entry {
131 Elf64_Word insns[4]; /* each stub entry has four insns */ 125 Elf64_Word insns[4]; /* each stub entry has four insns */
132}; 126};
@@ -916,15 +910,3 @@ void module_arch_cleanup(struct module *mod)
916 deregister_unwind_table(mod); 910 deregister_unwind_table(mod);
917 module_bug_cleanup(mod); 911 module_bug_cleanup(mod);
918} 912}
919
920#ifdef CONFIG_64BIT
921void *dereference_function_descriptor(void *ptr)
922{
923 Elf64_Fdesc *desc = ptr;
924 void *p;
925
926 if (!probe_kernel_address(&desc->addr, p))
927 ptr = p;
928 return ptr;
929}
930#endif
diff --git a/arch/parisc/kernel/parisc_ksyms.c b/arch/parisc/kernel/parisc_ksyms.c
index 0eecfbbc59cd..df653663d3db 100644
--- a/arch/parisc/kernel/parisc_ksyms.c
+++ b/arch/parisc/kernel/parisc_ksyms.c
@@ -153,5 +153,10 @@ EXPORT_SYMBOL(node_data);
153EXPORT_SYMBOL(pfnnid_map); 153EXPORT_SYMBOL(pfnnid_map);
154#endif 154#endif
155 155
156#ifdef CONFIG_FUNCTION_TRACER
157extern void _mcount(void);
158EXPORT_SYMBOL(_mcount);
159#endif
160
156/* from pacache.S -- needed for copy_page */ 161/* from pacache.S -- needed for copy_page */
157EXPORT_SYMBOL(copy_user_page_asm); 162EXPORT_SYMBOL(copy_user_page_asm);
diff --git a/arch/parisc/kernel/process.c b/arch/parisc/kernel/process.c
index b80e02a4d81d..6f69101f90bb 100644
--- a/arch/parisc/kernel/process.c
+++ b/arch/parisc/kernel/process.c
@@ -46,14 +46,15 @@
46#include <linux/stddef.h> 46#include <linux/stddef.h>
47#include <linux/unistd.h> 47#include <linux/unistd.h>
48#include <linux/kallsyms.h> 48#include <linux/kallsyms.h>
49#include <linux/uaccess.h>
49 50
50#include <asm/io.h> 51#include <asm/io.h>
51#include <asm/asm-offsets.h> 52#include <asm/asm-offsets.h>
52#include <asm/pdc.h> 53#include <asm/pdc.h>
53#include <asm/pdc_chassis.h> 54#include <asm/pdc_chassis.h>
54#include <asm/pgalloc.h> 55#include <asm/pgalloc.h>
55#include <asm/uaccess.h>
56#include <asm/unwind.h> 56#include <asm/unwind.h>
57#include <asm/sections.h>
57 58
58/* 59/*
59 * The idle thread. There's no useful work to be 60 * The idle thread. There's no useful work to be
@@ -231,8 +232,8 @@ sys_clone(unsigned long clone_flags, unsigned long usp,
231 232
232 However, these last 3 args are only examined 233 However, these last 3 args are only examined
233 if the proper flags are set. */ 234 if the proper flags are set. */
234 int __user *child_tidptr; 235 int __user *parent_tidptr = (int __user *)regs->gr[24];
235 int __user *parent_tidptr; 236 int __user *child_tidptr = (int __user *)regs->gr[22];
236 237
237 /* usp must be word aligned. This also prevents users from 238 /* usp must be word aligned. This also prevents users from
238 * passing in the value 1 (which is the signal for a special 239 * passing in the value 1 (which is the signal for a special
@@ -243,16 +244,6 @@ sys_clone(unsigned long clone_flags, unsigned long usp,
243 if (usp == 0) 244 if (usp == 0)
244 usp = regs->gr[30]; 245 usp = regs->gr[30];
245 246
246 if (clone_flags & CLONE_PARENT_SETTID)
247 parent_tidptr = (int __user *)regs->gr[24];
248 else
249 parent_tidptr = NULL;
250
251 if (clone_flags & (CLONE_CHILD_SETTID | CLONE_CHILD_CLEARTID))
252 child_tidptr = (int __user *)regs->gr[22];
253 else
254 child_tidptr = NULL;
255
256 return do_fork(clone_flags, usp, regs, 0, parent_tidptr, child_tidptr); 247 return do_fork(clone_flags, usp, regs, 0, parent_tidptr, child_tidptr);
257} 248}
258 249
@@ -263,7 +254,7 @@ sys_vfork(struct pt_regs *regs)
263} 254}
264 255
265int 256int
266copy_thread(int nr, unsigned long clone_flags, unsigned long usp, 257copy_thread(unsigned long clone_flags, unsigned long usp,
267 unsigned long unused, /* in ia64 this is "user_stack_size" */ 258 unsigned long unused, /* in ia64 this is "user_stack_size" */
268 struct task_struct * p, struct pt_regs * pregs) 259 struct task_struct * p, struct pt_regs * pregs)
269{ 260{
@@ -400,3 +391,15 @@ get_wchan(struct task_struct *p)
400 } while (count++ < 16); 391 } while (count++ < 16);
401 return 0; 392 return 0;
402} 393}
394
395#ifdef CONFIG_64BIT
396void *dereference_function_descriptor(void *ptr)
397{
398 Elf64_Fdesc *desc = ptr;
399 void *p;
400
401 if (!probe_kernel_address(&desc->addr, p))
402 ptr = p;
403 return ptr;
404}
405#endif
diff --git a/arch/parisc/kernel/processor.c b/arch/parisc/kernel/processor.c
index ecb609342feb..e09d0f7fb6b0 100644
--- a/arch/parisc/kernel/processor.c
+++ b/arch/parisc/kernel/processor.c
@@ -100,8 +100,8 @@ static int __cpuinit processor_probe(struct parisc_device *dev)
100 struct cpuinfo_parisc *p; 100 struct cpuinfo_parisc *p;
101 101
102#ifdef CONFIG_SMP 102#ifdef CONFIG_SMP
103 if (num_online_cpus() >= NR_CPUS) { 103 if (num_online_cpus() >= nr_cpu_ids) {
104 printk(KERN_INFO "num_online_cpus() >= NR_CPUS\n"); 104 printk(KERN_INFO "num_online_cpus() >= nr_cpu_ids\n");
105 return 1; 105 return 1;
106 } 106 }
107#else 107#else
@@ -214,7 +214,7 @@ static int __cpuinit processor_probe(struct parisc_device *dev)
214 */ 214 */
215#ifdef CONFIG_SMP 215#ifdef CONFIG_SMP
216 if (cpuid) { 216 if (cpuid) {
217 cpu_set(cpuid, cpu_present_map); 217 set_cpu_present(cpuid, true);
218 cpu_up(cpuid); 218 cpu_up(cpuid);
219 } 219 }
220#endif 220#endif
@@ -364,6 +364,13 @@ show_cpuinfo (struct seq_file *m, void *v)
364 boot_cpu_data.cpu_hz / 1000000, 364 boot_cpu_data.cpu_hz / 1000000,
365 boot_cpu_data.cpu_hz % 1000000 ); 365 boot_cpu_data.cpu_hz % 1000000 );
366 366
367 seq_printf(m, "capabilities\t:");
368 if (boot_cpu_data.pdc.capabilities & PDC_MODEL_OS32)
369 seq_printf(m, " os32");
370 if (boot_cpu_data.pdc.capabilities & PDC_MODEL_OS64)
371 seq_printf(m, " os64");
372 seq_printf(m, "\n");
373
367 seq_printf(m, "model\t\t: %s\n" 374 seq_printf(m, "model\t\t: %s\n"
368 "model name\t: %s\n", 375 "model name\t: %s\n",
369 boot_cpu_data.pdc.sys_model_name, 376 boot_cpu_data.pdc.sys_model_name,
diff --git a/arch/parisc/kernel/smp.c b/arch/parisc/kernel/smp.c
index 9995d7ed5819..1fd0f0cec037 100644
--- a/arch/parisc/kernel/smp.c
+++ b/arch/parisc/kernel/smp.c
@@ -31,6 +31,7 @@
31#include <linux/err.h> 31#include <linux/err.h>
32#include <linux/delay.h> 32#include <linux/delay.h>
33#include <linux/bitops.h> 33#include <linux/bitops.h>
34#include <linux/ftrace.h>
34 35
35#include <asm/system.h> 36#include <asm/system.h>
36#include <asm/atomic.h> 37#include <asm/atomic.h>
@@ -113,14 +114,14 @@ halt_processor(void)
113{ 114{
114 /* REVISIT : redirect I/O Interrupts to another CPU? */ 115 /* REVISIT : redirect I/O Interrupts to another CPU? */
115 /* REVISIT : does PM *know* this CPU isn't available? */ 116 /* REVISIT : does PM *know* this CPU isn't available? */
116 cpu_clear(smp_processor_id(), cpu_online_map); 117 set_cpu_online(smp_processor_id(), false);
117 local_irq_disable(); 118 local_irq_disable();
118 for (;;) 119 for (;;)
119 ; 120 ;
120} 121}
121 122
122 123
123irqreturn_t 124irqreturn_t __irq_entry
124ipi_interrupt(int irq, void *dev_id) 125ipi_interrupt(int irq, void *dev_id)
125{ 126{
126 int this_cpu = smp_processor_id(); 127 int this_cpu = smp_processor_id();
@@ -214,11 +215,11 @@ ipi_send(int cpu, enum ipi_message_type op)
214} 215}
215 216
216static void 217static void
217send_IPI_mask(cpumask_t mask, enum ipi_message_type op) 218send_IPI_mask(const struct cpumask *mask, enum ipi_message_type op)
218{ 219{
219 int cpu; 220 int cpu;
220 221
221 for_each_cpu_mask(cpu, mask) 222 for_each_cpu(cpu, mask)
222 ipi_send(cpu, op); 223 ipi_send(cpu, op);
223} 224}
224 225
@@ -257,7 +258,7 @@ smp_send_all_nop(void)
257 send_IPI_allbutself(IPI_NOP); 258 send_IPI_allbutself(IPI_NOP);
258} 259}
259 260
260void arch_send_call_function_ipi(cpumask_t mask) 261void arch_send_call_function_ipi_mask(const struct cpumask *mask)
261{ 262{
262 send_IPI_mask(mask, IPI_CALL_FUNC); 263 send_IPI_mask(mask, IPI_CALL_FUNC);
263} 264}
@@ -296,13 +297,14 @@ smp_cpu_init(int cpunum)
296 mb(); 297 mb();
297 298
298 /* Well, support 2.4 linux scheme as well. */ 299 /* Well, support 2.4 linux scheme as well. */
299 if (cpu_test_and_set(cpunum, cpu_online_map)) 300 if (cpu_isset(cpunum, cpu_online_map))
300 { 301 {
301 extern void machine_halt(void); /* arch/parisc.../process.c */ 302 extern void machine_halt(void); /* arch/parisc.../process.c */
302 303
303 printk(KERN_CRIT "CPU#%d already initialized!\n", cpunum); 304 printk(KERN_CRIT "CPU#%d already initialized!\n", cpunum);
304 machine_halt(); 305 machine_halt();
305 } 306 }
307 set_cpu_online(cpunum, true);
306 308
307 /* Initialise the idle task for this CPU */ 309 /* Initialise the idle task for this CPU */
308 atomic_inc(&init_mm.mm_count); 310 atomic_inc(&init_mm.mm_count);
@@ -424,8 +426,8 @@ void __init smp_prepare_boot_cpu(void)
424 /* Setup BSP mappings */ 426 /* Setup BSP mappings */
425 printk(KERN_INFO "SMP: bootstrap CPU ID is %d\n", bootstrap_processor); 427 printk(KERN_INFO "SMP: bootstrap CPU ID is %d\n", bootstrap_processor);
426 428
427 cpu_set(bootstrap_processor, cpu_online_map); 429 set_cpu_online(bootstrap_processor, true);
428 cpu_set(bootstrap_processor, cpu_present_map); 430 set_cpu_present(bootstrap_processor, true);
429} 431}
430 432
431 433
@@ -436,8 +438,7 @@ void __init smp_prepare_boot_cpu(void)
436*/ 438*/
437void __init smp_prepare_cpus(unsigned int max_cpus) 439void __init smp_prepare_cpus(unsigned int max_cpus)
438{ 440{
439 cpus_clear(cpu_present_map); 441 init_cpu_present(cpumask_of(0));
440 cpu_set(0, cpu_present_map);
441 442
442 parisc_max_cpus = max_cpus; 443 parisc_max_cpus = max_cpus;
443 if (!max_cpus) 444 if (!max_cpus)
diff --git a/arch/parisc/kernel/stacktrace.c b/arch/parisc/kernel/stacktrace.c
new file mode 100644
index 000000000000..2fe914c5f533
--- /dev/null
+++ b/arch/parisc/kernel/stacktrace.c
@@ -0,0 +1,63 @@
1/*
2 * Stack trace management functions
3 *
4 * Copyright (C) 2009 Helge Deller <deller@gmx.de>
5 * based on arch/x86/kernel/stacktrace.c by Ingo Molnar <mingo@redhat.com>
6 * and parisc unwind functions by Randolph Chung <tausq@debian.org>
7 *
8 * TODO: Userspace stacktrace (CONFIG_USER_STACKTRACE_SUPPORT)
9 */
10#include <linux/module.h>
11#include <linux/stacktrace.h>
12
13#include <asm/unwind.h>
14
15static void dump_trace(struct task_struct *task, struct stack_trace *trace)
16{
17 struct unwind_frame_info info;
18
19 /* initialize unwind info */
20 if (task == current) {
21 unsigned long sp;
22 struct pt_regs r;
23HERE:
24 asm volatile ("copy %%r30, %0" : "=r"(sp));
25 memset(&r, 0, sizeof(struct pt_regs));
26 r.iaoq[0] = (unsigned long)&&HERE;
27 r.gr[2] = (unsigned long)__builtin_return_address(0);
28 r.gr[30] = sp;
29 unwind_frame_init(&info, task, &r);
30 } else {
31 unwind_frame_init_from_blocked_task(&info, task);
32 }
33
34 /* unwind stack and save entries in stack_trace struct */
35 trace->nr_entries = 0;
36 while (trace->nr_entries < trace->max_entries) {
37 if (unwind_once(&info) < 0 || info.ip == 0)
38 break;
39
40 if (__kernel_text_address(info.ip))
41 trace->entries[trace->nr_entries++] = info.ip;
42 }
43}
44
45
46/*
47 * Save stack-backtrace addresses into a stack_trace buffer.
48 */
49void save_stack_trace(struct stack_trace *trace)
50{
51 dump_trace(current, trace);
52 if (trace->nr_entries < trace->max_entries)
53 trace->entries[trace->nr_entries++] = ULONG_MAX;
54}
55EXPORT_SYMBOL_GPL(save_stack_trace);
56
57void save_stack_trace_tsk(struct task_struct *tsk, struct stack_trace *trace)
58{
59 dump_trace(tsk, trace);
60 if (trace->nr_entries < trace->max_entries)
61 trace->entries[trace->nr_entries++] = ULONG_MAX;
62}
63EXPORT_SYMBOL_GPL(save_stack_trace_tsk);
diff --git a/arch/parisc/kernel/syscall.S b/arch/parisc/kernel/syscall.S
index 69b6eebc466e..59fc1a43ec3e 100644
--- a/arch/parisc/kernel/syscall.S
+++ b/arch/parisc/kernel/syscall.S
@@ -365,17 +365,51 @@ tracesys_sigexit:
365 365
366 366
367 /********************************************************* 367 /*********************************************************
368 Light-weight-syscall code 368 32/64-bit Light-Weight-Syscall ABI
369 369
370 r20 - lws number 370 * - Indicates a hint for userspace inline asm
371 r26,r25,r24,r23,r22 - Input registers 371 implementations.
372 r28 - Function return register
373 r21 - Error code.
374 372
375 Scracth: Any of the above that aren't being 373 Syscall number (caller-saves)
376 currently used, including r1. 374 - %r20
375 * In asm clobber.
377 376
378 Return pointer: r31 (Not usable) 377 Argument registers (caller-saves)
378 - %r26, %r25, %r24, %r23, %r22
379 * In asm input.
380
381 Return registers (caller-saves)
382 - %r28 (return), %r21 (errno)
383 * In asm output.
384
385 Caller-saves registers
386 - %r1, %r27, %r29
387 - %r2 (return pointer)
388 - %r31 (ble link register)
389 * In asm clobber.
390
391 Callee-saves registers
392 - %r3-%r18
393 - %r30 (stack pointer)
394 * Not in asm clobber.
395
396 If userspace is 32-bit:
397 Callee-saves registers
398 - %r19 (32-bit PIC register)
399
400 Differences from 32-bit calling convention:
401 - Syscall number in %r20
402 - Additional argument register %r22 (arg4)
403 - Callee-saves %r19.
404
405 If userspace is 64-bit:
406 Callee-saves registers
407 - %r27 (64-bit PIC register)
408
409 Differences from 64-bit calling convention:
410 - Syscall number in %r20
411 - Additional argument register %r22 (arg4)
412 - Callee-saves %r27.
379 413
380 Error codes returned by entry path: 414 Error codes returned by entry path:
381 415
@@ -473,7 +507,8 @@ lws_compare_and_swap64:
473 b,n lws_compare_and_swap 507 b,n lws_compare_and_swap
474#else 508#else
475 /* If we are not a 64-bit kernel, then we don't 509 /* If we are not a 64-bit kernel, then we don't
476 * implement having 64-bit input registers 510 * have 64-bit input registers, and calling
511 * the 64-bit LWS CAS returns ENOSYS.
477 */ 512 */
478 b,n lws_exit_nosys 513 b,n lws_exit_nosys
479#endif 514#endif
@@ -635,12 +670,15 @@ END(sys_call_table64)
635 /* 670 /*
636 All light-weight-syscall atomic operations 671 All light-weight-syscall atomic operations
637 will use this set of locks 672 will use this set of locks
673
674 NOTE: The lws_lock_start symbol must be
675 at least 16-byte aligned for safe use
676 with ldcw.
638 */ 677 */
639 .section .data 678 .section .data
640 .align PAGE_SIZE 679 .align PAGE_SIZE
641ENTRY(lws_lock_start) 680ENTRY(lws_lock_start)
642 /* lws locks */ 681 /* lws locks */
643 .align 16
644 .rept 16 682 .rept 16
645 /* Keep locks aligned at 16-bytes */ 683 /* Keep locks aligned at 16-bytes */
646 .word 1 684 .word 1
diff --git a/arch/parisc/kernel/time.c b/arch/parisc/kernel/time.c
index e75cae6072c5..d4dd05674c62 100644
--- a/arch/parisc/kernel/time.c
+++ b/arch/parisc/kernel/time.c
@@ -24,6 +24,7 @@
24#include <linux/profile.h> 24#include <linux/profile.h>
25#include <linux/clocksource.h> 25#include <linux/clocksource.h>
26#include <linux/platform_device.h> 26#include <linux/platform_device.h>
27#include <linux/ftrace.h>
27 28
28#include <asm/uaccess.h> 29#include <asm/uaccess.h>
29#include <asm/io.h> 30#include <asm/io.h>
@@ -53,7 +54,7 @@ static unsigned long clocktick __read_mostly; /* timer cycles per tick */
53 * held off for an arbitrarily long period of time by interrupts being 54 * held off for an arbitrarily long period of time by interrupts being
54 * disabled, so we may miss one or more ticks. 55 * disabled, so we may miss one or more ticks.
55 */ 56 */
56irqreturn_t timer_interrupt(int irq, void *dev_id) 57irqreturn_t __irq_entry timer_interrupt(int irq, void *dev_id)
57{ 58{
58 unsigned long now; 59 unsigned long now;
59 unsigned long next_tick; 60 unsigned long next_tick;
@@ -216,14 +217,14 @@ void __init start_cpu_itimer(void)
216 per_cpu(cpu_data, cpu).it_value = next_tick; 217 per_cpu(cpu_data, cpu).it_value = next_tick;
217} 218}
218 219
219static struct platform_device rtc_parisc_dev = { 220static struct platform_device rtc_generic_dev = {
220 .name = "rtc-parisc", 221 .name = "rtc-generic",
221 .id = -1, 222 .id = -1,
222}; 223};
223 224
224static int __init rtc_init(void) 225static int __init rtc_init(void)
225{ 226{
226 if (platform_device_register(&rtc_parisc_dev) < 0) 227 if (platform_device_register(&rtc_generic_dev) < 0)
227 printk(KERN_ERR "unable to register rtc device...\n"); 228 printk(KERN_ERR "unable to register rtc device...\n");
228 229
229 /* not necessarily an error */ 230 /* not necessarily an error */
diff --git a/arch/parisc/kernel/traps.c b/arch/parisc/kernel/traps.c
index ba658d2086f7..c32f5d6d778e 100644
--- a/arch/parisc/kernel/traps.c
+++ b/arch/parisc/kernel/traps.c
@@ -247,6 +247,8 @@ void die_if_kernel(char *str, struct pt_regs *regs, long err)
247 247
248 oops_in_progress = 1; 248 oops_in_progress = 1;
249 249
250 oops_enter();
251
250 /* Amuse the user in a SPARC fashion */ 252 /* Amuse the user in a SPARC fashion */
251 if (err) printk( 253 if (err) printk(
252KERN_CRIT " _______________________________ \n" 254KERN_CRIT " _______________________________ \n"
@@ -293,6 +295,7 @@ KERN_CRIT " || ||\n");
293 panic("Fatal exception"); 295 panic("Fatal exception");
294 } 296 }
295 297
298 oops_exit();
296 do_exit(SIGSEGV); 299 do_exit(SIGSEGV);
297} 300}
298 301
@@ -494,7 +497,7 @@ void parisc_terminate(char *msg, struct pt_regs *regs, int code, unsigned long o
494 panic(msg); 497 panic(msg);
495} 498}
496 499
497void handle_interruption(int code, struct pt_regs *regs) 500void notrace handle_interruption(int code, struct pt_regs *regs)
498{ 501{
499 unsigned long fault_address = 0; 502 unsigned long fault_address = 0;
500 unsigned long fault_space = 0; 503 unsigned long fault_space = 0;
diff --git a/arch/parisc/kernel/vmlinux.lds.S b/arch/parisc/kernel/vmlinux.lds.S
index 1a3b6ccd3620..fd2cc4fd2b65 100644
--- a/arch/parisc/kernel/vmlinux.lds.S
+++ b/arch/parisc/kernel/vmlinux.lds.S
@@ -54,6 +54,8 @@ SECTIONS
54 TEXT_TEXT 54 TEXT_TEXT
55 SCHED_TEXT 55 SCHED_TEXT
56 LOCK_TEXT 56 LOCK_TEXT
57 KPROBES_TEXT
58 IRQENTRY_TEXT
57 *(.text.do_softirq) 59 *(.text.do_softirq)
58 *(.text.sys_exit) 60 *(.text.sys_exit)
59 *(.text.do_sigaltstack) 61 *(.text.do_sigaltstack)
diff --git a/arch/parisc/mm/init.c b/arch/parisc/mm/init.c
index 9d704d9831d1..4356ceb1e366 100644
--- a/arch/parisc/mm/init.c
+++ b/arch/parisc/mm/init.c
@@ -456,6 +456,13 @@ void __init mem_init(void)
456{ 456{
457 int codesize, reservedpages, datasize, initsize; 457 int codesize, reservedpages, datasize, initsize;
458 458
459 /* Do sanity checks on page table constants */
460 BUILD_BUG_ON(PTE_ENTRY_SIZE != sizeof(pte_t));
461 BUILD_BUG_ON(PMD_ENTRY_SIZE != sizeof(pmd_t));
462 BUILD_BUG_ON(PGD_ENTRY_SIZE != sizeof(pgd_t));
463 BUILD_BUG_ON(PAGE_SHIFT + BITS_PER_PTE + BITS_PER_PMD + BITS_PER_PGD
464 > BITS_PER_LONG);
465
459 high_memory = __va((max_pfn << PAGE_SHIFT)); 466 high_memory = __va((max_pfn << PAGE_SHIFT));
460 467
461#ifndef CONFIG_DISCONTIGMEM 468#ifndef CONFIG_DISCONTIGMEM
diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
index 45192dce65c4..9e08d8a69fdf 100644
--- a/arch/powerpc/Kconfig
+++ b/arch/powerpc/Kconfig
@@ -346,7 +346,7 @@ config PHYP_DUMP
346 help 346 help
347 Hypervisor-assisted dump is meant to be a kdump replacement 347 Hypervisor-assisted dump is meant to be a kdump replacement
348 offering robustness and speed not possible without system 348 offering robustness and speed not possible without system
349 hypervisor assistence. 349 hypervisor assistance.
350 350
351 If unsure, say "N" 351 If unsure, say "N"
352 352
diff --git a/arch/powerpc/Kconfig.debug b/arch/powerpc/Kconfig.debug
index 6aa0b5e087cd..a1098e23221f 100644
--- a/arch/powerpc/Kconfig.debug
+++ b/arch/powerpc/Kconfig.debug
@@ -27,16 +27,6 @@ config DEBUG_STACK_USAGE
27 27
28 This option will slow down process creation somewhat. 28 This option will slow down process creation somewhat.
29 29
30config DEBUG_PAGEALLOC
31 bool "Debug page memory allocations"
32 depends on DEBUG_KERNEL && !HIBERNATION
33 depends on ARCH_SUPPORTS_DEBUG_PAGEALLOC
34 help
35 Unmap pages from the kernel linear mapping after free_pages().
36 This results in a large slowdown, but helps to find certain types
37 of memory corruptions.
38
39
40config HCALL_STATS 30config HCALL_STATS
41 bool "Hypervisor call instrumentation" 31 bool "Hypervisor call instrumentation"
42 depends on PPC_PSERIES && DEBUG_FS 32 depends on PPC_PSERIES && DEBUG_FS
diff --git a/arch/powerpc/include/asm/mmzone.h b/arch/powerpc/include/asm/mmzone.h
index 19f299b7e256..35acac90c8ca 100644
--- a/arch/powerpc/include/asm/mmzone.h
+++ b/arch/powerpc/include/asm/mmzone.h
@@ -8,6 +8,7 @@
8#define _ASM_MMZONE_H_ 8#define _ASM_MMZONE_H_
9#ifdef __KERNEL__ 9#ifdef __KERNEL__
10 10
11#include <linux/cpumask.h>
11 12
12/* 13/*
13 * generic non-linear memory support: 14 * generic non-linear memory support:
diff --git a/arch/powerpc/include/asm/ps3.h b/arch/powerpc/include/asm/ps3.h
index 67f1812698d2..cdb6fd814de8 100644
--- a/arch/powerpc/include/asm/ps3.h
+++ b/arch/powerpc/include/asm/ps3.h
@@ -50,6 +50,9 @@ enum ps3_param_av_multi_out {
50 50
51enum ps3_param_av_multi_out ps3_os_area_get_av_multi_out(void); 51enum ps3_param_av_multi_out ps3_os_area_get_av_multi_out(void);
52 52
53extern u64 ps3_os_area_get_rtc_diff(void);
54extern void ps3_os_area_set_rtc_diff(u64 rtc_diff);
55
53/* dma routines */ 56/* dma routines */
54 57
55enum ps3_dma_page_size { 58enum ps3_dma_page_size {
diff --git a/arch/powerpc/include/asm/spinlock.h b/arch/powerpc/include/asm/spinlock.h
index 36864364e601..c3b193121f81 100644
--- a/arch/powerpc/include/asm/spinlock.h
+++ b/arch/powerpc/include/asm/spinlock.h
@@ -287,6 +287,9 @@ static inline void __raw_write_unlock(raw_rwlock_t *rw)
287 rw->lock = 0; 287 rw->lock = 0;
288} 288}
289 289
290#define __raw_read_lock_flags(lock, flags) __raw_read_lock(lock)
291#define __raw_write_lock_flags(lock, flags) __raw_write_lock(lock)
292
290#define _raw_spin_relax(lock) __spin_yield(lock) 293#define _raw_spin_relax(lock) __spin_yield(lock)
291#define _raw_read_relax(lock) __rw_yield(lock) 294#define _raw_read_relax(lock) __rw_yield(lock)
292#define _raw_write_relax(lock) __rw_yield(lock) 295#define _raw_write_relax(lock) __rw_yield(lock)
diff --git a/arch/powerpc/kernel/process.c b/arch/powerpc/kernel/process.c
index eac064948780..7b44a33f03c2 100644
--- a/arch/powerpc/kernel/process.c
+++ b/arch/powerpc/kernel/process.c
@@ -598,7 +598,7 @@ void prepare_to_copy(struct task_struct *tsk)
598/* 598/*
599 * Copy a thread.. 599 * Copy a thread..
600 */ 600 */
601int copy_thread(int nr, unsigned long clone_flags, unsigned long usp, 601int copy_thread(unsigned long clone_flags, unsigned long usp,
602 unsigned long unused, struct task_struct *p, 602 unsigned long unused, struct task_struct *p,
603 struct pt_regs *regs) 603 struct pt_regs *regs)
604{ 604{
diff --git a/arch/powerpc/kernel/time.c b/arch/powerpc/kernel/time.c
index c9564031a2a9..926ea864e34f 100644
--- a/arch/powerpc/kernel/time.c
+++ b/arch/powerpc/kernel/time.c
@@ -1127,3 +1127,19 @@ void div128_by_32(u64 dividend_high, u64 dividend_low,
1127 dr->result_low = ((u64)y << 32) + z; 1127 dr->result_low = ((u64)y << 32) + z;
1128 1128
1129} 1129}
1130
1131static int __init rtc_init(void)
1132{
1133 struct platform_device *pdev;
1134
1135 if (!ppc_md.get_rtc_time)
1136 return -ENODEV;
1137
1138 pdev = platform_device_register_simple("rtc-generic", -1, NULL, 0);
1139 if (IS_ERR(pdev))
1140 return PTR_ERR(pdev);
1141
1142 return 0;
1143}
1144
1145module_init(rtc_init);
diff --git a/arch/powerpc/kernel/vio.c b/arch/powerpc/kernel/vio.c
index d3694498f3af..819e59f6f7c7 100644
--- a/arch/powerpc/kernel/vio.c
+++ b/arch/powerpc/kernel/vio.c
@@ -482,7 +482,7 @@ static void vio_cmo_balance(struct work_struct *work)
482 cmo->excess.size = cmo->entitled - cmo->reserve.size; 482 cmo->excess.size = cmo->entitled - cmo->reserve.size;
483 cmo->excess.free = cmo->excess.size - need; 483 cmo->excess.free = cmo->excess.size - need;
484 484
485 cancel_delayed_work(container_of(work, struct delayed_work, work)); 485 cancel_delayed_work(to_delayed_work(work));
486 spin_unlock_irqrestore(&vio_cmo.lock, flags); 486 spin_unlock_irqrestore(&vio_cmo.lock, flags);
487} 487}
488 488
diff --git a/arch/powerpc/platforms/Kconfig b/arch/powerpc/platforms/Kconfig
index ffa2a9fd53d0..e3e87078d03f 100644
--- a/arch/powerpc/platforms/Kconfig
+++ b/arch/powerpc/platforms/Kconfig
@@ -293,7 +293,7 @@ config CPM
293config OF_RTC 293config OF_RTC
294 bool 294 bool
295 help 295 help
296 Uses information from the OF or flattened device tree to instatiate 296 Uses information from the OF or flattened device tree to instantiate
297 platform devices for direct mapped RTC chips like the DS1742 or DS1743. 297 platform devices for direct mapped RTC chips like the DS1742 or DS1743.
298 298
299source "arch/powerpc/sysdev/bestcomm/Kconfig" 299source "arch/powerpc/sysdev/bestcomm/Kconfig"
diff --git a/arch/powerpc/platforms/cell/spufs/inode.c b/arch/powerpc/platforms/cell/spufs/inode.c
index 64f068540d0d..706eb5c7e2ee 100644
--- a/arch/powerpc/platforms/cell/spufs/inode.c
+++ b/arch/powerpc/platforms/cell/spufs/inode.c
@@ -635,7 +635,7 @@ long spufs_create(struct nameidata *nd, unsigned int flags, mode_t mode,
635 if (dentry->d_inode) 635 if (dentry->d_inode)
636 goto out_dput; 636 goto out_dput;
637 637
638 mode &= ~current->fs->umask; 638 mode &= ~current_umask();
639 639
640 if (flags & SPU_CREATE_GANG) 640 if (flags & SPU_CREATE_GANG)
641 ret = spufs_create_gang(nd->path.dentry->d_inode, 641 ret = spufs_create_gang(nd->path.dentry->d_inode,
diff --git a/arch/powerpc/platforms/ps3/os-area.c b/arch/powerpc/platforms/ps3/os-area.c
index e1c83c23b435..86e392b1b049 100644
--- a/arch/powerpc/platforms/ps3/os-area.c
+++ b/arch/powerpc/platforms/ps3/os-area.c
@@ -808,6 +808,7 @@ u64 ps3_os_area_get_rtc_diff(void)
808{ 808{
809 return saved_params.rtc_diff; 809 return saved_params.rtc_diff;
810} 810}
811EXPORT_SYMBOL(ps3_os_area_get_rtc_diff);
811 812
812/** 813/**
813 * ps3_os_area_set_rtc_diff - Set the rtc diff value. 814 * ps3_os_area_set_rtc_diff - Set the rtc diff value.
@@ -823,6 +824,7 @@ void ps3_os_area_set_rtc_diff(u64 rtc_diff)
823 os_area_queue_work(); 824 os_area_queue_work();
824 } 825 }
825} 826}
827EXPORT_SYMBOL(ps3_os_area_set_rtc_diff);
826 828
827/** 829/**
828 * ps3_os_area_get_av_multi_out - Returns the default video mode. 830 * ps3_os_area_get_av_multi_out - Returns the default video mode.
diff --git a/arch/powerpc/platforms/ps3/platform.h b/arch/powerpc/platforms/ps3/platform.h
index 235c13ebacd9..136aa0637d9c 100644
--- a/arch/powerpc/platforms/ps3/platform.h
+++ b/arch/powerpc/platforms/ps3/platform.h
@@ -64,8 +64,6 @@ int ps3_set_rtc_time(struct rtc_time *time);
64 64
65void __init ps3_os_area_save_params(void); 65void __init ps3_os_area_save_params(void);
66void __init ps3_os_area_init(void); 66void __init ps3_os_area_init(void);
67u64 ps3_os_area_get_rtc_diff(void);
68void ps3_os_area_set_rtc_diff(u64 rtc_diff);
69 67
70/* spu */ 68/* spu */
71 69
diff --git a/arch/powerpc/platforms/ps3/setup.c b/arch/powerpc/platforms/ps3/setup.c
index 3331ccbb8d38..66181821322a 100644
--- a/arch/powerpc/platforms/ps3/setup.c
+++ b/arch/powerpc/platforms/ps3/setup.c
@@ -270,8 +270,6 @@ define_machine(ps3) {
270 .init_IRQ = ps3_init_IRQ, 270 .init_IRQ = ps3_init_IRQ,
271 .panic = ps3_panic, 271 .panic = ps3_panic,
272 .get_boot_time = ps3_get_boot_time, 272 .get_boot_time = ps3_get_boot_time,
273 .set_rtc_time = ps3_set_rtc_time,
274 .get_rtc_time = ps3_get_rtc_time,
275 .set_dabr = ps3_set_dabr, 273 .set_dabr = ps3_set_dabr,
276 .calibrate_decr = ps3_calibrate_decr, 274 .calibrate_decr = ps3_calibrate_decr,
277 .progress = ps3_progress, 275 .progress = ps3_progress,
diff --git a/arch/powerpc/platforms/ps3/time.c b/arch/powerpc/platforms/ps3/time.c
index d0daf7d6d3b2..b178a1e66c91 100644
--- a/arch/powerpc/platforms/ps3/time.c
+++ b/arch/powerpc/platforms/ps3/time.c
@@ -19,6 +19,7 @@
19 */ 19 */
20 20
21#include <linux/kernel.h> 21#include <linux/kernel.h>
22#include <linux/platform_device.h>
22 23
23#include <asm/rtc.h> 24#include <asm/rtc.h>
24#include <asm/lv1call.h> 25#include <asm/lv1call.h>
@@ -74,23 +75,20 @@ static u64 read_rtc(void)
74 return rtc_val; 75 return rtc_val;
75} 76}
76 77
77int ps3_set_rtc_time(struct rtc_time *tm) 78unsigned long __init ps3_get_boot_time(void)
78{ 79{
79 u64 now = mktime(tm->tm_year + 1900, tm->tm_mon + 1, tm->tm_mday, 80 return read_rtc() + ps3_os_area_get_rtc_diff();
80 tm->tm_hour, tm->tm_min, tm->tm_sec);
81
82 ps3_os_area_set_rtc_diff(now - read_rtc());
83 return 0;
84} 81}
85 82
86void ps3_get_rtc_time(struct rtc_time *tm) 83static int __init ps3_rtc_init(void)
87{ 84{
88 to_tm(read_rtc() + ps3_os_area_get_rtc_diff(), tm); 85 struct platform_device *pdev;
89 tm->tm_year -= 1900;
90 tm->tm_mon -= 1;
91}
92 86
93unsigned long __init ps3_get_boot_time(void) 87 pdev = platform_device_register_simple("rtc-ps3", -1, NULL, 0);
94{ 88 if (IS_ERR(pdev))
95 return read_rtc() + ps3_os_area_get_rtc_diff(); 89 return PTR_ERR(pdev);
90
91 return 0;
96} 92}
93
94module_init(ps3_rtc_init);
diff --git a/arch/powerpc/sysdev/bestcomm/Kconfig b/arch/powerpc/sysdev/bestcomm/Kconfig
index 0b192a1c429d..29e427085efb 100644
--- a/arch/powerpc/sysdev/bestcomm/Kconfig
+++ b/arch/powerpc/sysdev/bestcomm/Kconfig
@@ -9,8 +9,8 @@ config PPC_BESTCOMM
9 select PPC_LIB_RHEAP 9 select PPC_LIB_RHEAP
10 help 10 help
11 BestComm is the name of the communication coprocessor found 11 BestComm is the name of the communication coprocessor found
12 on the Freescale MPC5200 family of processor. It's usage is 12 on the Freescale MPC5200 family of processor. Its usage is
13 optionnal for some drivers (like ATA), but required for 13 optional for some drivers (like ATA), but required for
14 others (like FEC). 14 others (like FEC).
15 15
16 If you want to use drivers that require DMA operations, 16 If you want to use drivers that require DMA operations,
diff --git a/arch/s390/Kconfig.debug b/arch/s390/Kconfig.debug
index 7e297a3cde34..2283933a9a93 100644
--- a/arch/s390/Kconfig.debug
+++ b/arch/s390/Kconfig.debug
@@ -6,13 +6,4 @@ config TRACE_IRQFLAGS_SUPPORT
6 6
7source "lib/Kconfig.debug" 7source "lib/Kconfig.debug"
8 8
9config DEBUG_PAGEALLOC
10 bool "Debug page memory allocations"
11 depends on DEBUG_KERNEL
12 depends on ARCH_SUPPORTS_DEBUG_PAGEALLOC
13 help
14 Unmap pages from the kernel linear mapping after free_pages().
15 This results in a slowdown, but helps to find certain types of
16 memory corruptions.
17
18endmenu 9endmenu
diff --git a/arch/s390/include/asm/smp.h b/arch/s390/include/asm/smp.h
index 2009158a4502..72137bc907ac 100644
--- a/arch/s390/include/asm/smp.h
+++ b/arch/s390/include/asm/smp.h
@@ -92,12 +92,6 @@ extern void arch_send_call_function_ipi(cpumask_t mask);
92#endif 92#endif
93 93
94#ifndef CONFIG_SMP 94#ifndef CONFIG_SMP
95static inline void smp_send_stop(void)
96{
97 /* Disable all interrupts/machine checks */
98 __load_psw_mask(psw_kernel_bits & ~PSW_MASK_MCHECK);
99}
100
101#define hard_smp_processor_id() 0 95#define hard_smp_processor_id() 0
102#define smp_cpu_not_running(cpu) 1 96#define smp_cpu_not_running(cpu) 1
103#endif 97#endif
diff --git a/arch/s390/include/asm/spinlock.h b/arch/s390/include/asm/spinlock.h
index df84ae96915f..f3861b09ebb0 100644
--- a/arch/s390/include/asm/spinlock.h
+++ b/arch/s390/include/asm/spinlock.h
@@ -172,6 +172,9 @@ static inline int __raw_write_trylock(raw_rwlock_t *rw)
172 return _raw_write_trylock_retry(rw); 172 return _raw_write_trylock_retry(rw);
173} 173}
174 174
175#define __raw_read_lock_flags(lock, flags) __raw_read_lock(lock)
176#define __raw_write_lock_flags(lock, flags) __raw_write_lock(lock)
177
175#define _raw_read_relax(lock) cpu_relax() 178#define _raw_read_relax(lock) cpu_relax()
176#define _raw_write_relax(lock) cpu_relax() 179#define _raw_write_relax(lock) cpu_relax()
177 180
diff --git a/arch/s390/kernel/process.c b/arch/s390/kernel/process.c
index b48e961a38f6..a3acd8e60aff 100644
--- a/arch/s390/kernel/process.c
+++ b/arch/s390/kernel/process.c
@@ -160,7 +160,7 @@ void release_thread(struct task_struct *dead_task)
160{ 160{
161} 161}
162 162
163int copy_thread(int nr, unsigned long clone_flags, unsigned long new_stackp, 163int copy_thread(unsigned long clone_flags, unsigned long new_stackp,
164 unsigned long unused, 164 unsigned long unused,
165 struct task_struct *p, struct pt_regs *regs) 165 struct task_struct *p, struct pt_regs *regs)
166{ 166{
diff --git a/arch/sh/Kconfig b/arch/sh/Kconfig
index 8d50d527c595..2d52b515c241 100644
--- a/arch/sh/Kconfig
+++ b/arch/sh/Kconfig
@@ -640,10 +640,10 @@ config GUSA_RB
640 depends on GUSA && CPU_SH3 || (CPU_SH4 && !CPU_SH4A) 640 depends on GUSA && CPU_SH3 || (CPU_SH4 && !CPU_SH4A)
641 help 641 help
642 Enabling this option will allow the kernel to implement some 642 Enabling this option will allow the kernel to implement some
643 atomic operations using a software implemention of load-locked/ 643 atomic operations using a software implementation of load-locked/
644 store-conditional (LLSC). On machines which do not have hardware 644 store-conditional (LLSC). On machines which do not have hardware
645 LLSC, this should be more efficient than the other alternative of 645 LLSC, this should be more efficient than the other alternative of
646 disabling insterrupts around the atomic sequence. 646 disabling interrupts around the atomic sequence.
647 647
648endmenu 648endmenu
649 649
diff --git a/arch/sh/include/asm/spinlock.h b/arch/sh/include/asm/spinlock.h
index e793181d64da..60283565f89b 100644
--- a/arch/sh/include/asm/spinlock.h
+++ b/arch/sh/include/asm/spinlock.h
@@ -216,6 +216,9 @@ static inline int __raw_write_trylock(raw_rwlock_t *rw)
216 return (oldval > (RW_LOCK_BIAS - 1)); 216 return (oldval > (RW_LOCK_BIAS - 1));
217} 217}
218 218
219#define __raw_read_lock_flags(lock, flags) __raw_read_lock(lock)
220#define __raw_write_lock_flags(lock, flags) __raw_write_lock(lock)
221
219#define _raw_spin_relax(lock) cpu_relax() 222#define _raw_spin_relax(lock) cpu_relax()
220#define _raw_read_relax(lock) cpu_relax() 223#define _raw_read_relax(lock) cpu_relax()
221#define _raw_write_relax(lock) cpu_relax() 224#define _raw_write_relax(lock) cpu_relax()
diff --git a/arch/sh/kernel/process_32.c b/arch/sh/kernel/process_32.c
index ddafbbbab2ab..694bc15f84fd 100644
--- a/arch/sh/kernel/process_32.c
+++ b/arch/sh/kernel/process_32.c
@@ -170,7 +170,7 @@ int dump_fpu(struct pt_regs *regs, elf_fpregset_t *fpu)
170 170
171asmlinkage void ret_from_fork(void); 171asmlinkage void ret_from_fork(void);
172 172
173int copy_thread(int nr, unsigned long clone_flags, unsigned long usp, 173int copy_thread(unsigned long clone_flags, unsigned long usp,
174 unsigned long unused, 174 unsigned long unused,
175 struct task_struct *p, struct pt_regs *regs) 175 struct task_struct *p, struct pt_regs *regs)
176{ 176{
diff --git a/arch/sh/kernel/process_64.c b/arch/sh/kernel/process_64.c
index c90c7e5e5fee..96be839040f8 100644
--- a/arch/sh/kernel/process_64.c
+++ b/arch/sh/kernel/process_64.c
@@ -425,7 +425,7 @@ int dump_fpu(struct pt_regs *regs, elf_fpregset_t *fpu)
425 425
426asmlinkage void ret_from_fork(void); 426asmlinkage void ret_from_fork(void);
427 427
428int copy_thread(int nr, unsigned long clone_flags, unsigned long usp, 428int copy_thread(unsigned long clone_flags, unsigned long usp,
429 unsigned long unused, 429 unsigned long unused,
430 struct task_struct *p, struct pt_regs *regs) 430 struct task_struct *p, struct pt_regs *regs)
431{ 431{
diff --git a/arch/sparc/Kconfig.debug b/arch/sparc/Kconfig.debug
index d001b42041a5..90d5fe223a74 100644
--- a/arch/sparc/Kconfig.debug
+++ b/arch/sparc/Kconfig.debug
@@ -22,15 +22,6 @@ config DEBUG_DCFLUSH
22config STACK_DEBUG 22config STACK_DEBUG
23 bool "Stack Overflow Detection Support" 23 bool "Stack Overflow Detection Support"
24 24
25config DEBUG_PAGEALLOC
26 bool "Debug page memory allocations"
27 depends on DEBUG_KERNEL && !HIBERNATION
28 depends on ARCH_SUPPORTS_DEBUG_PAGEALLOC
29 help
30 Unmap pages from the kernel linear mapping after free_pages().
31 This results in a large slowdown, but helps to find certain types
32 of memory corruptions.
33
34config MCOUNT 25config MCOUNT
35 bool 26 bool
36 depends on SPARC64 27 depends on SPARC64
diff --git a/arch/sparc/include/asm/mmzone.h b/arch/sparc/include/asm/mmzone.h
index ebf5986c12ed..e8c648741ed4 100644
--- a/arch/sparc/include/asm/mmzone.h
+++ b/arch/sparc/include/asm/mmzone.h
@@ -3,6 +3,8 @@
3 3
4#ifdef CONFIG_NEED_MULTIPLE_NODES 4#ifdef CONFIG_NEED_MULTIPLE_NODES
5 5
6#include <linux/cpumask.h>
7
6extern struct pglist_data *node_data[]; 8extern struct pglist_data *node_data[];
7 9
8#define NODE_DATA(nid) (node_data[nid]) 10#define NODE_DATA(nid) (node_data[nid])
diff --git a/arch/sparc/include/asm/spinlock_32.h b/arch/sparc/include/asm/spinlock_32.h
index bf2d532593e3..46f91ab66a50 100644
--- a/arch/sparc/include/asm/spinlock_32.h
+++ b/arch/sparc/include/asm/spinlock_32.h
@@ -177,6 +177,8 @@ static inline int __read_trylock(raw_rwlock_t *rw)
177#define __raw_write_unlock(rw) do { (rw)->lock = 0; } while(0) 177#define __raw_write_unlock(rw) do { (rw)->lock = 0; } while(0)
178 178
179#define __raw_spin_lock_flags(lock, flags) __raw_spin_lock(lock) 179#define __raw_spin_lock_flags(lock, flags) __raw_spin_lock(lock)
180#define __raw_read_lock_flags(rw, flags) __raw_read_lock(rw)
181#define __raw_write_lock_flags(rw, flags) __raw_write_lock(rw)
180 182
181#define _raw_spin_relax(lock) cpu_relax() 183#define _raw_spin_relax(lock) cpu_relax()
182#define _raw_read_relax(lock) cpu_relax() 184#define _raw_read_relax(lock) cpu_relax()
diff --git a/arch/sparc/include/asm/spinlock_64.h b/arch/sparc/include/asm/spinlock_64.h
index c4d274d330e9..f6b2b92ad8d2 100644
--- a/arch/sparc/include/asm/spinlock_64.h
+++ b/arch/sparc/include/asm/spinlock_64.h
@@ -211,9 +211,11 @@ static int inline __write_trylock(raw_rwlock_t *lock)
211} 211}
212 212
213#define __raw_read_lock(p) __read_lock(p) 213#define __raw_read_lock(p) __read_lock(p)
214#define __raw_read_lock_flags(p, f) __read_lock(p)
214#define __raw_read_trylock(p) __read_trylock(p) 215#define __raw_read_trylock(p) __read_trylock(p)
215#define __raw_read_unlock(p) __read_unlock(p) 216#define __raw_read_unlock(p) __read_unlock(p)
216#define __raw_write_lock(p) __write_lock(p) 217#define __raw_write_lock(p) __write_lock(p)
218#define __raw_write_lock_flags(p, f) __write_lock(p)
217#define __raw_write_unlock(p) __write_unlock(p) 219#define __raw_write_unlock(p) __write_unlock(p)
218#define __raw_write_trylock(p) __write_trylock(p) 220#define __raw_write_trylock(p) __write_trylock(p)
219 221
diff --git a/arch/sparc/kernel/head_64.S b/arch/sparc/kernel/head_64.S
index a46c3a21e26d..3a1b7bf03cff 100644
--- a/arch/sparc/kernel/head_64.S
+++ b/arch/sparc/kernel/head_64.S
@@ -686,7 +686,7 @@ tlb_fixup_done:
686 * point. 686 * point.
687 * 687 *
688 * There used to be enormous complexity wrt. transferring 688 * There used to be enormous complexity wrt. transferring
689 * over from the firwmare's trap table to the Linux kernel's. 689 * over from the firmware's trap table to the Linux kernel's.
690 * For example, there was a chicken & egg problem wrt. building 690 * For example, there was a chicken & egg problem wrt. building
691 * the OBP page tables, yet needing to be on the Linux kernel 691 * the OBP page tables, yet needing to be on the Linux kernel
692 * trap table (to translate PAGE_OFFSET addresses) in order to 692 * trap table (to translate PAGE_OFFSET addresses) in order to
diff --git a/arch/sparc/kernel/process_32.c b/arch/sparc/kernel/process_32.c
index f4bee35a1b46..2830b415e214 100644
--- a/arch/sparc/kernel/process_32.c
+++ b/arch/sparc/kernel/process_32.c
@@ -455,7 +455,7 @@ asmlinkage int sparc_do_fork(unsigned long clone_flags,
455 */ 455 */
456extern void ret_from_fork(void); 456extern void ret_from_fork(void);
457 457
458int copy_thread(int nr, unsigned long clone_flags, unsigned long sp, 458int copy_thread(unsigned long clone_flags, unsigned long sp,
459 unsigned long unused, 459 unsigned long unused,
460 struct task_struct *p, struct pt_regs *regs) 460 struct task_struct *p, struct pt_regs *regs)
461{ 461{
diff --git a/arch/sparc/kernel/process_64.c b/arch/sparc/kernel/process_64.c
index a73954b87f0a..4041f94e7724 100644
--- a/arch/sparc/kernel/process_64.c
+++ b/arch/sparc/kernel/process_64.c
@@ -561,7 +561,7 @@ asmlinkage long sparc_do_fork(unsigned long clone_flags,
561 * Parent --> %o0 == childs pid, %o1 == 0 561 * Parent --> %o0 == childs pid, %o1 == 0
562 * Child --> %o0 == parents pid, %o1 == 1 562 * Child --> %o0 == parents pid, %o1 == 1
563 */ 563 */
564int copy_thread(int nr, unsigned long clone_flags, unsigned long sp, 564int copy_thread(unsigned long clone_flags, unsigned long sp,
565 unsigned long unused, 565 unsigned long unused,
566 struct task_struct *p, struct pt_regs *regs) 566 struct task_struct *p, struct pt_regs *regs)
567{ 567{
diff --git a/arch/um/drivers/net_kern.c b/arch/um/drivers/net_kern.c
index 434224e2229f..434ba121e3c5 100644
--- a/arch/um/drivers/net_kern.c
+++ b/arch/um/drivers/net_kern.c
@@ -757,7 +757,7 @@ static int uml_inetaddr_event(struct notifier_block *this, unsigned long event,
757 void (*proc)(unsigned char *, unsigned char *, void *); 757 void (*proc)(unsigned char *, unsigned char *, void *);
758 unsigned char addr_buf[4], netmask_buf[4]; 758 unsigned char addr_buf[4], netmask_buf[4];
759 759
760 if (dev->open != uml_net_open) 760 if (dev->netdev_ops->ndo_open != uml_net_open)
761 return NOTIFY_DONE; 761 return NOTIFY_DONE;
762 762
763 lp = netdev_priv(dev); 763 lp = netdev_priv(dev);
diff --git a/arch/um/drivers/ubd_kern.c b/arch/um/drivers/ubd_kern.c
index d42f826a8ab9..f934225fd8ef 100644
--- a/arch/um/drivers/ubd_kern.c
+++ b/arch/um/drivers/ubd_kern.c
@@ -22,6 +22,7 @@
22#include "linux/kernel.h" 22#include "linux/kernel.h"
23#include "linux/module.h" 23#include "linux/module.h"
24#include "linux/blkdev.h" 24#include "linux/blkdev.h"
25#include "linux/ata.h"
25#include "linux/hdreg.h" 26#include "linux/hdreg.h"
26#include "linux/init.h" 27#include "linux/init.h"
27#include "linux/cdrom.h" 28#include "linux/cdrom.h"
@@ -1308,16 +1309,15 @@ static int ubd_ioctl(struct block_device *bdev, fmode_t mode,
1308 unsigned int cmd, unsigned long arg) 1309 unsigned int cmd, unsigned long arg)
1309{ 1310{
1310 struct ubd *ubd_dev = bdev->bd_disk->private_data; 1311 struct ubd *ubd_dev = bdev->bd_disk->private_data;
1311 struct hd_driveid ubd_id = { 1312 u16 ubd_id[ATA_ID_WORDS];
1312 .cyls = 0,
1313 .heads = 128,
1314 .sectors = 32,
1315 };
1316 1313
1317 switch (cmd) { 1314 switch (cmd) {
1318 struct cdrom_volctrl volume; 1315 struct cdrom_volctrl volume;
1319 case HDIO_GET_IDENTITY: 1316 case HDIO_GET_IDENTITY:
1320 ubd_id.cyls = ubd_dev->size / (128 * 32 * 512); 1317 memset(&ubd_id, 0, ATA_ID_WORDS * 2);
1318 ubd_id[ATA_ID_CYLS] = ubd_dev->size / (128 * 32 * 512);
1319 ubd_id[ATA_ID_HEADS] = 128;
1320 ubd_id[ATA_ID_SECTORS] = 32;
1321 if(copy_to_user((char __user *) arg, (char *) &ubd_id, 1321 if(copy_to_user((char __user *) arg, (char *) &ubd_id,
1322 sizeof(ubd_id))) 1322 sizeof(ubd_id)))
1323 return -EFAULT; 1323 return -EFAULT;
diff --git a/arch/um/kernel/process.c b/arch/um/kernel/process.c
index a1c6d07cac3e..4a28a1568d85 100644
--- a/arch/um/kernel/process.c
+++ b/arch/um/kernel/process.c
@@ -179,7 +179,7 @@ void fork_handler(void)
179 userspace(&current->thread.regs.regs); 179 userspace(&current->thread.regs.regs);
180} 180}
181 181
182int copy_thread(int nr, unsigned long clone_flags, unsigned long sp, 182int copy_thread(unsigned long clone_flags, unsigned long sp,
183 unsigned long stack_top, struct task_struct * p, 183 unsigned long stack_top, struct task_struct * p,
184 struct pt_regs *regs) 184 struct pt_regs *regs)
185{ 185{
diff --git a/arch/um/kernel/syscall.c b/arch/um/kernel/syscall.c
index c4df705b8359..a4625c7b2bf9 100644
--- a/arch/um/kernel/syscall.c
+++ b/arch/um/kernel/syscall.c
@@ -127,7 +127,8 @@ int kernel_execve(const char *filename, char *const argv[], char *const envp[])
127 127
128 fs = get_fs(); 128 fs = get_fs();
129 set_fs(KERNEL_DS); 129 set_fs(KERNEL_DS);
130 ret = um_execve(filename, argv, envp); 130 ret = um_execve((char *)filename, (char __user *__user *)argv,
131 (char __user *__user *) envp);
131 set_fs(fs); 132 set_fs(fs);
132 133
133 return ret; 134 return ret;
diff --git a/arch/um/sys-i386/sys_call_table.S b/arch/um/sys-i386/sys_call_table.S
index 00e5f5203eea..c6260dd6ebb9 100644
--- a/arch/um/sys-i386/sys_call_table.S
+++ b/arch/um/sys-i386/sys_call_table.S
@@ -9,6 +9,17 @@
9 9
10#define old_mmap old_mmap_i386 10#define old_mmap old_mmap_i386
11 11
12#define ptregs_fork sys_fork
13#define ptregs_execve sys_execve
14#define ptregs_iopl sys_iopl
15#define ptregs_vm86old sys_vm86old
16#define ptregs_sigreturn sys_sigreturn
17#define ptregs_clone sys_clone
18#define ptregs_vm86 sys_vm86
19#define ptregs_rt_sigreturn sys_rt_sigreturn
20#define ptregs_sigaltstack sys_sigaltstack
21#define ptregs_vfork sys_vfork
22
12.section .rodata,"a" 23.section .rodata,"a"
13 24
14#include "../../x86/kernel/syscall_table_32.S" 25#include "../../x86/kernel/syscall_table_32.S"
diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index 0885245e6808..5b2196ab8168 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -1146,7 +1146,7 @@ config NODES_SHIFT
1146 depends on NEED_MULTIPLE_NODES 1146 depends on NEED_MULTIPLE_NODES
1147 ---help--- 1147 ---help---
1148 Specify the maximum number of NUMA Nodes available on the target 1148 Specify the maximum number of NUMA Nodes available on the target
1149 system. Increases memory reserved to accomodate various tables. 1149 system. Increases memory reserved to accommodate various tables.
1150 1150
1151config HAVE_ARCH_BOOTMEM 1151config HAVE_ARCH_BOOTMEM
1152 def_bool y 1152 def_bool y
@@ -1324,7 +1324,7 @@ config MTRR_SANITIZER
1324 add writeback entries. 1324 add writeback entries.
1325 1325
1326 Can be disabled with disable_mtrr_cleanup on the kernel command line. 1326 Can be disabled with disable_mtrr_cleanup on the kernel command line.
1327 The largest mtrr entry size for a continous block can be set with 1327 The largest mtrr entry size for a continuous block can be set with
1328 mtrr_chunk_size. 1328 mtrr_chunk_size.
1329 1329
1330 If unsure, say Y. 1330 If unsure, say Y.
@@ -1839,8 +1839,8 @@ config PCI_MMCONFIG
1839 1839
1840config DMAR 1840config DMAR
1841 bool "Support for DMA Remapping Devices (EXPERIMENTAL)" 1841 bool "Support for DMA Remapping Devices (EXPERIMENTAL)"
1842 depends on X86_64 && PCI_MSI && ACPI && EXPERIMENTAL 1842 depends on PCI_MSI && ACPI && EXPERIMENTAL
1843 ---help--- 1843 help
1844 DMA remapping (DMAR) devices support enables independent address 1844 DMA remapping (DMAR) devices support enables independent address
1845 translations for Direct Memory Access (DMA) from devices. 1845 translations for Direct Memory Access (DMA) from devices.
1846 These DMA remapping devices are reported via ACPI tables 1846 These DMA remapping devices are reported via ACPI tables
diff --git a/arch/x86/Kconfig.debug b/arch/x86/Kconfig.debug
index a345cb5447a8..d8359e73317f 100644
--- a/arch/x86/Kconfig.debug
+++ b/arch/x86/Kconfig.debug
@@ -72,15 +72,6 @@ config DEBUG_STACK_USAGE
72 72
73 This option will slow down process creation somewhat. 73 This option will slow down process creation somewhat.
74 74
75config DEBUG_PAGEALLOC
76 bool "Debug page memory allocations"
77 depends on DEBUG_KERNEL
78 depends on ARCH_SUPPORTS_DEBUG_PAGEALLOC
79 ---help---
80 Unmap pages from the kernel linear mapping after free_pages().
81 This results in a large slowdown, but helps to find certain types
82 of memory corruptions.
83
84config DEBUG_PER_CPU_MAPS 75config DEBUG_PER_CPU_MAPS
85 bool "Debug access to per_cpu maps" 76 bool "Debug access to per_cpu maps"
86 depends on DEBUG_KERNEL 77 depends on DEBUG_KERNEL
diff --git a/arch/x86/boot/Makefile b/arch/x86/boot/Makefile
index fb737ce5888d..6633b6e7505a 100644
--- a/arch/x86/boot/Makefile
+++ b/arch/x86/boot/Makefile
@@ -57,6 +57,7 @@ $(obj)/cpustr.h: $(obj)/mkcpustr FORCE
57# How to compile the 16-bit code. Note we always compile for -march=i386, 57# How to compile the 16-bit code. Note we always compile for -march=i386,
58# that way we can complain to the user if the CPU is insufficient. 58# that way we can complain to the user if the CPU is insufficient.
59KBUILD_CFLAGS := $(LINUXINCLUDE) -g -Os -D_SETUP -D__KERNEL__ \ 59KBUILD_CFLAGS := $(LINUXINCLUDE) -g -Os -D_SETUP -D__KERNEL__ \
60 -DDISABLE_BRANCH_PROFILING \
60 -Wall -Wstrict-prototypes \ 61 -Wall -Wstrict-prototypes \
61 -march=i386 -mregparm=3 \ 62 -march=i386 -mregparm=3 \
62 -include $(srctree)/$(src)/code16gcc.h \ 63 -include $(srctree)/$(src)/code16gcc.h \
@@ -66,7 +67,7 @@ KBUILD_CFLAGS := $(LINUXINCLUDE) -g -Os -D_SETUP -D__KERNEL__ \
66 $(call cc-option, -fno-unit-at-a-time)) \ 67 $(call cc-option, -fno-unit-at-a-time)) \
67 $(call cc-option, -fno-stack-protector) \ 68 $(call cc-option, -fno-stack-protector) \
68 $(call cc-option, -mpreferred-stack-boundary=2) 69 $(call cc-option, -mpreferred-stack-boundary=2)
69KBUILD_CFLAGS += $(call cc-option,-m32) 70KBUILD_CFLAGS += $(call cc-option, -m32)
70KBUILD_AFLAGS := $(KBUILD_CFLAGS) -D__ASSEMBLY__ 71KBUILD_AFLAGS := $(KBUILD_CFLAGS) -D__ASSEMBLY__
71 72
72$(obj)/bzImage: asflags-y := $(SVGA_MODE) 73$(obj)/bzImage: asflags-y := $(SVGA_MODE)
diff --git a/arch/x86/boot/compressed/Makefile b/arch/x86/boot/compressed/Makefile
index 3ca4c194b8e5..65551c9f8571 100644
--- a/arch/x86/boot/compressed/Makefile
+++ b/arch/x86/boot/compressed/Makefile
@@ -8,6 +8,7 @@ targets := vmlinux vmlinux.bin vmlinux.bin.gz vmlinux.bin.bz2 vmlinux.bin.lzma h
8 8
9KBUILD_CFLAGS := -m$(BITS) -D__KERNEL__ $(LINUX_INCLUDE) -O2 9KBUILD_CFLAGS := -m$(BITS) -D__KERNEL__ $(LINUX_INCLUDE) -O2
10KBUILD_CFLAGS += -fno-strict-aliasing -fPIC 10KBUILD_CFLAGS += -fno-strict-aliasing -fPIC
11KBUILD_CFLAGS += -DDISABLE_BRANCH_PROFILING
11cflags-$(CONFIG_X86_64) := -mcmodel=small 12cflags-$(CONFIG_X86_64) := -mcmodel=small
12KBUILD_CFLAGS += $(cflags-y) 13KBUILD_CFLAGS += $(cflags-y)
13KBUILD_CFLAGS += $(call cc-option,-ffreestanding) 14KBUILD_CFLAGS += $(call cc-option,-ffreestanding)
diff --git a/arch/x86/boot/memory.c b/arch/x86/boot/memory.c
index 8c3c25f35578..5054c2ddd1a0 100644
--- a/arch/x86/boot/memory.c
+++ b/arch/x86/boot/memory.c
@@ -2,6 +2,7 @@
2 * 2 *
3 * Copyright (C) 1991, 1992 Linus Torvalds 3 * Copyright (C) 1991, 1992 Linus Torvalds
4 * Copyright 2007 rPath, Inc. - All Rights Reserved 4 * Copyright 2007 rPath, Inc. - All Rights Reserved
5 * Copyright 2009 Intel Corporation; author H. Peter Anvin
5 * 6 *
6 * This file is part of the Linux kernel, and is made available under 7 * This file is part of the Linux kernel, and is made available under
7 * the terms of the GNU General Public License version 2. 8 * the terms of the GNU General Public License version 2.
@@ -16,24 +17,38 @@
16 17
17#define SMAP 0x534d4150 /* ASCII "SMAP" */ 18#define SMAP 0x534d4150 /* ASCII "SMAP" */
18 19
20struct e820_ext_entry {
21 struct e820entry std;
22 u32 ext_flags;
23} __attribute__((packed));
24
19static int detect_memory_e820(void) 25static int detect_memory_e820(void)
20{ 26{
21 int count = 0; 27 int count = 0;
22 u32 next = 0; 28 u32 next = 0;
23 u32 size, id; 29 u32 size, id, edi;
24 u8 err; 30 u8 err;
25 struct e820entry *desc = boot_params.e820_map; 31 struct e820entry *desc = boot_params.e820_map;
32 static struct e820_ext_entry buf; /* static so it is zeroed */
33
34 /*
35 * Set this here so that if the BIOS doesn't change this field
36 * but still doesn't change %ecx, we're still okay...
37 */
38 buf.ext_flags = 1;
26 39
27 do { 40 do {
28 size = sizeof(struct e820entry); 41 size = sizeof buf;
29 42
30 /* Important: %edx is clobbered by some BIOSes, 43 /* Important: %edx and %esi are clobbered by some BIOSes,
31 so it must be either used for the error output 44 so they must be either used for the error output
32 or explicitly marked clobbered. */ 45 or explicitly marked clobbered. Given that, assume there
33 asm("int $0x15; setc %0" 46 is something out there clobbering %ebp and %edi, too. */
47 asm("pushl %%ebp; int $0x15; popl %%ebp; setc %0"
34 : "=d" (err), "+b" (next), "=a" (id), "+c" (size), 48 : "=d" (err), "+b" (next), "=a" (id), "+c" (size),
35 "=m" (*desc) 49 "=D" (edi), "+m" (buf)
36 : "D" (desc), "d" (SMAP), "a" (0xe820)); 50 : "D" (&buf), "d" (SMAP), "a" (0xe820)
51 : "esi");
37 52
38 /* BIOSes which terminate the chain with CF = 1 as opposed 53 /* BIOSes which terminate the chain with CF = 1 as opposed
39 to %ebx = 0 don't always report the SMAP signature on 54 to %ebx = 0 don't always report the SMAP signature on
@@ -51,8 +66,14 @@ static int detect_memory_e820(void)
51 break; 66 break;
52 } 67 }
53 68
69 /* ACPI 3.0 added the extended flags support. If bit 0
70 in the extended flags is zero, we're supposed to simply
71 ignore the entry -- a backwards incompatible change! */
72 if (size > 20 && !(buf.ext_flags & 1))
73 continue;
74
75 *desc++ = buf.std;
54 count++; 76 count++;
55 desc++;
56 } while (next && count < ARRAY_SIZE(boot_params.e820_map)); 77 } while (next && count < ARRAY_SIZE(boot_params.e820_map));
57 78
58 return boot_params.e820_entries = count; 79 return boot_params.e820_entries = count;
diff --git a/arch/x86/ia32/ia32entry.S b/arch/x86/ia32/ia32entry.S
index db0c803170ab..a505202086e8 100644
--- a/arch/x86/ia32/ia32entry.S
+++ b/arch/x86/ia32/ia32entry.S
@@ -828,4 +828,6 @@ ia32_sys_call_table:
828 .quad sys_dup3 /* 330 */ 828 .quad sys_dup3 /* 330 */
829 .quad sys_pipe2 829 .quad sys_pipe2
830 .quad sys_inotify_init1 830 .quad sys_inotify_init1
831 .quad compat_sys_preadv
832 .quad compat_sys_pwritev
831ia32_syscall_end: 833ia32_syscall_end:
diff --git a/arch/x86/include/asm/cpumask.h b/arch/x86/include/asm/cpumask.h
index a7f3c75f8ad7..61c852fa346b 100644
--- a/arch/x86/include/asm/cpumask.h
+++ b/arch/x86/include/asm/cpumask.h
@@ -3,8 +3,6 @@
3#ifndef __ASSEMBLY__ 3#ifndef __ASSEMBLY__
4#include <linux/cpumask.h> 4#include <linux/cpumask.h>
5 5
6#ifdef CONFIG_X86_64
7
8extern cpumask_var_t cpu_callin_mask; 6extern cpumask_var_t cpu_callin_mask;
9extern cpumask_var_t cpu_callout_mask; 7extern cpumask_var_t cpu_callout_mask;
10extern cpumask_var_t cpu_initialized_mask; 8extern cpumask_var_t cpu_initialized_mask;
@@ -12,21 +10,5 @@ extern cpumask_var_t cpu_sibling_setup_mask;
12 10
13extern void setup_cpu_local_masks(void); 11extern void setup_cpu_local_masks(void);
14 12
15#else /* CONFIG_X86_32 */
16
17extern cpumask_t cpu_callin_map;
18extern cpumask_t cpu_callout_map;
19extern cpumask_t cpu_initialized;
20extern cpumask_t cpu_sibling_setup_map;
21
22#define cpu_callin_mask ((struct cpumask *)&cpu_callin_map)
23#define cpu_callout_mask ((struct cpumask *)&cpu_callout_map)
24#define cpu_initialized_mask ((struct cpumask *)&cpu_initialized)
25#define cpu_sibling_setup_mask ((struct cpumask *)&cpu_sibling_setup_map)
26
27static inline void setup_cpu_local_masks(void) { }
28
29#endif /* CONFIG_X86_32 */
30
31#endif /* __ASSEMBLY__ */ 13#endif /* __ASSEMBLY__ */
32#endif /* _ASM_X86_CPUMASK_H */ 14#endif /* _ASM_X86_CPUMASK_H */
diff --git a/arch/x86/include/asm/pci.h b/arch/x86/include/asm/pci.h
index a0301bfeb954..b51a1e8b0baf 100644
--- a/arch/x86/include/asm/pci.h
+++ b/arch/x86/include/asm/pci.h
@@ -89,12 +89,40 @@ extern void pci_iommu_alloc(void);
89/* MSI arch hook */ 89/* MSI arch hook */
90#define arch_setup_msi_irqs arch_setup_msi_irqs 90#define arch_setup_msi_irqs arch_setup_msi_irqs
91 91
92#endif /* __KERNEL__ */ 92#define PCI_DMA_BUS_IS_PHYS (dma_ops->is_phys)
93
94#if defined(CONFIG_X86_64) || defined(CONFIG_DMA_API_DEBUG)
95
96#define DECLARE_PCI_UNMAP_ADDR(ADDR_NAME) \
97 dma_addr_t ADDR_NAME;
98#define DECLARE_PCI_UNMAP_LEN(LEN_NAME) \
99 __u32 LEN_NAME;
100#define pci_unmap_addr(PTR, ADDR_NAME) \
101 ((PTR)->ADDR_NAME)
102#define pci_unmap_addr_set(PTR, ADDR_NAME, VAL) \
103 (((PTR)->ADDR_NAME) = (VAL))
104#define pci_unmap_len(PTR, LEN_NAME) \
105 ((PTR)->LEN_NAME)
106#define pci_unmap_len_set(PTR, LEN_NAME, VAL) \
107 (((PTR)->LEN_NAME) = (VAL))
93 108
94#ifdef CONFIG_X86_32
95# include "pci_32.h"
96#else 109#else
97# include "pci_64.h" 110
111#define DECLARE_PCI_UNMAP_ADDR(ADDR_NAME) dma_addr_t ADDR_NAME[0];
112#define DECLARE_PCI_UNMAP_LEN(LEN_NAME) unsigned LEN_NAME[0];
113#define pci_unmap_addr(PTR, ADDR_NAME) sizeof((PTR)->ADDR_NAME)
114#define pci_unmap_addr_set(PTR, ADDR_NAME, VAL) \
115 do { break; } while (pci_unmap_addr(PTR, ADDR_NAME))
116#define pci_unmap_len(PTR, LEN_NAME) sizeof((PTR)->LEN_NAME)
117#define pci_unmap_len_set(PTR, LEN_NAME, VAL) \
118 do { break; } while (pci_unmap_len(PTR, LEN_NAME))
119
120#endif
121
122#endif /* __KERNEL__ */
123
124#ifdef CONFIG_X86_64
125#include "pci_64.h"
98#endif 126#endif
99 127
100/* implement the pci_ DMA API in terms of the generic device dma_ one */ 128/* implement the pci_ DMA API in terms of the generic device dma_ one */
@@ -112,11 +140,6 @@ static inline int __pcibus_to_node(const struct pci_bus *bus)
112 return sd->node; 140 return sd->node;
113} 141}
114 142
115static inline cpumask_t __pcibus_to_cpumask(struct pci_bus *bus)
116{
117 return node_to_cpumask(__pcibus_to_node(bus));
118}
119
120static inline const struct cpumask * 143static inline const struct cpumask *
121cpumask_of_pcibus(const struct pci_bus *bus) 144cpumask_of_pcibus(const struct pci_bus *bus)
122{ 145{
diff --git a/arch/x86/include/asm/pci_32.h b/arch/x86/include/asm/pci_32.h
deleted file mode 100644
index 6f1213a6ef4f..000000000000
--- a/arch/x86/include/asm/pci_32.h
+++ /dev/null
@@ -1,34 +0,0 @@
1#ifndef _ASM_X86_PCI_32_H
2#define _ASM_X86_PCI_32_H
3
4
5#ifdef __KERNEL__
6
7
8/* Dynamic DMA mapping stuff.
9 * i386 has everything mapped statically.
10 */
11
12struct pci_dev;
13
14/* The PCI address space does equal the physical memory
15 * address space. The networking and block device layers use
16 * this boolean for bounce buffer decisions.
17 */
18#define PCI_DMA_BUS_IS_PHYS (1)
19
20/* pci_unmap_{page,single} is a nop so... */
21#define DECLARE_PCI_UNMAP_ADDR(ADDR_NAME) dma_addr_t ADDR_NAME[0];
22#define DECLARE_PCI_UNMAP_LEN(LEN_NAME) unsigned LEN_NAME[0];
23#define pci_unmap_addr(PTR, ADDR_NAME) sizeof((PTR)->ADDR_NAME)
24#define pci_unmap_addr_set(PTR, ADDR_NAME, VAL) \
25 do { break; } while (pci_unmap_addr(PTR, ADDR_NAME))
26#define pci_unmap_len(PTR, LEN_NAME) sizeof((PTR)->LEN_NAME)
27#define pci_unmap_len_set(PTR, LEN_NAME, VAL) \
28 do { break; } while (pci_unmap_len(PTR, LEN_NAME))
29
30
31#endif /* __KERNEL__ */
32
33
34#endif /* _ASM_X86_PCI_32_H */
diff --git a/arch/x86/include/asm/pci_64.h b/arch/x86/include/asm/pci_64.h
index 4da207982777..ae5e40f67daf 100644
--- a/arch/x86/include/asm/pci_64.h
+++ b/arch/x86/include/asm/pci_64.h
@@ -24,28 +24,6 @@ extern int (*pci_config_write)(int seg, int bus, int dev, int fn,
24 24
25extern void dma32_reserve_bootmem(void); 25extern void dma32_reserve_bootmem(void);
26 26
27/* The PCI address space does equal the physical memory
28 * address space. The networking and block device layers use
29 * this boolean for bounce buffer decisions
30 *
31 * On AMD64 it mostly equals, but we set it to zero if a hardware
32 * IOMMU (gart) of sotware IOMMU (swiotlb) is available.
33 */
34#define PCI_DMA_BUS_IS_PHYS (dma_ops->is_phys)
35
36#define DECLARE_PCI_UNMAP_ADDR(ADDR_NAME) \
37 dma_addr_t ADDR_NAME;
38#define DECLARE_PCI_UNMAP_LEN(LEN_NAME) \
39 __u32 LEN_NAME;
40#define pci_unmap_addr(PTR, ADDR_NAME) \
41 ((PTR)->ADDR_NAME)
42#define pci_unmap_addr_set(PTR, ADDR_NAME, VAL) \
43 (((PTR)->ADDR_NAME) = (VAL))
44#define pci_unmap_len(PTR, LEN_NAME) \
45 ((PTR)->LEN_NAME)
46#define pci_unmap_len_set(PTR, LEN_NAME, VAL) \
47 (((PTR)->LEN_NAME) = (VAL))
48
49#endif /* __KERNEL__ */ 27#endif /* __KERNEL__ */
50 28
51#endif /* _ASM_X86_PCI_64_H */ 29#endif /* _ASM_X86_PCI_64_H */
diff --git a/arch/x86/include/asm/processor.h b/arch/x86/include/asm/processor.h
index ae85a8d66a30..34c52370f2fe 100644
--- a/arch/x86/include/asm/processor.h
+++ b/arch/x86/include/asm/processor.h
@@ -94,7 +94,7 @@ struct cpuinfo_x86 {
94 unsigned long loops_per_jiffy; 94 unsigned long loops_per_jiffy;
95#ifdef CONFIG_SMP 95#ifdef CONFIG_SMP
96 /* cpus sharing the last level cache: */ 96 /* cpus sharing the last level cache: */
97 cpumask_t llc_shared_map; 97 cpumask_var_t llc_shared_map;
98#endif 98#endif
99 /* cpuid returned max cores value: */ 99 /* cpuid returned max cores value: */
100 u16 x86_max_cores; 100 u16 x86_max_cores;
@@ -736,6 +736,7 @@ static inline void __sti_mwait(unsigned long eax, unsigned long ecx)
736extern void mwait_idle_with_hints(unsigned long eax, unsigned long ecx); 736extern void mwait_idle_with_hints(unsigned long eax, unsigned long ecx);
737 737
738extern void select_idle_routine(const struct cpuinfo_x86 *c); 738extern void select_idle_routine(const struct cpuinfo_x86 *c);
739extern void init_c1e_mask(void);
739 740
740extern unsigned long boot_option_idle_override; 741extern unsigned long boot_option_idle_override;
741extern unsigned long idle_halt; 742extern unsigned long idle_halt;
diff --git a/arch/x86/include/asm/smp.h b/arch/x86/include/asm/smp.h
index 47d0e21f2b9e..19e0d88b966d 100644
--- a/arch/x86/include/asm/smp.h
+++ b/arch/x86/include/asm/smp.h
@@ -21,19 +21,19 @@
21extern int smp_num_siblings; 21extern int smp_num_siblings;
22extern unsigned int num_processors; 22extern unsigned int num_processors;
23 23
24DECLARE_PER_CPU(cpumask_t, cpu_sibling_map); 24DECLARE_PER_CPU(cpumask_var_t, cpu_sibling_map);
25DECLARE_PER_CPU(cpumask_t, cpu_core_map); 25DECLARE_PER_CPU(cpumask_var_t, cpu_core_map);
26DECLARE_PER_CPU(u16, cpu_llc_id); 26DECLARE_PER_CPU(u16, cpu_llc_id);
27DECLARE_PER_CPU(int, cpu_number); 27DECLARE_PER_CPU(int, cpu_number);
28 28
29static inline struct cpumask *cpu_sibling_mask(int cpu) 29static inline struct cpumask *cpu_sibling_mask(int cpu)
30{ 30{
31 return &per_cpu(cpu_sibling_map, cpu); 31 return per_cpu(cpu_sibling_map, cpu);
32} 32}
33 33
34static inline struct cpumask *cpu_core_mask(int cpu) 34static inline struct cpumask *cpu_core_mask(int cpu)
35{ 35{
36 return &per_cpu(cpu_core_map, cpu); 36 return per_cpu(cpu_core_map, cpu);
37} 37}
38 38
39DECLARE_EARLY_PER_CPU(u16, x86_cpu_to_apicid); 39DECLARE_EARLY_PER_CPU(u16, x86_cpu_to_apicid);
@@ -121,9 +121,10 @@ static inline void arch_send_call_function_single_ipi(int cpu)
121 smp_ops.send_call_func_single_ipi(cpu); 121 smp_ops.send_call_func_single_ipi(cpu);
122} 122}
123 123
124static inline void arch_send_call_function_ipi(cpumask_t mask) 124#define arch_send_call_function_ipi_mask arch_send_call_function_ipi_mask
125static inline void arch_send_call_function_ipi_mask(const struct cpumask *mask)
125{ 126{
126 smp_ops.send_call_func_ipi(&mask); 127 smp_ops.send_call_func_ipi(mask);
127} 128}
128 129
129void cpu_disable_common(void); 130void cpu_disable_common(void);
diff --git a/arch/x86/include/asm/spinlock.h b/arch/x86/include/asm/spinlock.h
index 3a5696656680..e5e6caffec87 100644
--- a/arch/x86/include/asm/spinlock.h
+++ b/arch/x86/include/asm/spinlock.h
@@ -295,6 +295,9 @@ static inline void __raw_write_unlock(raw_rwlock_t *rw)
295 : "+m" (rw->lock) : "i" (RW_LOCK_BIAS) : "memory"); 295 : "+m" (rw->lock) : "i" (RW_LOCK_BIAS) : "memory");
296} 296}
297 297
298#define __raw_read_lock_flags(lock, flags) __raw_read_lock(lock)
299#define __raw_write_lock_flags(lock, flags) __raw_write_lock(lock)
300
298#define _raw_spin_relax(lock) cpu_relax() 301#define _raw_spin_relax(lock) cpu_relax()
299#define _raw_read_relax(lock) cpu_relax() 302#define _raw_read_relax(lock) cpu_relax()
300#define _raw_write_relax(lock) cpu_relax() 303#define _raw_write_relax(lock) cpu_relax()
diff --git a/arch/x86/include/asm/topology.h b/arch/x86/include/asm/topology.h
index 744299c0b774..892b119dba6f 100644
--- a/arch/x86/include/asm/topology.h
+++ b/arch/x86/include/asm/topology.h
@@ -44,9 +44,6 @@
44 44
45#ifdef CONFIG_X86_32 45#ifdef CONFIG_X86_32
46 46
47/* Mappings between node number and cpus on that node. */
48extern cpumask_t node_to_cpumask_map[];
49
50/* Mappings between logical cpu number and node number */ 47/* Mappings between logical cpu number and node number */
51extern int cpu_to_node_map[]; 48extern int cpu_to_node_map[];
52 49
@@ -57,30 +54,8 @@ static inline int cpu_to_node(int cpu)
57} 54}
58#define early_cpu_to_node(cpu) cpu_to_node(cpu) 55#define early_cpu_to_node(cpu) cpu_to_node(cpu)
59 56
60/* Returns a bitmask of CPUs on Node 'node'.
61 *
62 * Side note: this function creates the returned cpumask on the stack
63 * so with a high NR_CPUS count, excessive stack space is used. The
64 * cpumask_of_node function should be used whenever possible.
65 */
66static inline cpumask_t node_to_cpumask(int node)
67{
68 return node_to_cpumask_map[node];
69}
70
71/* Returns a bitmask of CPUs on Node 'node'. */
72static inline const struct cpumask *cpumask_of_node(int node)
73{
74 return &node_to_cpumask_map[node];
75}
76
77static inline void setup_node_to_cpumask_map(void) { }
78
79#else /* CONFIG_X86_64 */ 57#else /* CONFIG_X86_64 */
80 58
81/* Mappings between node number and cpus on that node. */
82extern cpumask_t *node_to_cpumask_map;
83
84/* Mappings between logical cpu number and node number */ 59/* Mappings between logical cpu number and node number */
85DECLARE_EARLY_PER_CPU(int, x86_cpu_to_node_map); 60DECLARE_EARLY_PER_CPU(int, x86_cpu_to_node_map);
86 61
@@ -91,8 +66,6 @@ DECLARE_PER_CPU(int, node_number);
91#ifdef CONFIG_DEBUG_PER_CPU_MAPS 66#ifdef CONFIG_DEBUG_PER_CPU_MAPS
92extern int cpu_to_node(int cpu); 67extern int cpu_to_node(int cpu);
93extern int early_cpu_to_node(int cpu); 68extern int early_cpu_to_node(int cpu);
94extern const cpumask_t *cpumask_of_node(int node);
95extern cpumask_t node_to_cpumask(int node);
96 69
97#else /* !CONFIG_DEBUG_PER_CPU_MAPS */ 70#else /* !CONFIG_DEBUG_PER_CPU_MAPS */
98 71
@@ -108,42 +81,32 @@ static inline int early_cpu_to_node(int cpu)
108 return early_per_cpu(x86_cpu_to_node_map, cpu); 81 return early_per_cpu(x86_cpu_to_node_map, cpu);
109} 82}
110 83
111/* Returns a pointer to the cpumask of CPUs on Node 'node'. */ 84#endif /* !CONFIG_DEBUG_PER_CPU_MAPS */
112static inline const cpumask_t *cpumask_of_node(int node) 85
113{ 86#endif /* CONFIG_X86_64 */
114 return &node_to_cpumask_map[node];
115}
116 87
117/* Returns a bitmask of CPUs on Node 'node'. */ 88/* Mappings between node number and cpus on that node. */
118static inline cpumask_t node_to_cpumask(int node) 89extern cpumask_var_t node_to_cpumask_map[MAX_NUMNODES];
90
91#ifdef CONFIG_DEBUG_PER_CPU_MAPS
92extern const struct cpumask *cpumask_of_node(int node);
93#else
94/* Returns a pointer to the cpumask of CPUs on Node 'node'. */
95static inline const struct cpumask *cpumask_of_node(int node)
119{ 96{
120 return node_to_cpumask_map[node]; 97 return node_to_cpumask_map[node];
121} 98}
122 99#endif
123#endif /* !CONFIG_DEBUG_PER_CPU_MAPS */
124 100
125extern void setup_node_to_cpumask_map(void); 101extern void setup_node_to_cpumask_map(void);
126 102
127/* 103/*
128 * Replace default node_to_cpumask_ptr with optimized version
129 * Deprecated: use "const struct cpumask *mask = cpumask_of_node(node)"
130 */
131#define node_to_cpumask_ptr(v, node) \
132 const cpumask_t *v = cpumask_of_node(node)
133
134#define node_to_cpumask_ptr_next(v, node) \
135 v = cpumask_of_node(node)
136
137#endif /* CONFIG_X86_64 */
138
139/*
140 * Returns the number of the node containing Node 'node'. This 104 * Returns the number of the node containing Node 'node'. This
141 * architecture is flat, so it is a pretty simple function! 105 * architecture is flat, so it is a pretty simple function!
142 */ 106 */
143#define parent_node(node) (node) 107#define parent_node(node) (node)
144 108
145#define pcibus_to_node(bus) __pcibus_to_node(bus) 109#define pcibus_to_node(bus) __pcibus_to_node(bus)
146#define pcibus_to_cpumask(bus) __pcibus_to_cpumask(bus)
147 110
148#ifdef CONFIG_X86_32 111#ifdef CONFIG_X86_32
149extern unsigned long node_start_pfn[]; 112extern unsigned long node_start_pfn[];
@@ -209,40 +172,24 @@ static inline int early_cpu_to_node(int cpu)
209 return 0; 172 return 0;
210} 173}
211 174
212static inline const cpumask_t *cpumask_of_node(int node) 175static inline const struct cpumask *cpumask_of_node(int node)
213{
214 return &cpu_online_map;
215}
216static inline cpumask_t node_to_cpumask(int node)
217{ 176{
218 return cpu_online_map; 177 return cpu_online_mask;
219} 178}
220 179
221static inline void setup_node_to_cpumask_map(void) { } 180static inline void setup_node_to_cpumask_map(void) { }
222 181
223/*
224 * Replace default node_to_cpumask_ptr with optimized version
225 * Deprecated: use "const struct cpumask *mask = cpumask_of_node(node)"
226 */
227#define node_to_cpumask_ptr(v, node) \
228 const cpumask_t *v = cpumask_of_node(node)
229
230#define node_to_cpumask_ptr_next(v, node) \
231 v = cpumask_of_node(node)
232#endif 182#endif
233 183
234#include <asm-generic/topology.h> 184#include <asm-generic/topology.h>
235 185
236extern cpumask_t cpu_coregroup_map(int cpu);
237extern const struct cpumask *cpu_coregroup_mask(int cpu); 186extern const struct cpumask *cpu_coregroup_mask(int cpu);
238 187
239#ifdef ENABLE_TOPO_DEFINES 188#ifdef ENABLE_TOPO_DEFINES
240#define topology_physical_package_id(cpu) (cpu_data(cpu).phys_proc_id) 189#define topology_physical_package_id(cpu) (cpu_data(cpu).phys_proc_id)
241#define topology_core_id(cpu) (cpu_data(cpu).cpu_core_id) 190#define topology_core_id(cpu) (cpu_data(cpu).cpu_core_id)
242#define topology_core_siblings(cpu) (per_cpu(cpu_core_map, cpu)) 191#define topology_core_cpumask(cpu) (per_cpu(cpu_core_map, cpu))
243#define topology_thread_siblings(cpu) (per_cpu(cpu_sibling_map, cpu)) 192#define topology_thread_cpumask(cpu) (per_cpu(cpu_sibling_map, cpu))
244#define topology_core_cpumask(cpu) (&per_cpu(cpu_core_map, cpu))
245#define topology_thread_cpumask(cpu) (&per_cpu(cpu_sibling_map, cpu))
246 193
247/* indicates that pointers to the topology cpumask_t maps are valid */ 194/* indicates that pointers to the topology cpumask_t maps are valid */
248#define arch_provides_topology_pointers yes 195#define arch_provides_topology_pointers yes
@@ -256,7 +203,7 @@ struct pci_bus;
256void set_pci_bus_resources_arch_default(struct pci_bus *b); 203void set_pci_bus_resources_arch_default(struct pci_bus *b);
257 204
258#ifdef CONFIG_SMP 205#ifdef CONFIG_SMP
259#define mc_capable() (cpus_weight(per_cpu(cpu_core_map, 0)) != nr_cpu_ids) 206#define mc_capable() (cpumask_weight(cpu_core_mask(0)) != nr_cpu_ids)
260#define smt_capable() (smp_num_siblings > 1) 207#define smt_capable() (smp_num_siblings > 1)
261#endif 208#endif
262 209
diff --git a/arch/x86/include/asm/unistd_32.h b/arch/x86/include/asm/unistd_32.h
index f2bba78430a4..6e72d74cf8dc 100644
--- a/arch/x86/include/asm/unistd_32.h
+++ b/arch/x86/include/asm/unistd_32.h
@@ -338,6 +338,8 @@
338#define __NR_dup3 330 338#define __NR_dup3 330
339#define __NR_pipe2 331 339#define __NR_pipe2 331
340#define __NR_inotify_init1 332 340#define __NR_inotify_init1 332
341#define __NR_preadv 333
342#define __NR_pwritev 334
341 343
342#ifdef __KERNEL__ 344#ifdef __KERNEL__
343 345
diff --git a/arch/x86/include/asm/unistd_64.h b/arch/x86/include/asm/unistd_64.h
index d2e415e6666f..f81829462325 100644
--- a/arch/x86/include/asm/unistd_64.h
+++ b/arch/x86/include/asm/unistd_64.h
@@ -653,6 +653,10 @@ __SYSCALL(__NR_dup3, sys_dup3)
653__SYSCALL(__NR_pipe2, sys_pipe2) 653__SYSCALL(__NR_pipe2, sys_pipe2)
654#define __NR_inotify_init1 294 654#define __NR_inotify_init1 294
655__SYSCALL(__NR_inotify_init1, sys_inotify_init1) 655__SYSCALL(__NR_inotify_init1, sys_inotify_init1)
656#define __NR_preadv 295
657__SYSCALL(__NR_preadv, sys_preadv)
658#define __NR_pwritev 296
659__SYSCALL(__NR_pwritev, sys_pwritev)
656 660
657 661
658#ifndef __NO_STUBS 662#ifndef __NO_STUBS
diff --git a/arch/x86/include/asm/uv/uv_hub.h b/arch/x86/include/asm/uv/uv_hub.h
index 9f4dfba33b28..d3a98ea1062e 100644
--- a/arch/x86/include/asm/uv/uv_hub.h
+++ b/arch/x86/include/asm/uv/uv_hub.h
@@ -11,11 +11,13 @@
11#ifndef _ASM_X86_UV_UV_HUB_H 11#ifndef _ASM_X86_UV_UV_HUB_H
12#define _ASM_X86_UV_UV_HUB_H 12#define _ASM_X86_UV_UV_HUB_H
13 13
14#ifdef CONFIG_X86_64
14#include <linux/numa.h> 15#include <linux/numa.h>
15#include <linux/percpu.h> 16#include <linux/percpu.h>
16#include <linux/timer.h> 17#include <linux/timer.h>
17#include <asm/types.h> 18#include <asm/types.h>
18#include <asm/percpu.h> 19#include <asm/percpu.h>
20#include <asm/uv/uv_mmrs.h>
19 21
20 22
21/* 23/*
@@ -397,6 +399,7 @@ static inline void uv_set_scir_bits(unsigned char value)
397 uv_write_local_mmr8(uv_hub_info->scir.offset, value); 399 uv_write_local_mmr8(uv_hub_info->scir.offset, value);
398 } 400 }
399} 401}
402
400static inline void uv_set_cpu_scir_bits(int cpu, unsigned char value) 403static inline void uv_set_cpu_scir_bits(int cpu, unsigned char value)
401{ 404{
402 if (uv_cpu_hub_info(cpu)->scir.state != value) { 405 if (uv_cpu_hub_info(cpu)->scir.state != value) {
@@ -405,4 +408,15 @@ static inline void uv_set_cpu_scir_bits(int cpu, unsigned char value)
405 } 408 }
406} 409}
407 410
411static inline void uv_hub_send_ipi(int pnode, int apicid, int vector)
412{
413 unsigned long val;
414
415 val = (1UL << UVH_IPI_INT_SEND_SHFT) |
416 ((apicid & 0x3f) << UVH_IPI_INT_APIC_ID_SHFT) |
417 (vector << UVH_IPI_INT_VECTOR_SHFT);
418 uv_write_global_mmr64(pnode, UVH_IPI_INT, val);
419}
420
421#endif /* CONFIG_X86_64 */
408#endif /* _ASM_X86_UV_UV_HUB_H */ 422#endif /* _ASM_X86_UV_UV_HUB_H */
diff --git a/arch/x86/include/asm/uv/uv_mmrs.h b/arch/x86/include/asm/uv/uv_mmrs.h
index dd627793a234..db68ac8a5ac2 100644
--- a/arch/x86/include/asm/uv/uv_mmrs.h
+++ b/arch/x86/include/asm/uv/uv_mmrs.h
@@ -1,3 +1,4 @@
1
1/* 2/*
2 * This file is subject to the terms and conditions of the GNU General Public 3 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive 4 * License. See the file "COPYING" in the main directory of this archive
@@ -243,6 +244,158 @@ union uvh_event_occurred0_u {
243#define UVH_EVENT_OCCURRED0_ALIAS_32 0x005f0 244#define UVH_EVENT_OCCURRED0_ALIAS_32 0x005f0
244 245
245/* ========================================================================= */ 246/* ========================================================================= */
247/* UVH_GR0_TLB_INT0_CONFIG */
248/* ========================================================================= */
249#define UVH_GR0_TLB_INT0_CONFIG 0x61b00UL
250
251#define UVH_GR0_TLB_INT0_CONFIG_VECTOR_SHFT 0
252#define UVH_GR0_TLB_INT0_CONFIG_VECTOR_MASK 0x00000000000000ffUL
253#define UVH_GR0_TLB_INT0_CONFIG_DM_SHFT 8
254#define UVH_GR0_TLB_INT0_CONFIG_DM_MASK 0x0000000000000700UL
255#define UVH_GR0_TLB_INT0_CONFIG_DESTMODE_SHFT 11
256#define UVH_GR0_TLB_INT0_CONFIG_DESTMODE_MASK 0x0000000000000800UL
257#define UVH_GR0_TLB_INT0_CONFIG_STATUS_SHFT 12
258#define UVH_GR0_TLB_INT0_CONFIG_STATUS_MASK 0x0000000000001000UL
259#define UVH_GR0_TLB_INT0_CONFIG_P_SHFT 13
260#define UVH_GR0_TLB_INT0_CONFIG_P_MASK 0x0000000000002000UL
261#define UVH_GR0_TLB_INT0_CONFIG_T_SHFT 15
262#define UVH_GR0_TLB_INT0_CONFIG_T_MASK 0x0000000000008000UL
263#define UVH_GR0_TLB_INT0_CONFIG_M_SHFT 16
264#define UVH_GR0_TLB_INT0_CONFIG_M_MASK 0x0000000000010000UL
265#define UVH_GR0_TLB_INT0_CONFIG_APIC_ID_SHFT 32
266#define UVH_GR0_TLB_INT0_CONFIG_APIC_ID_MASK 0xffffffff00000000UL
267
268union uvh_gr0_tlb_int0_config_u {
269 unsigned long v;
270 struct uvh_gr0_tlb_int0_config_s {
271 unsigned long vector_ : 8; /* RW */
272 unsigned long dm : 3; /* RW */
273 unsigned long destmode : 1; /* RW */
274 unsigned long status : 1; /* RO */
275 unsigned long p : 1; /* RO */
276 unsigned long rsvd_14 : 1; /* */
277 unsigned long t : 1; /* RO */
278 unsigned long m : 1; /* RW */
279 unsigned long rsvd_17_31: 15; /* */
280 unsigned long apic_id : 32; /* RW */
281 } s;
282};
283
284/* ========================================================================= */
285/* UVH_GR0_TLB_INT1_CONFIG */
286/* ========================================================================= */
287#define UVH_GR0_TLB_INT1_CONFIG 0x61b40UL
288
289#define UVH_GR0_TLB_INT1_CONFIG_VECTOR_SHFT 0
290#define UVH_GR0_TLB_INT1_CONFIG_VECTOR_MASK 0x00000000000000ffUL
291#define UVH_GR0_TLB_INT1_CONFIG_DM_SHFT 8
292#define UVH_GR0_TLB_INT1_CONFIG_DM_MASK 0x0000000000000700UL
293#define UVH_GR0_TLB_INT1_CONFIG_DESTMODE_SHFT 11
294#define UVH_GR0_TLB_INT1_CONFIG_DESTMODE_MASK 0x0000000000000800UL
295#define UVH_GR0_TLB_INT1_CONFIG_STATUS_SHFT 12
296#define UVH_GR0_TLB_INT1_CONFIG_STATUS_MASK 0x0000000000001000UL
297#define UVH_GR0_TLB_INT1_CONFIG_P_SHFT 13
298#define UVH_GR0_TLB_INT1_CONFIG_P_MASK 0x0000000000002000UL
299#define UVH_GR0_TLB_INT1_CONFIG_T_SHFT 15
300#define UVH_GR0_TLB_INT1_CONFIG_T_MASK 0x0000000000008000UL
301#define UVH_GR0_TLB_INT1_CONFIG_M_SHFT 16
302#define UVH_GR0_TLB_INT1_CONFIG_M_MASK 0x0000000000010000UL
303#define UVH_GR0_TLB_INT1_CONFIG_APIC_ID_SHFT 32
304#define UVH_GR0_TLB_INT1_CONFIG_APIC_ID_MASK 0xffffffff00000000UL
305
306union uvh_gr0_tlb_int1_config_u {
307 unsigned long v;
308 struct uvh_gr0_tlb_int1_config_s {
309 unsigned long vector_ : 8; /* RW */
310 unsigned long dm : 3; /* RW */
311 unsigned long destmode : 1; /* RW */
312 unsigned long status : 1; /* RO */
313 unsigned long p : 1; /* RO */
314 unsigned long rsvd_14 : 1; /* */
315 unsigned long t : 1; /* RO */
316 unsigned long m : 1; /* RW */
317 unsigned long rsvd_17_31: 15; /* */
318 unsigned long apic_id : 32; /* RW */
319 } s;
320};
321
322/* ========================================================================= */
323/* UVH_GR1_TLB_INT0_CONFIG */
324/* ========================================================================= */
325#define UVH_GR1_TLB_INT0_CONFIG 0x61f00UL
326
327#define UVH_GR1_TLB_INT0_CONFIG_VECTOR_SHFT 0
328#define UVH_GR1_TLB_INT0_CONFIG_VECTOR_MASK 0x00000000000000ffUL
329#define UVH_GR1_TLB_INT0_CONFIG_DM_SHFT 8
330#define UVH_GR1_TLB_INT0_CONFIG_DM_MASK 0x0000000000000700UL
331#define UVH_GR1_TLB_INT0_CONFIG_DESTMODE_SHFT 11
332#define UVH_GR1_TLB_INT0_CONFIG_DESTMODE_MASK 0x0000000000000800UL
333#define UVH_GR1_TLB_INT0_CONFIG_STATUS_SHFT 12
334#define UVH_GR1_TLB_INT0_CONFIG_STATUS_MASK 0x0000000000001000UL
335#define UVH_GR1_TLB_INT0_CONFIG_P_SHFT 13
336#define UVH_GR1_TLB_INT0_CONFIG_P_MASK 0x0000000000002000UL
337#define UVH_GR1_TLB_INT0_CONFIG_T_SHFT 15
338#define UVH_GR1_TLB_INT0_CONFIG_T_MASK 0x0000000000008000UL
339#define UVH_GR1_TLB_INT0_CONFIG_M_SHFT 16
340#define UVH_GR1_TLB_INT0_CONFIG_M_MASK 0x0000000000010000UL
341#define UVH_GR1_TLB_INT0_CONFIG_APIC_ID_SHFT 32
342#define UVH_GR1_TLB_INT0_CONFIG_APIC_ID_MASK 0xffffffff00000000UL
343
344union uvh_gr1_tlb_int0_config_u {
345 unsigned long v;
346 struct uvh_gr1_tlb_int0_config_s {
347 unsigned long vector_ : 8; /* RW */
348 unsigned long dm : 3; /* RW */
349 unsigned long destmode : 1; /* RW */
350 unsigned long status : 1; /* RO */
351 unsigned long p : 1; /* RO */
352 unsigned long rsvd_14 : 1; /* */
353 unsigned long t : 1; /* RO */
354 unsigned long m : 1; /* RW */
355 unsigned long rsvd_17_31: 15; /* */
356 unsigned long apic_id : 32; /* RW */
357 } s;
358};
359
360/* ========================================================================= */
361/* UVH_GR1_TLB_INT1_CONFIG */
362/* ========================================================================= */
363#define UVH_GR1_TLB_INT1_CONFIG 0x61f40UL
364
365#define UVH_GR1_TLB_INT1_CONFIG_VECTOR_SHFT 0
366#define UVH_GR1_TLB_INT1_CONFIG_VECTOR_MASK 0x00000000000000ffUL
367#define UVH_GR1_TLB_INT1_CONFIG_DM_SHFT 8
368#define UVH_GR1_TLB_INT1_CONFIG_DM_MASK 0x0000000000000700UL
369#define UVH_GR1_TLB_INT1_CONFIG_DESTMODE_SHFT 11
370#define UVH_GR1_TLB_INT1_CONFIG_DESTMODE_MASK 0x0000000000000800UL
371#define UVH_GR1_TLB_INT1_CONFIG_STATUS_SHFT 12
372#define UVH_GR1_TLB_INT1_CONFIG_STATUS_MASK 0x0000000000001000UL
373#define UVH_GR1_TLB_INT1_CONFIG_P_SHFT 13
374#define UVH_GR1_TLB_INT1_CONFIG_P_MASK 0x0000000000002000UL
375#define UVH_GR1_TLB_INT1_CONFIG_T_SHFT 15
376#define UVH_GR1_TLB_INT1_CONFIG_T_MASK 0x0000000000008000UL
377#define UVH_GR1_TLB_INT1_CONFIG_M_SHFT 16
378#define UVH_GR1_TLB_INT1_CONFIG_M_MASK 0x0000000000010000UL
379#define UVH_GR1_TLB_INT1_CONFIG_APIC_ID_SHFT 32
380#define UVH_GR1_TLB_INT1_CONFIG_APIC_ID_MASK 0xffffffff00000000UL
381
382union uvh_gr1_tlb_int1_config_u {
383 unsigned long v;
384 struct uvh_gr1_tlb_int1_config_s {
385 unsigned long vector_ : 8; /* RW */
386 unsigned long dm : 3; /* RW */
387 unsigned long destmode : 1; /* RW */
388 unsigned long status : 1; /* RO */
389 unsigned long p : 1; /* RO */
390 unsigned long rsvd_14 : 1; /* */
391 unsigned long t : 1; /* RO */
392 unsigned long m : 1; /* RW */
393 unsigned long rsvd_17_31: 15; /* */
394 unsigned long apic_id : 32; /* RW */
395 } s;
396};
397
398/* ========================================================================= */
246/* UVH_INT_CMPB */ 399/* UVH_INT_CMPB */
247/* ========================================================================= */ 400/* ========================================================================= */
248#define UVH_INT_CMPB 0x22080UL 401#define UVH_INT_CMPB 0x22080UL
diff --git a/arch/x86/kernel/amd_iommu.c b/arch/x86/kernel/amd_iommu.c
index c5962fe3796f..a97db99dad52 100644
--- a/arch/x86/kernel/amd_iommu.c
+++ b/arch/x86/kernel/amd_iommu.c
@@ -1928,6 +1928,12 @@ static phys_addr_t amd_iommu_iova_to_phys(struct iommu_domain *dom,
1928 return paddr; 1928 return paddr;
1929} 1929}
1930 1930
1931static int amd_iommu_domain_has_cap(struct iommu_domain *domain,
1932 unsigned long cap)
1933{
1934 return 0;
1935}
1936
1931static struct iommu_ops amd_iommu_ops = { 1937static struct iommu_ops amd_iommu_ops = {
1932 .domain_init = amd_iommu_domain_init, 1938 .domain_init = amd_iommu_domain_init,
1933 .domain_destroy = amd_iommu_domain_destroy, 1939 .domain_destroy = amd_iommu_domain_destroy,
@@ -1936,5 +1942,6 @@ static struct iommu_ops amd_iommu_ops = {
1936 .map = amd_iommu_map_range, 1942 .map = amd_iommu_map_range,
1937 .unmap = amd_iommu_unmap_range, 1943 .unmap = amd_iommu_unmap_range,
1938 .iova_to_phys = amd_iommu_iova_to_phys, 1944 .iova_to_phys = amd_iommu_iova_to_phys,
1945 .domain_has_cap = amd_iommu_domain_has_cap,
1939}; 1946};
1940 1947
diff --git a/arch/x86/kernel/apic/bigsmp_32.c b/arch/x86/kernel/apic/bigsmp_32.c
index d806ecaa948f..676cdac385c0 100644
--- a/arch/x86/kernel/apic/bigsmp_32.c
+++ b/arch/x86/kernel/apic/bigsmp_32.c
@@ -26,12 +26,12 @@ static int bigsmp_apic_id_registered(void)
26 return 1; 26 return 1;
27} 27}
28 28
29static const cpumask_t *bigsmp_target_cpus(void) 29static const struct cpumask *bigsmp_target_cpus(void)
30{ 30{
31#ifdef CONFIG_SMP 31#ifdef CONFIG_SMP
32 return &cpu_online_map; 32 return cpu_online_mask;
33#else 33#else
34 return &cpumask_of_cpu(0); 34 return cpumask_of(0);
35#endif 35#endif
36} 36}
37 37
@@ -118,9 +118,9 @@ static int bigsmp_check_phys_apicid_present(int boot_cpu_physical_apicid)
118} 118}
119 119
120/* As we are using single CPU as destination, pick only one CPU here */ 120/* As we are using single CPU as destination, pick only one CPU here */
121static unsigned int bigsmp_cpu_mask_to_apicid(const cpumask_t *cpumask) 121static unsigned int bigsmp_cpu_mask_to_apicid(const struct cpumask *cpumask)
122{ 122{
123 return bigsmp_cpu_to_logical_apicid(first_cpu(*cpumask)); 123 return bigsmp_cpu_to_logical_apicid(cpumask_first(cpumask));
124} 124}
125 125
126static unsigned int bigsmp_cpu_mask_to_apicid_and(const struct cpumask *cpumask, 126static unsigned int bigsmp_cpu_mask_to_apicid_and(const struct cpumask *cpumask,
@@ -188,10 +188,10 @@ static const struct dmi_system_id bigsmp_dmi_table[] = {
188 { } /* NULL entry stops DMI scanning */ 188 { } /* NULL entry stops DMI scanning */
189}; 189};
190 190
191static void bigsmp_vector_allocation_domain(int cpu, cpumask_t *retmask) 191static void bigsmp_vector_allocation_domain(int cpu, struct cpumask *retmask)
192{ 192{
193 cpus_clear(*retmask); 193 cpumask_clear(retmask);
194 cpu_set(cpu, *retmask); 194 cpumask_set_cpu(cpu, retmask);
195} 195}
196 196
197static int probe_bigsmp(void) 197static int probe_bigsmp(void)
diff --git a/arch/x86/kernel/apic/es7000_32.c b/arch/x86/kernel/apic/es7000_32.c
index 19588f2770ee..1c11b819f245 100644
--- a/arch/x86/kernel/apic/es7000_32.c
+++ b/arch/x86/kernel/apic/es7000_32.c
@@ -410,7 +410,7 @@ static void es7000_enable_apic_mode(void)
410 WARN(1, "Command failed, status = %x\n", mip_status); 410 WARN(1, "Command failed, status = %x\n", mip_status);
411} 411}
412 412
413static void es7000_vector_allocation_domain(int cpu, cpumask_t *retmask) 413static void es7000_vector_allocation_domain(int cpu, struct cpumask *retmask)
414{ 414{
415 /* Careful. Some cpus do not strictly honor the set of cpus 415 /* Careful. Some cpus do not strictly honor the set of cpus
416 * specified in the interrupt destination when using lowest 416 * specified in the interrupt destination when using lowest
@@ -420,7 +420,8 @@ static void es7000_vector_allocation_domain(int cpu, cpumask_t *retmask)
420 * deliver interrupts to the wrong hyperthread when only one 420 * deliver interrupts to the wrong hyperthread when only one
421 * hyperthread was specified in the interrupt desitination. 421 * hyperthread was specified in the interrupt desitination.
422 */ 422 */
423 *retmask = (cpumask_t){ { [0] = APIC_ALL_CPUS, } }; 423 cpumask_clear(retmask);
424 cpumask_bits(retmask)[0] = APIC_ALL_CPUS;
424} 425}
425 426
426 427
@@ -455,14 +456,14 @@ static int es7000_apic_id_registered(void)
455 return 1; 456 return 1;
456} 457}
457 458
458static const cpumask_t *target_cpus_cluster(void) 459static const struct cpumask *target_cpus_cluster(void)
459{ 460{
460 return &CPU_MASK_ALL; 461 return cpu_all_mask;
461} 462}
462 463
463static const cpumask_t *es7000_target_cpus(void) 464static const struct cpumask *es7000_target_cpus(void)
464{ 465{
465 return &cpumask_of_cpu(smp_processor_id()); 466 return cpumask_of(smp_processor_id());
466} 467}
467 468
468static unsigned long 469static unsigned long
@@ -517,7 +518,7 @@ static void es7000_setup_apic_routing(void)
517 "Enabling APIC mode: %s. Using %d I/O APICs, target cpus %lx\n", 518 "Enabling APIC mode: %s. Using %d I/O APICs, target cpus %lx\n",
518 (apic_version[apic] == 0x14) ? 519 (apic_version[apic] == 0x14) ?
519 "Physical Cluster" : "Logical Cluster", 520 "Physical Cluster" : "Logical Cluster",
520 nr_ioapics, cpus_addr(*es7000_target_cpus())[0]); 521 nr_ioapics, cpumask_bits(es7000_target_cpus())[0]);
521} 522}
522 523
523static int es7000_apicid_to_node(int logical_apicid) 524static int es7000_apicid_to_node(int logical_apicid)
@@ -572,7 +573,7 @@ static int es7000_check_phys_apicid_present(int cpu_physical_apicid)
572 return 1; 573 return 1;
573} 574}
574 575
575static unsigned int es7000_cpu_mask_to_apicid(const cpumask_t *cpumask) 576static unsigned int es7000_cpu_mask_to_apicid(const struct cpumask *cpumask)
576{ 577{
577 unsigned int round = 0; 578 unsigned int round = 0;
578 int cpu, uninitialized_var(apicid); 579 int cpu, uninitialized_var(apicid);
diff --git a/arch/x86/kernel/apic/nmi.c b/arch/x86/kernel/apic/nmi.c
index bdfad80c3cf1..d6bd62407152 100644
--- a/arch/x86/kernel/apic/nmi.c
+++ b/arch/x86/kernel/apic/nmi.c
@@ -39,7 +39,7 @@
39int unknown_nmi_panic; 39int unknown_nmi_panic;
40int nmi_watchdog_enabled; 40int nmi_watchdog_enabled;
41 41
42static cpumask_t backtrace_mask = CPU_MASK_NONE; 42static cpumask_var_t backtrace_mask;
43 43
44/* nmi_active: 44/* nmi_active:
45 * >0: the lapic NMI watchdog is active, but can be disabled 45 * >0: the lapic NMI watchdog is active, but can be disabled
@@ -138,6 +138,7 @@ int __init check_nmi_watchdog(void)
138 if (!prev_nmi_count) 138 if (!prev_nmi_count)
139 goto error; 139 goto error;
140 140
141 alloc_cpumask_var(&backtrace_mask, GFP_KERNEL);
141 printk(KERN_INFO "Testing NMI watchdog ... "); 142 printk(KERN_INFO "Testing NMI watchdog ... ");
142 143
143#ifdef CONFIG_SMP 144#ifdef CONFIG_SMP
@@ -413,14 +414,14 @@ nmi_watchdog_tick(struct pt_regs *regs, unsigned reason)
413 touched = 1; 414 touched = 1;
414 } 415 }
415 416
416 if (cpu_isset(cpu, backtrace_mask)) { 417 if (cpumask_test_cpu(cpu, backtrace_mask)) {
417 static DEFINE_SPINLOCK(lock); /* Serialise the printks */ 418 static DEFINE_SPINLOCK(lock); /* Serialise the printks */
418 419
419 spin_lock(&lock); 420 spin_lock(&lock);
420 printk(KERN_WARNING "NMI backtrace for cpu %d\n", cpu); 421 printk(KERN_WARNING "NMI backtrace for cpu %d\n", cpu);
421 dump_stack(); 422 dump_stack();
422 spin_unlock(&lock); 423 spin_unlock(&lock);
423 cpu_clear(cpu, backtrace_mask); 424 cpumask_clear_cpu(cpu, backtrace_mask);
424 } 425 }
425 426
426 /* Could check oops_in_progress here too, but it's safer not to */ 427 /* Could check oops_in_progress here too, but it's safer not to */
@@ -554,10 +555,10 @@ void __trigger_all_cpu_backtrace(void)
554{ 555{
555 int i; 556 int i;
556 557
557 backtrace_mask = cpu_online_map; 558 cpumask_copy(backtrace_mask, cpu_online_mask);
558 /* Wait for up to 10 seconds for all CPUs to do the backtrace */ 559 /* Wait for up to 10 seconds for all CPUs to do the backtrace */
559 for (i = 0; i < 10 * 1000; i++) { 560 for (i = 0; i < 10 * 1000; i++) {
560 if (cpus_empty(backtrace_mask)) 561 if (cpumask_empty(backtrace_mask))
561 break; 562 break;
562 mdelay(1); 563 mdelay(1);
563 } 564 }
diff --git a/arch/x86/kernel/apic/numaq_32.c b/arch/x86/kernel/apic/numaq_32.c
index ba2fc6465534..533e59c6fc82 100644
--- a/arch/x86/kernel/apic/numaq_32.c
+++ b/arch/x86/kernel/apic/numaq_32.c
@@ -334,9 +334,9 @@ static inline void numaq_smp_callin_clear_local_apic(void)
334 clear_local_APIC(); 334 clear_local_APIC();
335} 335}
336 336
337static inline const cpumask_t *numaq_target_cpus(void) 337static inline const struct cpumask *numaq_target_cpus(void)
338{ 338{
339 return &CPU_MASK_ALL; 339 return cpu_all_mask;
340} 340}
341 341
342static inline unsigned long 342static inline unsigned long
@@ -427,7 +427,7 @@ static inline int numaq_check_phys_apicid_present(int boot_cpu_physical_apicid)
427 * We use physical apicids here, not logical, so just return the default 427 * We use physical apicids here, not logical, so just return the default
428 * physical broadcast to stop people from breaking us 428 * physical broadcast to stop people from breaking us
429 */ 429 */
430static inline unsigned int numaq_cpu_mask_to_apicid(const cpumask_t *cpumask) 430static unsigned int numaq_cpu_mask_to_apicid(const struct cpumask *cpumask)
431{ 431{
432 return 0x0F; 432 return 0x0F;
433} 433}
@@ -462,7 +462,7 @@ static int probe_numaq(void)
462 return found_numaq; 462 return found_numaq;
463} 463}
464 464
465static void numaq_vector_allocation_domain(int cpu, cpumask_t *retmask) 465static void numaq_vector_allocation_domain(int cpu, struct cpumask *retmask)
466{ 466{
467 /* Careful. Some cpus do not strictly honor the set of cpus 467 /* Careful. Some cpus do not strictly honor the set of cpus
468 * specified in the interrupt destination when using lowest 468 * specified in the interrupt destination when using lowest
@@ -472,7 +472,8 @@ static void numaq_vector_allocation_domain(int cpu, cpumask_t *retmask)
472 * deliver interrupts to the wrong hyperthread when only one 472 * deliver interrupts to the wrong hyperthread when only one
473 * hyperthread was specified in the interrupt desitination. 473 * hyperthread was specified in the interrupt desitination.
474 */ 474 */
475 *retmask = (cpumask_t){ { [0] = APIC_ALL_CPUS, } }; 475 cpumask_clear(retmask);
476 cpumask_bits(retmask)[0] = APIC_ALL_CPUS;
476} 477}
477 478
478static void numaq_setup_portio_remap(void) 479static void numaq_setup_portio_remap(void)
diff --git a/arch/x86/kernel/apic/probe_32.c b/arch/x86/kernel/apic/probe_32.c
index 141c99a1c264..01eda2ac65e4 100644
--- a/arch/x86/kernel/apic/probe_32.c
+++ b/arch/x86/kernel/apic/probe_32.c
@@ -83,7 +83,8 @@ static void default_vector_allocation_domain(int cpu, struct cpumask *retmask)
83 * deliver interrupts to the wrong hyperthread when only one 83 * deliver interrupts to the wrong hyperthread when only one
84 * hyperthread was specified in the interrupt desitination. 84 * hyperthread was specified in the interrupt desitination.
85 */ 85 */
86 *retmask = (cpumask_t) { { [0] = APIC_ALL_CPUS } }; 86 cpumask_clear(retmask);
87 cpumask_bits(retmask)[0] = APIC_ALL_CPUS;
87} 88}
88 89
89/* should be called last. */ 90/* should be called last. */
diff --git a/arch/x86/kernel/apic/summit_32.c b/arch/x86/kernel/apic/summit_32.c
index aac52fa873ff..9cfe1f415d81 100644
--- a/arch/x86/kernel/apic/summit_32.c
+++ b/arch/x86/kernel/apic/summit_32.c
@@ -53,23 +53,19 @@ static unsigned summit_get_apic_id(unsigned long x)
53 return (x >> 24) & 0xFF; 53 return (x >> 24) & 0xFF;
54} 54}
55 55
56static inline void summit_send_IPI_mask(const cpumask_t *mask, int vector) 56static inline void summit_send_IPI_mask(const struct cpumask *mask, int vector)
57{ 57{
58 default_send_IPI_mask_sequence_logical(mask, vector); 58 default_send_IPI_mask_sequence_logical(mask, vector);
59} 59}
60 60
61static void summit_send_IPI_allbutself(int vector) 61static void summit_send_IPI_allbutself(int vector)
62{ 62{
63 cpumask_t mask = cpu_online_map; 63 default_send_IPI_mask_allbutself_logical(cpu_online_mask, vector);
64 cpu_clear(smp_processor_id(), mask);
65
66 if (!cpus_empty(mask))
67 summit_send_IPI_mask(&mask, vector);
68} 64}
69 65
70static void summit_send_IPI_all(int vector) 66static void summit_send_IPI_all(int vector)
71{ 67{
72 summit_send_IPI_mask(&cpu_online_map, vector); 68 summit_send_IPI_mask(cpu_online_mask, vector);
73} 69}
74 70
75#include <asm/tsc.h> 71#include <asm/tsc.h>
@@ -186,13 +182,13 @@ static inline int is_WPEG(struct rio_detail *rio){
186 182
187#define SUMMIT_APIC_DFR_VALUE (APIC_DFR_CLUSTER) 183#define SUMMIT_APIC_DFR_VALUE (APIC_DFR_CLUSTER)
188 184
189static const cpumask_t *summit_target_cpus(void) 185static const struct cpumask *summit_target_cpus(void)
190{ 186{
191 /* CPU_MASK_ALL (0xff) has undefined behaviour with 187 /* CPU_MASK_ALL (0xff) has undefined behaviour with
192 * dest_LowestPrio mode logical clustered apic interrupt routing 188 * dest_LowestPrio mode logical clustered apic interrupt routing
193 * Just start on cpu 0. IRQ balancing will spread load 189 * Just start on cpu 0. IRQ balancing will spread load
194 */ 190 */
195 return &cpumask_of_cpu(0); 191 return cpumask_of(0);
196} 192}
197 193
198static unsigned long summit_check_apicid_used(physid_mask_t bitmap, int apicid) 194static unsigned long summit_check_apicid_used(physid_mask_t bitmap, int apicid)
@@ -289,7 +285,7 @@ static int summit_check_phys_apicid_present(int boot_cpu_physical_apicid)
289 return 1; 285 return 1;
290} 286}
291 287
292static unsigned int summit_cpu_mask_to_apicid(const cpumask_t *cpumask) 288static unsigned int summit_cpu_mask_to_apicid(const struct cpumask *cpumask)
293{ 289{
294 unsigned int round = 0; 290 unsigned int round = 0;
295 int cpu, apicid = 0; 291 int cpu, apicid = 0;
@@ -346,7 +342,7 @@ static int probe_summit(void)
346 return 0; 342 return 0;
347} 343}
348 344
349static void summit_vector_allocation_domain(int cpu, cpumask_t *retmask) 345static void summit_vector_allocation_domain(int cpu, struct cpumask *retmask)
350{ 346{
351 /* Careful. Some cpus do not strictly honor the set of cpus 347 /* Careful. Some cpus do not strictly honor the set of cpus
352 * specified in the interrupt destination when using lowest 348 * specified in the interrupt destination when using lowest
@@ -356,7 +352,8 @@ static void summit_vector_allocation_domain(int cpu, cpumask_t *retmask)
356 * deliver interrupts to the wrong hyperthread when only one 352 * deliver interrupts to the wrong hyperthread when only one
357 * hyperthread was specified in the interrupt desitination. 353 * hyperthread was specified in the interrupt desitination.
358 */ 354 */
359 *retmask = (cpumask_t){ { [0] = APIC_ALL_CPUS, } }; 355 cpumask_clear(retmask);
356 cpumask_bits(retmask)[0] = APIC_ALL_CPUS;
360} 357}
361 358
362#ifdef CONFIG_X86_SUMMIT_NUMA 359#ifdef CONFIG_X86_SUMMIT_NUMA
diff --git a/arch/x86/kernel/apic/x2apic_uv_x.c b/arch/x86/kernel/apic/x2apic_uv_x.c
index 1bd6da1f8fad..1248318436e8 100644
--- a/arch/x86/kernel/apic/x2apic_uv_x.c
+++ b/arch/x86/kernel/apic/x2apic_uv_x.c
@@ -118,17 +118,12 @@ static int uv_wakeup_secondary(int phys_apicid, unsigned long start_rip)
118 118
119static void uv_send_IPI_one(int cpu, int vector) 119static void uv_send_IPI_one(int cpu, int vector)
120{ 120{
121 unsigned long val, apicid; 121 unsigned long apicid;
122 int pnode; 122 int pnode;
123 123
124 apicid = per_cpu(x86_cpu_to_apicid, cpu); 124 apicid = per_cpu(x86_cpu_to_apicid, cpu);
125 pnode = uv_apicid_to_pnode(apicid); 125 pnode = uv_apicid_to_pnode(apicid);
126 126 uv_hub_send_ipi(pnode, apicid, vector);
127 val = (1UL << UVH_IPI_INT_SEND_SHFT) |
128 (apicid << UVH_IPI_INT_APIC_ID_SHFT) |
129 (vector << UVH_IPI_INT_VECTOR_SHFT);
130
131 uv_write_global_mmr64(pnode, UVH_IPI_INT, val);
132} 127}
133 128
134static void uv_send_IPI_mask(const struct cpumask *mask, int vector) 129static void uv_send_IPI_mask(const struct cpumask *mask, int vector)
diff --git a/arch/x86/kernel/apm_32.c b/arch/x86/kernel/apm_32.c
index ac7783a67432..49e0939bac42 100644
--- a/arch/x86/kernel/apm_32.c
+++ b/arch/x86/kernel/apm_32.c
@@ -466,7 +466,7 @@ static const lookup_t error_table[] = {
466 * @err: APM BIOS return code 466 * @err: APM BIOS return code
467 * 467 *
468 * Write a meaningful log entry to the kernel log in the event of 468 * Write a meaningful log entry to the kernel log in the event of
469 * an APM error. 469 * an APM error. Note that this also handles (negative) kernel errors.
470 */ 470 */
471 471
472static void apm_error(char *str, int err) 472static void apm_error(char *str, int err)
@@ -478,43 +478,14 @@ static void apm_error(char *str, int err)
478 break; 478 break;
479 if (i < ERROR_COUNT) 479 if (i < ERROR_COUNT)
480 printk(KERN_NOTICE "apm: %s: %s\n", str, error_table[i].msg); 480 printk(KERN_NOTICE "apm: %s: %s\n", str, error_table[i].msg);
481 else if (err < 0)
482 printk(KERN_NOTICE "apm: %s: linux error code %i\n", str, err);
481 else 483 else
482 printk(KERN_NOTICE "apm: %s: unknown error code %#2.2x\n", 484 printk(KERN_NOTICE "apm: %s: unknown error code %#2.2x\n",
483 str, err); 485 str, err);
484} 486}
485 487
486/* 488/*
487 * Lock APM functionality to physical CPU 0
488 */
489
490#ifdef CONFIG_SMP
491
492static cpumask_t apm_save_cpus(void)
493{
494 cpumask_t x = current->cpus_allowed;
495 /* Some bioses don't like being called from CPU != 0 */
496 set_cpus_allowed(current, cpumask_of_cpu(0));
497 BUG_ON(smp_processor_id() != 0);
498 return x;
499}
500
501static inline void apm_restore_cpus(cpumask_t mask)
502{
503 set_cpus_allowed(current, mask);
504}
505
506#else
507
508/*
509 * No CPU lockdown needed on a uniprocessor
510 */
511
512#define apm_save_cpus() (current->cpus_allowed)
513#define apm_restore_cpus(x) (void)(x)
514
515#endif
516
517/*
518 * These are the actual BIOS calls. Depending on APM_ZERO_SEGS and 489 * These are the actual BIOS calls. Depending on APM_ZERO_SEGS and
519 * apm_info.allow_ints, we are being really paranoid here! Not only 490 * apm_info.allow_ints, we are being really paranoid here! Not only
520 * are interrupts disabled, but all the segment registers (except SS) 491 * are interrupts disabled, but all the segment registers (except SS)
@@ -568,16 +539,23 @@ static inline void apm_irq_restore(unsigned long flags)
568# define APM_DO_RESTORE_SEGS 539# define APM_DO_RESTORE_SEGS
569#endif 540#endif
570 541
542struct apm_bios_call {
543 u32 func;
544 /* In and out */
545 u32 ebx;
546 u32 ecx;
547 /* Out only */
548 u32 eax;
549 u32 edx;
550 u32 esi;
551
552 /* Error: -ENOMEM, or bits 8-15 of eax */
553 int err;
554};
555
571/** 556/**
572 * apm_bios_call - Make an APM BIOS 32bit call 557 * __apm_bios_call - Make an APM BIOS 32bit call
573 * @func: APM function to execute 558 * @_call: pointer to struct apm_bios_call.
574 * @ebx_in: EBX register for call entry
575 * @ecx_in: ECX register for call entry
576 * @eax: EAX register return
577 * @ebx: EBX register return
578 * @ecx: ECX register return
579 * @edx: EDX register return
580 * @esi: ESI register return
581 * 559 *
582 * Make an APM call using the 32bit protected mode interface. The 560 * Make an APM call using the 32bit protected mode interface. The
583 * caller is responsible for knowing if APM BIOS is configured and 561 * caller is responsible for knowing if APM BIOS is configured and
@@ -586,80 +564,142 @@ static inline void apm_irq_restore(unsigned long flags)
586 * flag is loaded into AL. If there is an error, then the error 564 * flag is loaded into AL. If there is an error, then the error
587 * code is returned in AH (bits 8-15 of eax) and this function 565 * code is returned in AH (bits 8-15 of eax) and this function
588 * returns non-zero. 566 * returns non-zero.
567 *
568 * Note: this makes the call on the current CPU.
589 */ 569 */
590 570static long __apm_bios_call(void *_call)
591static u8 apm_bios_call(u32 func, u32 ebx_in, u32 ecx_in,
592 u32 *eax, u32 *ebx, u32 *ecx, u32 *edx, u32 *esi)
593{ 571{
594 APM_DECL_SEGS 572 APM_DECL_SEGS
595 unsigned long flags; 573 unsigned long flags;
596 cpumask_t cpus;
597 int cpu; 574 int cpu;
598 struct desc_struct save_desc_40; 575 struct desc_struct save_desc_40;
599 struct desc_struct *gdt; 576 struct desc_struct *gdt;
600 577 struct apm_bios_call *call = _call;
601 cpus = apm_save_cpus();
602 578
603 cpu = get_cpu(); 579 cpu = get_cpu();
580 BUG_ON(cpu != 0);
604 gdt = get_cpu_gdt_table(cpu); 581 gdt = get_cpu_gdt_table(cpu);
605 save_desc_40 = gdt[0x40 / 8]; 582 save_desc_40 = gdt[0x40 / 8];
606 gdt[0x40 / 8] = bad_bios_desc; 583 gdt[0x40 / 8] = bad_bios_desc;
607 584
608 apm_irq_save(flags); 585 apm_irq_save(flags);
609 APM_DO_SAVE_SEGS; 586 APM_DO_SAVE_SEGS;
610 apm_bios_call_asm(func, ebx_in, ecx_in, eax, ebx, ecx, edx, esi); 587 apm_bios_call_asm(call->func, call->ebx, call->ecx,
588 &call->eax, &call->ebx, &call->ecx, &call->edx,
589 &call->esi);
611 APM_DO_RESTORE_SEGS; 590 APM_DO_RESTORE_SEGS;
612 apm_irq_restore(flags); 591 apm_irq_restore(flags);
613 gdt[0x40 / 8] = save_desc_40; 592 gdt[0x40 / 8] = save_desc_40;
614 put_cpu(); 593 put_cpu();
615 apm_restore_cpus(cpus);
616 594
617 return *eax & 0xff; 595 return call->eax & 0xff;
596}
597
598/* Run __apm_bios_call or __apm_bios_call_simple on CPU 0 */
599static int on_cpu0(long (*fn)(void *), struct apm_bios_call *call)
600{
601 int ret;
602
603 /* Don't bother with work_on_cpu in the common case, so we don't
604 * have to worry about OOM or overhead. */
605 if (get_cpu() == 0) {
606 ret = fn(call);
607 put_cpu();
608 } else {
609 put_cpu();
610 ret = work_on_cpu(0, fn, call);
611 }
612
613 /* work_on_cpu can fail with -ENOMEM */
614 if (ret < 0)
615 call->err = ret;
616 else
617 call->err = (call->eax >> 8) & 0xff;
618
619 return ret;
618} 620}
619 621
620/** 622/**
621 * apm_bios_call_simple - make a simple APM BIOS 32bit call 623 * apm_bios_call - Make an APM BIOS 32bit call (on CPU 0)
622 * @func: APM function to invoke 624 * @call: the apm_bios_call registers.
623 * @ebx_in: EBX register value for BIOS call 625 *
624 * @ecx_in: ECX register value for BIOS call 626 * If there is an error, it is returned in @call.err.
625 * @eax: EAX register on return from the BIOS call 627 */
628static int apm_bios_call(struct apm_bios_call *call)
629{
630 return on_cpu0(__apm_bios_call, call);
631}
632
633/**
634 * __apm_bios_call_simple - Make an APM BIOS 32bit call (on CPU 0)
635 * @_call: pointer to struct apm_bios_call.
626 * 636 *
627 * Make a BIOS call that returns one value only, or just status. 637 * Make a BIOS call that returns one value only, or just status.
628 * If there is an error, then the error code is returned in AH 638 * If there is an error, then the error code is returned in AH
629 * (bits 8-15 of eax) and this function returns non-zero. This is 639 * (bits 8-15 of eax) and this function returns non-zero (it can
630 * used for simpler BIOS operations. This call may hold interrupts 640 * also return -ENOMEM). This is used for simpler BIOS operations.
631 * off for a long time on some laptops. 641 * This call may hold interrupts off for a long time on some laptops.
642 *
643 * Note: this makes the call on the current CPU.
632 */ 644 */
633 645static long __apm_bios_call_simple(void *_call)
634static u8 apm_bios_call_simple(u32 func, u32 ebx_in, u32 ecx_in, u32 *eax)
635{ 646{
636 u8 error; 647 u8 error;
637 APM_DECL_SEGS 648 APM_DECL_SEGS
638 unsigned long flags; 649 unsigned long flags;
639 cpumask_t cpus;
640 int cpu; 650 int cpu;
641 struct desc_struct save_desc_40; 651 struct desc_struct save_desc_40;
642 struct desc_struct *gdt; 652 struct desc_struct *gdt;
643 653 struct apm_bios_call *call = _call;
644 cpus = apm_save_cpus();
645 654
646 cpu = get_cpu(); 655 cpu = get_cpu();
656 BUG_ON(cpu != 0);
647 gdt = get_cpu_gdt_table(cpu); 657 gdt = get_cpu_gdt_table(cpu);
648 save_desc_40 = gdt[0x40 / 8]; 658 save_desc_40 = gdt[0x40 / 8];
649 gdt[0x40 / 8] = bad_bios_desc; 659 gdt[0x40 / 8] = bad_bios_desc;
650 660
651 apm_irq_save(flags); 661 apm_irq_save(flags);
652 APM_DO_SAVE_SEGS; 662 APM_DO_SAVE_SEGS;
653 error = apm_bios_call_simple_asm(func, ebx_in, ecx_in, eax); 663 error = apm_bios_call_simple_asm(call->func, call->ebx, call->ecx,
664 &call->eax);
654 APM_DO_RESTORE_SEGS; 665 APM_DO_RESTORE_SEGS;
655 apm_irq_restore(flags); 666 apm_irq_restore(flags);
656 gdt[0x40 / 8] = save_desc_40; 667 gdt[0x40 / 8] = save_desc_40;
657 put_cpu(); 668 put_cpu();
658 apm_restore_cpus(cpus);
659 return error; 669 return error;
660} 670}
661 671
662/** 672/**
673 * apm_bios_call_simple - make a simple APM BIOS 32bit call
674 * @func: APM function to invoke
675 * @ebx_in: EBX register value for BIOS call
676 * @ecx_in: ECX register value for BIOS call
677 * @eax: EAX register on return from the BIOS call
678 * @err: bits
679 *
680 * Make a BIOS call that returns one value only, or just status.
681 * If there is an error, then the error code is returned in @err
682 * and this function returns non-zero. This is used for simpler
683 * BIOS operations. This call may hold interrupts off for a long
684 * time on some laptops.
685 */
686static int apm_bios_call_simple(u32 func, u32 ebx_in, u32 ecx_in, u32 *eax,
687 int *err)
688{
689 struct apm_bios_call call;
690 int ret;
691
692 call.func = func;
693 call.ebx = ebx_in;
694 call.ecx = ecx_in;
695
696 ret = on_cpu0(__apm_bios_call_simple, &call);
697 *eax = call.eax;
698 *err = call.err;
699 return ret;
700}
701
702/**
663 * apm_driver_version - APM driver version 703 * apm_driver_version - APM driver version
664 * @val: loaded with the APM version on return 704 * @val: loaded with the APM version on return
665 * 705 *
@@ -678,9 +718,10 @@ static u8 apm_bios_call_simple(u32 func, u32 ebx_in, u32 ecx_in, u32 *eax)
678static int apm_driver_version(u_short *val) 718static int apm_driver_version(u_short *val)
679{ 719{
680 u32 eax; 720 u32 eax;
721 int err;
681 722
682 if (apm_bios_call_simple(APM_FUNC_VERSION, 0, *val, &eax)) 723 if (apm_bios_call_simple(APM_FUNC_VERSION, 0, *val, &eax, &err))
683 return (eax >> 8) & 0xff; 724 return err;
684 *val = eax; 725 *val = eax;
685 return APM_SUCCESS; 726 return APM_SUCCESS;
686} 727}
@@ -701,22 +742,21 @@ static int apm_driver_version(u_short *val)
701 * that APM 1.2 is in use. If no messges are pending the value 0x80 742 * that APM 1.2 is in use. If no messges are pending the value 0x80
702 * is returned (No power management events pending). 743 * is returned (No power management events pending).
703 */ 744 */
704
705static int apm_get_event(apm_event_t *event, apm_eventinfo_t *info) 745static int apm_get_event(apm_event_t *event, apm_eventinfo_t *info)
706{ 746{
707 u32 eax; 747 struct apm_bios_call call;
708 u32 ebx;
709 u32 ecx;
710 u32 dummy;
711 748
712 if (apm_bios_call(APM_FUNC_GET_EVENT, 0, 0, &eax, &ebx, &ecx, 749 call.func = APM_FUNC_GET_EVENT;
713 &dummy, &dummy)) 750 call.ebx = call.ecx = 0;
714 return (eax >> 8) & 0xff; 751
715 *event = ebx; 752 if (apm_bios_call(&call))
753 return call.err;
754
755 *event = call.ebx;
716 if (apm_info.connection_version < 0x0102) 756 if (apm_info.connection_version < 0x0102)
717 *info = ~0; /* indicate info not valid */ 757 *info = ~0; /* indicate info not valid */
718 else 758 else
719 *info = ecx; 759 *info = call.ecx;
720 return APM_SUCCESS; 760 return APM_SUCCESS;
721} 761}
722 762
@@ -737,9 +777,10 @@ static int apm_get_event(apm_event_t *event, apm_eventinfo_t *info)
737static int set_power_state(u_short what, u_short state) 777static int set_power_state(u_short what, u_short state)
738{ 778{
739 u32 eax; 779 u32 eax;
780 int err;
740 781
741 if (apm_bios_call_simple(APM_FUNC_SET_STATE, what, state, &eax)) 782 if (apm_bios_call_simple(APM_FUNC_SET_STATE, what, state, &eax, &err))
742 return (eax >> 8) & 0xff; 783 return err;
743 return APM_SUCCESS; 784 return APM_SUCCESS;
744} 785}
745 786
@@ -770,6 +811,7 @@ static int apm_do_idle(void)
770 u8 ret = 0; 811 u8 ret = 0;
771 int idled = 0; 812 int idled = 0;
772 int polling; 813 int polling;
814 int err;
773 815
774 polling = !!(current_thread_info()->status & TS_POLLING); 816 polling = !!(current_thread_info()->status & TS_POLLING);
775 if (polling) { 817 if (polling) {
@@ -782,7 +824,7 @@ static int apm_do_idle(void)
782 } 824 }
783 if (!need_resched()) { 825 if (!need_resched()) {
784 idled = 1; 826 idled = 1;
785 ret = apm_bios_call_simple(APM_FUNC_IDLE, 0, 0, &eax); 827 ret = apm_bios_call_simple(APM_FUNC_IDLE, 0, 0, &eax, &err);
786 } 828 }
787 if (polling) 829 if (polling)
788 current_thread_info()->status |= TS_POLLING; 830 current_thread_info()->status |= TS_POLLING;
@@ -797,8 +839,7 @@ static int apm_do_idle(void)
797 * Only report the failure the first 5 times. 839 * Only report the failure the first 5 times.
798 */ 840 */
799 if (++t < 5) { 841 if (++t < 5) {
800 printk(KERN_DEBUG "apm_do_idle failed (%d)\n", 842 printk(KERN_DEBUG "apm_do_idle failed (%d)\n", err);
801 (eax >> 8) & 0xff);
802 t = jiffies; 843 t = jiffies;
803 } 844 }
804 return -1; 845 return -1;
@@ -816,9 +857,10 @@ static int apm_do_idle(void)
816static void apm_do_busy(void) 857static void apm_do_busy(void)
817{ 858{
818 u32 dummy; 859 u32 dummy;
860 int err;
819 861
820 if (clock_slowed || ALWAYS_CALL_BUSY) { 862 if (clock_slowed || ALWAYS_CALL_BUSY) {
821 (void)apm_bios_call_simple(APM_FUNC_BUSY, 0, 0, &dummy); 863 (void)apm_bios_call_simple(APM_FUNC_BUSY, 0, 0, &dummy, &err);
822 clock_slowed = 0; 864 clock_slowed = 0;
823 } 865 }
824} 866}
@@ -937,7 +979,7 @@ static void apm_power_off(void)
937 979
938 /* Some bioses don't like being called from CPU != 0 */ 980 /* Some bioses don't like being called from CPU != 0 */
939 if (apm_info.realmode_power_off) { 981 if (apm_info.realmode_power_off) {
940 (void)apm_save_cpus(); 982 set_cpus_allowed_ptr(current, cpumask_of(0));
941 machine_real_restart(po_bios_call, sizeof(po_bios_call)); 983 machine_real_restart(po_bios_call, sizeof(po_bios_call));
942 } else { 984 } else {
943 (void)set_system_power_state(APM_STATE_OFF); 985 (void)set_system_power_state(APM_STATE_OFF);
@@ -956,12 +998,13 @@ static void apm_power_off(void)
956static int apm_enable_power_management(int enable) 998static int apm_enable_power_management(int enable)
957{ 999{
958 u32 eax; 1000 u32 eax;
1001 int err;
959 1002
960 if ((enable == 0) && (apm_info.bios.flags & APM_BIOS_DISENGAGED)) 1003 if ((enable == 0) && (apm_info.bios.flags & APM_BIOS_DISENGAGED))
961 return APM_NOT_ENGAGED; 1004 return APM_NOT_ENGAGED;
962 if (apm_bios_call_simple(APM_FUNC_ENABLE_PM, APM_DEVICE_BALL, 1005 if (apm_bios_call_simple(APM_FUNC_ENABLE_PM, APM_DEVICE_BALL,
963 enable, &eax)) 1006 enable, &eax, &err))
964 return (eax >> 8) & 0xff; 1007 return err;
965 if (enable) 1008 if (enable)
966 apm_info.bios.flags &= ~APM_BIOS_DISABLED; 1009 apm_info.bios.flags &= ~APM_BIOS_DISABLED;
967 else 1010 else
@@ -986,24 +1029,23 @@ static int apm_enable_power_management(int enable)
986 1029
987static int apm_get_power_status(u_short *status, u_short *bat, u_short *life) 1030static int apm_get_power_status(u_short *status, u_short *bat, u_short *life)
988{ 1031{
989 u32 eax; 1032 struct apm_bios_call call;
990 u32 ebx; 1033
991 u32 ecx; 1034 call.func = APM_FUNC_GET_STATUS;
992 u32 edx; 1035 call.ebx = APM_DEVICE_ALL;
993 u32 dummy; 1036 call.ecx = 0;
994 1037
995 if (apm_info.get_power_status_broken) 1038 if (apm_info.get_power_status_broken)
996 return APM_32_UNSUPPORTED; 1039 return APM_32_UNSUPPORTED;
997 if (apm_bios_call(APM_FUNC_GET_STATUS, APM_DEVICE_ALL, 0, 1040 if (apm_bios_call(&call))
998 &eax, &ebx, &ecx, &edx, &dummy)) 1041 return call.err;
999 return (eax >> 8) & 0xff; 1042 *status = call.ebx;
1000 *status = ebx; 1043 *bat = call.ecx;
1001 *bat = ecx;
1002 if (apm_info.get_power_status_swabinminutes) { 1044 if (apm_info.get_power_status_swabinminutes) {
1003 *life = swab16((u16)edx); 1045 *life = swab16((u16)call.edx);
1004 *life |= 0x8000; 1046 *life |= 0x8000;
1005 } else 1047 } else
1006 *life = edx; 1048 *life = call.edx;
1007 return APM_SUCCESS; 1049 return APM_SUCCESS;
1008} 1050}
1009 1051
@@ -1048,12 +1090,14 @@ static int apm_get_battery_status(u_short which, u_short *status,
1048static int apm_engage_power_management(u_short device, int enable) 1090static int apm_engage_power_management(u_short device, int enable)
1049{ 1091{
1050 u32 eax; 1092 u32 eax;
1093 int err;
1051 1094
1052 if ((enable == 0) && (device == APM_DEVICE_ALL) 1095 if ((enable == 0) && (device == APM_DEVICE_ALL)
1053 && (apm_info.bios.flags & APM_BIOS_DISABLED)) 1096 && (apm_info.bios.flags & APM_BIOS_DISABLED))
1054 return APM_DISABLED; 1097 return APM_DISABLED;
1055 if (apm_bios_call_simple(APM_FUNC_ENGAGE_PM, device, enable, &eax)) 1098 if (apm_bios_call_simple(APM_FUNC_ENGAGE_PM, device, enable,
1056 return (eax >> 8) & 0xff; 1099 &eax, &err))
1100 return err;
1057 if (device == APM_DEVICE_ALL) { 1101 if (device == APM_DEVICE_ALL) {
1058 if (enable) 1102 if (enable)
1059 apm_info.bios.flags &= ~APM_BIOS_DISENGAGED; 1103 apm_info.bios.flags &= ~APM_BIOS_DISENGAGED;
@@ -1689,16 +1733,14 @@ static int apm(void *unused)
1689 char *power_stat; 1733 char *power_stat;
1690 char *bat_stat; 1734 char *bat_stat;
1691 1735
1692#ifdef CONFIG_SMP
1693 /* 2002/08/01 - WT 1736 /* 2002/08/01 - WT
1694 * This is to avoid random crashes at boot time during initialization 1737 * This is to avoid random crashes at boot time during initialization
1695 * on SMP systems in case of "apm=power-off" mode. Seen on ASUS A7M266D. 1738 * on SMP systems in case of "apm=power-off" mode. Seen on ASUS A7M266D.
1696 * Some bioses don't like being called from CPU != 0. 1739 * Some bioses don't like being called from CPU != 0.
1697 * Method suggested by Ingo Molnar. 1740 * Method suggested by Ingo Molnar.
1698 */ 1741 */
1699 set_cpus_allowed(current, cpumask_of_cpu(0)); 1742 set_cpus_allowed_ptr(current, cpumask_of(0));
1700 BUG_ON(smp_processor_id() != 0); 1743 BUG_ON(smp_processor_id() != 0);
1701#endif
1702 1744
1703 if (apm_info.connection_version == 0) { 1745 if (apm_info.connection_version == 0) {
1704 apm_info.connection_version = apm_info.bios.version; 1746 apm_info.connection_version = apm_info.bios.version;
diff --git a/arch/x86/kernel/cpu/common.c b/arch/x86/kernel/cpu/common.c
index e2962cc1e27b..c4f667896c28 100644
--- a/arch/x86/kernel/cpu/common.c
+++ b/arch/x86/kernel/cpu/common.c
@@ -41,8 +41,6 @@
41 41
42#include "cpu.h" 42#include "cpu.h"
43 43
44#ifdef CONFIG_X86_64
45
46/* all of these masks are initialized in setup_cpu_local_masks() */ 44/* all of these masks are initialized in setup_cpu_local_masks() */
47cpumask_var_t cpu_initialized_mask; 45cpumask_var_t cpu_initialized_mask;
48cpumask_var_t cpu_callout_mask; 46cpumask_var_t cpu_callout_mask;
@@ -60,16 +58,6 @@ void __init setup_cpu_local_masks(void)
60 alloc_bootmem_cpumask_var(&cpu_sibling_setup_mask); 58 alloc_bootmem_cpumask_var(&cpu_sibling_setup_mask);
61} 59}
62 60
63#else /* CONFIG_X86_32 */
64
65cpumask_t cpu_sibling_setup_map;
66cpumask_t cpu_callout_map;
67cpumask_t cpu_initialized;
68cpumask_t cpu_callin_map;
69
70#endif /* CONFIG_X86_32 */
71
72
73static const struct cpu_dev *this_cpu __cpuinitdata; 61static const struct cpu_dev *this_cpu __cpuinitdata;
74 62
75DEFINE_PER_CPU_PAGE_ALIGNED(struct gdt_page, gdt_page) = { .gdt = { 63DEFINE_PER_CPU_PAGE_ALIGNED(struct gdt_page, gdt_page) = { .gdt = {
@@ -859,6 +847,7 @@ static void vgetcpu_set_mode(void)
859void __init identify_boot_cpu(void) 847void __init identify_boot_cpu(void)
860{ 848{
861 identify_cpu(&boot_cpu_data); 849 identify_cpu(&boot_cpu_data);
850 init_c1e_mask();
862#ifdef CONFIG_X86_32 851#ifdef CONFIG_X86_32
863 sysenter_setup(); 852 sysenter_setup();
864 enable_sep_cpu(); 853 enable_sep_cpu();
diff --git a/arch/x86/kernel/cpu/cpufreq/p4-clockmod.c b/arch/x86/kernel/cpu/cpufreq/p4-clockmod.c
index 41ed94915f97..6ac55bd341ae 100644
--- a/arch/x86/kernel/cpu/cpufreq/p4-clockmod.c
+++ b/arch/x86/kernel/cpu/cpufreq/p4-clockmod.c
@@ -211,7 +211,7 @@ static int cpufreq_p4_cpu_init(struct cpufreq_policy *policy)
211 unsigned int i; 211 unsigned int i;
212 212
213#ifdef CONFIG_SMP 213#ifdef CONFIG_SMP
214 cpumask_copy(policy->cpus, &per_cpu(cpu_sibling_map, policy->cpu)); 214 cpumask_copy(policy->cpus, cpu_sibling_mask(policy->cpu));
215#endif 215#endif
216 216
217 /* Errata workaround */ 217 /* Errata workaround */
diff --git a/arch/x86/kernel/cpu/cpufreq/powernow-k8.c b/arch/x86/kernel/cpu/cpufreq/powernow-k8.c
index a15ac94e0b9b..4709ead2db52 100644
--- a/arch/x86/kernel/cpu/cpufreq/powernow-k8.c
+++ b/arch/x86/kernel/cpu/cpufreq/powernow-k8.c
@@ -54,7 +54,10 @@ static DEFINE_PER_CPU(struct powernow_k8_data *, powernow_data);
54static int cpu_family = CPU_OPTERON; 54static int cpu_family = CPU_OPTERON;
55 55
56#ifndef CONFIG_SMP 56#ifndef CONFIG_SMP
57DEFINE_PER_CPU(cpumask_t, cpu_core_map); 57static inline const struct cpumask *cpu_core_mask(int cpu)
58{
59 return cpumask_of(0);
60}
58#endif 61#endif
59 62
60/* Return a frequency in MHz, given an input fid */ 63/* Return a frequency in MHz, given an input fid */
@@ -699,7 +702,7 @@ static int fill_powernow_table(struct powernow_k8_data *data,
699 702
700 dprintk("cfid 0x%x, cvid 0x%x\n", data->currfid, data->currvid); 703 dprintk("cfid 0x%x, cvid 0x%x\n", data->currfid, data->currvid);
701 data->powernow_table = powernow_table; 704 data->powernow_table = powernow_table;
702 if (first_cpu(per_cpu(cpu_core_map, data->cpu)) == data->cpu) 705 if (cpumask_first(cpu_core_mask(data->cpu)) == data->cpu)
703 print_basics(data); 706 print_basics(data);
704 707
705 for (j = 0; j < data->numps; j++) 708 for (j = 0; j < data->numps; j++)
@@ -862,7 +865,7 @@ static int powernow_k8_cpu_init_acpi(struct powernow_k8_data *data)
862 865
863 /* fill in data */ 866 /* fill in data */
864 data->numps = data->acpi_data.state_count; 867 data->numps = data->acpi_data.state_count;
865 if (first_cpu(per_cpu(cpu_core_map, data->cpu)) == data->cpu) 868 if (cpumask_first(cpu_core_mask(data->cpu)) == data->cpu)
866 print_basics(data); 869 print_basics(data);
867 powernow_k8_acpi_pst_values(data, 0); 870 powernow_k8_acpi_pst_values(data, 0);
868 871
@@ -1300,7 +1303,7 @@ static int __cpuinit powernowk8_cpu_init(struct cpufreq_policy *pol)
1300 if (cpu_family == CPU_HW_PSTATE) 1303 if (cpu_family == CPU_HW_PSTATE)
1301 cpumask_copy(pol->cpus, cpumask_of(pol->cpu)); 1304 cpumask_copy(pol->cpus, cpumask_of(pol->cpu));
1302 else 1305 else
1303 cpumask_copy(pol->cpus, &per_cpu(cpu_core_map, pol->cpu)); 1306 cpumask_copy(pol->cpus, cpu_core_mask(pol->cpu));
1304 data->available_cores = pol->cpus; 1307 data->available_cores = pol->cpus;
1305 1308
1306 if (cpu_family == CPU_HW_PSTATE) 1309 if (cpu_family == CPU_HW_PSTATE)
@@ -1365,7 +1368,7 @@ static unsigned int powernowk8_get(unsigned int cpu)
1365 unsigned int khz = 0; 1368 unsigned int khz = 0;
1366 unsigned int first; 1369 unsigned int first;
1367 1370
1368 first = first_cpu(per_cpu(cpu_core_map, cpu)); 1371 first = cpumask_first(cpu_core_mask(cpu));
1369 data = per_cpu(powernow_data, first); 1372 data = per_cpu(powernow_data, first);
1370 1373
1371 if (!data) 1374 if (!data)
diff --git a/arch/x86/kernel/cpu/cpufreq/speedstep-ich.c b/arch/x86/kernel/cpu/cpufreq/speedstep-ich.c
index 8bbb11adb315..016c1a4fa3fc 100644
--- a/arch/x86/kernel/cpu/cpufreq/speedstep-ich.c
+++ b/arch/x86/kernel/cpu/cpufreq/speedstep-ich.c
@@ -321,7 +321,7 @@ static int speedstep_cpu_init(struct cpufreq_policy *policy)
321 321
322 /* only run on CPU to be set, or on its sibling */ 322 /* only run on CPU to be set, or on its sibling */
323#ifdef CONFIG_SMP 323#ifdef CONFIG_SMP
324 cpumask_copy(policy->cpus, &per_cpu(cpu_sibling_map, policy->cpu)); 324 cpumask_copy(policy->cpus, cpu_sibling_mask(policy->cpu));
325#endif 325#endif
326 326
327 cpus_allowed = current->cpus_allowed; 327 cpus_allowed = current->cpus_allowed;
diff --git a/arch/x86/kernel/cpu/intel_cacheinfo.c b/arch/x86/kernel/cpu/intel_cacheinfo.c
index c471eb1a389c..483eda96e102 100644
--- a/arch/x86/kernel/cpu/intel_cacheinfo.c
+++ b/arch/x86/kernel/cpu/intel_cacheinfo.c
@@ -159,7 +159,7 @@ struct _cpuid4_info_regs {
159 unsigned long can_disable; 159 unsigned long can_disable;
160}; 160};
161 161
162#ifdef CONFIG_PCI 162#if defined(CONFIG_PCI) && defined(CONFIG_SYSFS)
163static struct pci_device_id k8_nb_id[] = { 163static struct pci_device_id k8_nb_id[] = {
164 { PCI_DEVICE(PCI_VENDOR_ID_AMD, 0x1103) }, 164 { PCI_DEVICE(PCI_VENDOR_ID_AMD, 0x1103) },
165 { PCI_DEVICE(PCI_VENDOR_ID_AMD, 0x1203) }, 165 { PCI_DEVICE(PCI_VENDOR_ID_AMD, 0x1203) },
@@ -324,15 +324,6 @@ __cpuinit cpuid4_cache_lookup_regs(int index,
324 return 0; 324 return 0;
325} 325}
326 326
327static int
328__cpuinit cpuid4_cache_lookup(int index, struct _cpuid4_info *this_leaf)
329{
330 struct _cpuid4_info_regs *leaf_regs =
331 (struct _cpuid4_info_regs *)this_leaf;
332
333 return cpuid4_cache_lookup_regs(index, leaf_regs);
334}
335
336static int __cpuinit find_num_cache_leaves(void) 327static int __cpuinit find_num_cache_leaves(void)
337{ 328{
338 unsigned int eax, ebx, ecx, edx; 329 unsigned int eax, ebx, ecx, edx;
@@ -508,6 +499,8 @@ unsigned int __cpuinit init_intel_cacheinfo(struct cpuinfo_x86 *c)
508 return l2; 499 return l2;
509} 500}
510 501
502#ifdef CONFIG_SYSFS
503
511/* pointer to _cpuid4_info array (for each cache leaf) */ 504/* pointer to _cpuid4_info array (for each cache leaf) */
512static DEFINE_PER_CPU(struct _cpuid4_info *, cpuid4_info); 505static DEFINE_PER_CPU(struct _cpuid4_info *, cpuid4_info);
513#define CPUID4_INFO_IDX(x, y) (&((per_cpu(cpuid4_info, x))[y])) 506#define CPUID4_INFO_IDX(x, y) (&((per_cpu(cpuid4_info, x))[y]))
@@ -571,6 +564,15 @@ static void __cpuinit free_cache_attributes(unsigned int cpu)
571 per_cpu(cpuid4_info, cpu) = NULL; 564 per_cpu(cpuid4_info, cpu) = NULL;
572} 565}
573 566
567static int
568__cpuinit cpuid4_cache_lookup(int index, struct _cpuid4_info *this_leaf)
569{
570 struct _cpuid4_info_regs *leaf_regs =
571 (struct _cpuid4_info_regs *)this_leaf;
572
573 return cpuid4_cache_lookup_regs(index, leaf_regs);
574}
575
574static void __cpuinit get_cpu_leaves(void *_retval) 576static void __cpuinit get_cpu_leaves(void *_retval)
575{ 577{
576 int j, *retval = _retval, cpu = smp_processor_id(); 578 int j, *retval = _retval, cpu = smp_processor_id();
@@ -612,8 +614,6 @@ static int __cpuinit detect_cache_attributes(unsigned int cpu)
612 return retval; 614 return retval;
613} 615}
614 616
615#ifdef CONFIG_SYSFS
616
617#include <linux/kobject.h> 617#include <linux/kobject.h>
618#include <linux/sysfs.h> 618#include <linux/sysfs.h>
619 619
diff --git a/arch/x86/kernel/cpu/mcheck/mce_64.c b/arch/x86/kernel/cpu/mcheck/mce_64.c
index ca14604611ec..863f89568b1a 100644
--- a/arch/x86/kernel/cpu/mcheck/mce_64.c
+++ b/arch/x86/kernel/cpu/mcheck/mce_64.c
@@ -990,7 +990,7 @@ static struct sysdev_attribute *mce_attributes[] = {
990 NULL 990 NULL
991}; 991};
992 992
993static cpumask_t mce_device_initialized = CPU_MASK_NONE; 993static cpumask_var_t mce_device_initialized;
994 994
995/* Per cpu sysdev init. All of the cpus still share the same ctl bank */ 995/* Per cpu sysdev init. All of the cpus still share the same ctl bank */
996static __cpuinit int mce_create_device(unsigned int cpu) 996static __cpuinit int mce_create_device(unsigned int cpu)
@@ -1021,7 +1021,7 @@ static __cpuinit int mce_create_device(unsigned int cpu)
1021 if (err) 1021 if (err)
1022 goto error2; 1022 goto error2;
1023 } 1023 }
1024 cpu_set(cpu, mce_device_initialized); 1024 cpumask_set_cpu(cpu, mce_device_initialized);
1025 1025
1026 return 0; 1026 return 0;
1027error2: 1027error2:
@@ -1043,7 +1043,7 @@ static __cpuinit void mce_remove_device(unsigned int cpu)
1043{ 1043{
1044 int i; 1044 int i;
1045 1045
1046 if (!cpu_isset(cpu, mce_device_initialized)) 1046 if (!cpumask_test_cpu(cpu, mce_device_initialized))
1047 return; 1047 return;
1048 1048
1049 for (i = 0; mce_attributes[i]; i++) 1049 for (i = 0; mce_attributes[i]; i++)
@@ -1053,7 +1053,7 @@ static __cpuinit void mce_remove_device(unsigned int cpu)
1053 sysdev_remove_file(&per_cpu(device_mce, cpu), 1053 sysdev_remove_file(&per_cpu(device_mce, cpu),
1054 &bank_attrs[i]); 1054 &bank_attrs[i]);
1055 sysdev_unregister(&per_cpu(device_mce,cpu)); 1055 sysdev_unregister(&per_cpu(device_mce,cpu));
1056 cpu_clear(cpu, mce_device_initialized); 1056 cpumask_clear_cpu(cpu, mce_device_initialized);
1057} 1057}
1058 1058
1059/* Make sure there are no machine checks on offlined CPUs. */ 1059/* Make sure there are no machine checks on offlined CPUs. */
@@ -1162,6 +1162,8 @@ static __init int mce_init_device(void)
1162 if (!mce_available(&boot_cpu_data)) 1162 if (!mce_available(&boot_cpu_data))
1163 return -EIO; 1163 return -EIO;
1164 1164
1165 alloc_cpumask_var(&mce_device_initialized, GFP_KERNEL);
1166
1165 err = mce_init_banks(); 1167 err = mce_init_banks();
1166 if (err) 1168 if (err)
1167 return err; 1169 return err;
diff --git a/arch/x86/kernel/cpu/mcheck/mce_amd_64.c b/arch/x86/kernel/cpu/mcheck/mce_amd_64.c
index 7d01be868870..56dde9c4bc96 100644
--- a/arch/x86/kernel/cpu/mcheck/mce_amd_64.c
+++ b/arch/x86/kernel/cpu/mcheck/mce_amd_64.c
@@ -485,7 +485,7 @@ static __cpuinit int threshold_create_bank(unsigned int cpu, unsigned int bank)
485 485
486#ifdef CONFIG_SMP 486#ifdef CONFIG_SMP
487 if (cpu_data(cpu).cpu_core_id && shared_bank[bank]) { /* symlink */ 487 if (cpu_data(cpu).cpu_core_id && shared_bank[bank]) { /* symlink */
488 i = cpumask_first(&per_cpu(cpu_core_map, cpu)); 488 i = cpumask_first(cpu_core_mask(cpu));
489 489
490 /* first core not up yet */ 490 /* first core not up yet */
491 if (cpu_data(i).cpu_core_id) 491 if (cpu_data(i).cpu_core_id)
@@ -505,7 +505,7 @@ static __cpuinit int threshold_create_bank(unsigned int cpu, unsigned int bank)
505 if (err) 505 if (err)
506 goto out; 506 goto out;
507 507
508 cpumask_copy(b->cpus, &per_cpu(cpu_core_map, cpu)); 508 cpumask_copy(b->cpus, cpu_core_mask(cpu));
509 per_cpu(threshold_banks, cpu)[bank] = b; 509 per_cpu(threshold_banks, cpu)[bank] = b;
510 goto out; 510 goto out;
511 } 511 }
@@ -529,7 +529,7 @@ static __cpuinit int threshold_create_bank(unsigned int cpu, unsigned int bank)
529#ifndef CONFIG_SMP 529#ifndef CONFIG_SMP
530 cpumask_setall(b->cpus); 530 cpumask_setall(b->cpus);
531#else 531#else
532 cpumask_copy(b->cpus, &per_cpu(cpu_core_map, cpu)); 532 cpumask_copy(b->cpus, cpu_core_mask(cpu));
533#endif 533#endif
534 534
535 per_cpu(threshold_banks, cpu)[bank] = b; 535 per_cpu(threshold_banks, cpu)[bank] = b;
diff --git a/arch/x86/kernel/cpu/mcheck/mce_intel_64.c b/arch/x86/kernel/cpu/mcheck/mce_intel_64.c
index 57df3d383470..d6b72df89d69 100644
--- a/arch/x86/kernel/cpu/mcheck/mce_intel_64.c
+++ b/arch/x86/kernel/cpu/mcheck/mce_intel_64.c
@@ -249,7 +249,7 @@ void cmci_rediscover(int dying)
249 for_each_online_cpu (cpu) { 249 for_each_online_cpu (cpu) {
250 if (cpu == dying) 250 if (cpu == dying)
251 continue; 251 continue;
252 if (set_cpus_allowed_ptr(current, &cpumask_of_cpu(cpu))) 252 if (set_cpus_allowed_ptr(current, cpumask_of(cpu)))
253 continue; 253 continue;
254 /* Recheck banks in case CPUs don't all have the same */ 254 /* Recheck banks in case CPUs don't all have the same */
255 if (cmci_supported(&banks)) 255 if (cmci_supported(&banks))
diff --git a/arch/x86/kernel/cpu/mtrr/generic.c b/arch/x86/kernel/cpu/mtrr/generic.c
index 37f28fc7cf95..0b776c09aff3 100644
--- a/arch/x86/kernel/cpu/mtrr/generic.c
+++ b/arch/x86/kernel/cpu/mtrr/generic.c
@@ -462,9 +462,6 @@ static void generic_get_mtrr(unsigned int reg, unsigned long *base,
462 *base = base_hi << (32 - PAGE_SHIFT) | base_lo >> PAGE_SHIFT; 462 *base = base_hi << (32 - PAGE_SHIFT) | base_lo >> PAGE_SHIFT;
463 *type = base_lo & 0xff; 463 *type = base_lo & 0xff;
464 464
465 printk(KERN_DEBUG " get_mtrr: cpu%d reg%02d base=%010lx size=%010lx %s\n",
466 cpu, reg, *base, *size,
467 mtrr_attrib_to_str(*type & 0xff));
468out_put_cpu: 465out_put_cpu:
469 put_cpu(); 466 put_cpu();
470} 467}
diff --git a/arch/x86/kernel/cpu/proc.c b/arch/x86/kernel/cpu/proc.c
index d67e0e48bc2d..f93047fed791 100644
--- a/arch/x86/kernel/cpu/proc.c
+++ b/arch/x86/kernel/cpu/proc.c
@@ -14,7 +14,7 @@ static void show_cpuinfo_core(struct seq_file *m, struct cpuinfo_x86 *c,
14 if (c->x86_max_cores * smp_num_siblings > 1) { 14 if (c->x86_max_cores * smp_num_siblings > 1) {
15 seq_printf(m, "physical id\t: %d\n", c->phys_proc_id); 15 seq_printf(m, "physical id\t: %d\n", c->phys_proc_id);
16 seq_printf(m, "siblings\t: %d\n", 16 seq_printf(m, "siblings\t: %d\n",
17 cpus_weight(per_cpu(cpu_core_map, cpu))); 17 cpumask_weight(cpu_sibling_mask(cpu)));
18 seq_printf(m, "core id\t\t: %d\n", c->cpu_core_id); 18 seq_printf(m, "core id\t\t: %d\n", c->cpu_core_id);
19 seq_printf(m, "cpu cores\t: %d\n", c->booted_cores); 19 seq_printf(m, "cpu cores\t: %d\n", c->booted_cores);
20 seq_printf(m, "apicid\t\t: %d\n", c->apicid); 20 seq_printf(m, "apicid\t\t: %d\n", c->apicid);
@@ -143,9 +143,9 @@ static int show_cpuinfo(struct seq_file *m, void *v)
143static void *c_start(struct seq_file *m, loff_t *pos) 143static void *c_start(struct seq_file *m, loff_t *pos)
144{ 144{
145 if (*pos == 0) /* just in case, cpu 0 is not the first */ 145 if (*pos == 0) /* just in case, cpu 0 is not the first */
146 *pos = first_cpu(cpu_online_map); 146 *pos = cpumask_first(cpu_online_mask);
147 else 147 else
148 *pos = next_cpu_nr(*pos - 1, cpu_online_map); 148 *pos = cpumask_next(*pos - 1, cpu_online_mask);
149 if ((*pos) < nr_cpu_ids) 149 if ((*pos) < nr_cpu_ids)
150 return &cpu_data(*pos); 150 return &cpu_data(*pos);
151 return NULL; 151 return NULL;
diff --git a/arch/x86/kernel/microcode_amd.c b/arch/x86/kernel/microcode_amd.c
index c25fdb382292..453b5795a5c6 100644
--- a/arch/x86/kernel/microcode_amd.c
+++ b/arch/x86/kernel/microcode_amd.c
@@ -12,31 +12,30 @@
12 * 12 *
13 * Licensed under the terms of the GNU General Public 13 * Licensed under the terms of the GNU General Public
14 * License version 2. See file COPYING for details. 14 * License version 2. See file COPYING for details.
15*/ 15 */
16 16#include <linux/platform_device.h>
17#include <linux/capability.h> 17#include <linux/capability.h>
18#include <linux/kernel.h>
19#include <linux/init.h>
20#include <linux/sched.h>
21#include <linux/cpumask.h>
22#include <linux/module.h>
23#include <linux/slab.h>
24#include <linux/vmalloc.h>
25#include <linux/miscdevice.h> 18#include <linux/miscdevice.h>
19#include <linux/firmware.h>
26#include <linux/spinlock.h> 20#include <linux/spinlock.h>
27#include <linux/mm.h> 21#include <linux/cpumask.h>
28#include <linux/fs.h> 22#include <linux/pci_ids.h>
23#include <linux/uaccess.h>
24#include <linux/vmalloc.h>
25#include <linux/kernel.h>
26#include <linux/module.h>
29#include <linux/mutex.h> 27#include <linux/mutex.h>
28#include <linux/sched.h>
29#include <linux/init.h>
30#include <linux/slab.h>
30#include <linux/cpu.h> 31#include <linux/cpu.h>
31#include <linux/firmware.h>
32#include <linux/platform_device.h>
33#include <linux/pci.h> 32#include <linux/pci.h>
34#include <linux/pci_ids.h> 33#include <linux/fs.h>
35#include <linux/uaccess.h> 34#include <linux/mm.h>
36 35
37#include <asm/msr.h>
38#include <asm/processor.h>
39#include <asm/microcode.h> 36#include <asm/microcode.h>
37#include <asm/processor.h>
38#include <asm/msr.h>
40 39
41MODULE_DESCRIPTION("AMD Microcode Update Driver"); 40MODULE_DESCRIPTION("AMD Microcode Update Driver");
42MODULE_AUTHOR("Peter Oruba"); 41MODULE_AUTHOR("Peter Oruba");
@@ -72,8 +71,8 @@ struct microcode_header_amd {
72} __attribute__((packed)); 71} __attribute__((packed));
73 72
74struct microcode_amd { 73struct microcode_amd {
75 struct microcode_header_amd hdr; 74 struct microcode_header_amd hdr;
76 unsigned int mpb[0]; 75 unsigned int mpb[0];
77}; 76};
78 77
79#define UCODE_MAX_SIZE 2048 78#define UCODE_MAX_SIZE 2048
@@ -184,8 +183,8 @@ static int get_ucode_data(void *to, const u8 *from, size_t n)
184 return 0; 183 return 0;
185} 184}
186 185
187static void *get_next_ucode(const u8 *buf, unsigned int size, 186static void *
188 unsigned int *mc_size) 187get_next_ucode(const u8 *buf, unsigned int size, unsigned int *mc_size)
189{ 188{
190 unsigned int total_size; 189 unsigned int total_size;
191 u8 section_hdr[UCODE_CONTAINER_SECTION_HDR]; 190 u8 section_hdr[UCODE_CONTAINER_SECTION_HDR];
@@ -223,7 +222,6 @@ static void *get_next_ucode(const u8 *buf, unsigned int size,
223 return mc; 222 return mc;
224} 223}
225 224
226
227static int install_equiv_cpu_table(const u8 *buf) 225static int install_equiv_cpu_table(const u8 *buf)
228{ 226{
229 u8 *container_hdr[UCODE_CONTAINER_HEADER_SIZE]; 227 u8 *container_hdr[UCODE_CONTAINER_HEADER_SIZE];
@@ -372,4 +370,3 @@ struct microcode_ops * __init init_amd_microcode(void)
372{ 370{
373 return &microcode_amd_ops; 371 return &microcode_amd_ops;
374} 372}
375
diff --git a/arch/x86/kernel/microcode_core.c b/arch/x86/kernel/microcode_core.c
index c9b721ba968c..a0f3851ef310 100644
--- a/arch/x86/kernel/microcode_core.c
+++ b/arch/x86/kernel/microcode_core.c
@@ -70,67 +70,78 @@
70 * Fix sigmatch() macro to handle old CPUs with pf == 0. 70 * Fix sigmatch() macro to handle old CPUs with pf == 0.
71 * Thanks to Stuart Swales for pointing out this bug. 71 * Thanks to Stuart Swales for pointing out this bug.
72 */ 72 */
73#include <linux/platform_device.h>
73#include <linux/capability.h> 74#include <linux/capability.h>
74#include <linux/kernel.h> 75#include <linux/miscdevice.h>
75#include <linux/init.h> 76#include <linux/firmware.h>
76#include <linux/sched.h>
77#include <linux/smp_lock.h> 77#include <linux/smp_lock.h>
78#include <linux/spinlock.h>
78#include <linux/cpumask.h> 79#include <linux/cpumask.h>
79#include <linux/module.h> 80#include <linux/uaccess.h>
80#include <linux/slab.h>
81#include <linux/vmalloc.h> 81#include <linux/vmalloc.h>
82#include <linux/miscdevice.h> 82#include <linux/kernel.h>
83#include <linux/spinlock.h> 83#include <linux/module.h>
84#include <linux/mm.h>
85#include <linux/fs.h>
86#include <linux/mutex.h> 84#include <linux/mutex.h>
85#include <linux/sched.h>
86#include <linux/init.h>
87#include <linux/slab.h>
87#include <linux/cpu.h> 88#include <linux/cpu.h>
88#include <linux/firmware.h> 89#include <linux/fs.h>
89#include <linux/platform_device.h> 90#include <linux/mm.h>
90 91
91#include <asm/msr.h>
92#include <asm/uaccess.h>
93#include <asm/processor.h>
94#include <asm/microcode.h> 92#include <asm/microcode.h>
93#include <asm/processor.h>
94#include <asm/msr.h>
95 95
96MODULE_DESCRIPTION("Microcode Update Driver"); 96MODULE_DESCRIPTION("Microcode Update Driver");
97MODULE_AUTHOR("Tigran Aivazian <tigran@aivazian.fsnet.co.uk>"); 97MODULE_AUTHOR("Tigran Aivazian <tigran@aivazian.fsnet.co.uk>");
98MODULE_LICENSE("GPL"); 98MODULE_LICENSE("GPL");
99 99
100#define MICROCODE_VERSION "2.00" 100#define MICROCODE_VERSION "2.00"
101 101
102static struct microcode_ops *microcode_ops; 102static struct microcode_ops *microcode_ops;
103 103
104/* no concurrent ->write()s are allowed on /dev/cpu/microcode */ 104/* no concurrent ->write()s are allowed on /dev/cpu/microcode */
105static DEFINE_MUTEX(microcode_mutex); 105static DEFINE_MUTEX(microcode_mutex);
106 106
107struct ucode_cpu_info ucode_cpu_info[NR_CPUS]; 107struct ucode_cpu_info ucode_cpu_info[NR_CPUS];
108EXPORT_SYMBOL_GPL(ucode_cpu_info); 108EXPORT_SYMBOL_GPL(ucode_cpu_info);
109 109
110#ifdef CONFIG_MICROCODE_OLD_INTERFACE 110#ifdef CONFIG_MICROCODE_OLD_INTERFACE
111struct update_for_cpu {
112 const void __user *buf;
113 size_t size;
114};
115
116static long update_for_cpu(void *_ufc)
117{
118 struct update_for_cpu *ufc = _ufc;
119 int error;
120
121 error = microcode_ops->request_microcode_user(smp_processor_id(),
122 ufc->buf, ufc->size);
123 if (error < 0)
124 return error;
125 if (!error)
126 microcode_ops->apply_microcode(smp_processor_id());
127 return error;
128}
129
111static int do_microcode_update(const void __user *buf, size_t size) 130static int do_microcode_update(const void __user *buf, size_t size)
112{ 131{
113 cpumask_t old;
114 int error = 0; 132 int error = 0;
115 int cpu; 133 int cpu;
116 134 struct update_for_cpu ufc = { .buf = buf, .size = size };
117 old = current->cpus_allowed;
118 135
119 for_each_online_cpu(cpu) { 136 for_each_online_cpu(cpu) {
120 struct ucode_cpu_info *uci = ucode_cpu_info + cpu; 137 struct ucode_cpu_info *uci = ucode_cpu_info + cpu;
121 138
122 if (!uci->valid) 139 if (!uci->valid)
123 continue; 140 continue;
124 141 error = work_on_cpu(cpu, update_for_cpu, &ufc);
125 set_cpus_allowed_ptr(current, &cpumask_of_cpu(cpu));
126 error = microcode_ops->request_microcode_user(cpu, buf, size);
127 if (error < 0) 142 if (error < 0)
128 goto out; 143 break;
129 if (!error)
130 microcode_ops->apply_microcode(cpu);
131 } 144 }
132out:
133 set_cpus_allowed_ptr(current, &old);
134 return error; 145 return error;
135} 146}
136 147
@@ -198,18 +209,33 @@ static void microcode_dev_exit(void)
198 209
199MODULE_ALIAS_MISCDEV(MICROCODE_MINOR); 210MODULE_ALIAS_MISCDEV(MICROCODE_MINOR);
200#else 211#else
201#define microcode_dev_init() 0 212#define microcode_dev_init() 0
202#define microcode_dev_exit() do { } while (0) 213#define microcode_dev_exit() do { } while (0)
203#endif 214#endif
204 215
205/* fake device for request_firmware */ 216/* fake device for request_firmware */
206static struct platform_device *microcode_pdev; 217static struct platform_device *microcode_pdev;
218
219static long reload_for_cpu(void *unused)
220{
221 struct ucode_cpu_info *uci = ucode_cpu_info + smp_processor_id();
222 int err = 0;
223
224 mutex_lock(&microcode_mutex);
225 if (uci->valid) {
226 err = microcode_ops->request_microcode_fw(smp_processor_id(),
227 &microcode_pdev->dev);
228 if (!err)
229 microcode_ops->apply_microcode(smp_processor_id());
230 }
231 mutex_unlock(&microcode_mutex);
232 return err;
233}
207 234
208static ssize_t reload_store(struct sys_device *dev, 235static ssize_t reload_store(struct sys_device *dev,
209 struct sysdev_attribute *attr, 236 struct sysdev_attribute *attr,
210 const char *buf, size_t sz) 237 const char *buf, size_t sz)
211{ 238{
212 struct ucode_cpu_info *uci = ucode_cpu_info + dev->id;
213 char *end; 239 char *end;
214 unsigned long val = simple_strtoul(buf, &end, 0); 240 unsigned long val = simple_strtoul(buf, &end, 0);
215 int err = 0; 241 int err = 0;
@@ -218,21 +244,9 @@ static ssize_t reload_store(struct sys_device *dev,
218 if (end == buf) 244 if (end == buf)
219 return -EINVAL; 245 return -EINVAL;
220 if (val == 1) { 246 if (val == 1) {
221 cpumask_t old = current->cpus_allowed;
222
223 get_online_cpus(); 247 get_online_cpus();
224 if (cpu_online(cpu)) { 248 if (cpu_online(cpu))
225 set_cpus_allowed_ptr(current, &cpumask_of_cpu(cpu)); 249 err = work_on_cpu(cpu, reload_for_cpu, NULL);
226 mutex_lock(&microcode_mutex);
227 if (uci->valid) {
228 err = microcode_ops->request_microcode_fw(cpu,
229 &microcode_pdev->dev);
230 if (!err)
231 microcode_ops->apply_microcode(cpu);
232 }
233 mutex_unlock(&microcode_mutex);
234 set_cpus_allowed_ptr(current, &old);
235 }
236 put_online_cpus(); 250 put_online_cpus();
237 } 251 }
238 if (err) 252 if (err)
@@ -268,8 +282,8 @@ static struct attribute *mc_default_attrs[] = {
268}; 282};
269 283
270static struct attribute_group mc_attr_group = { 284static struct attribute_group mc_attr_group = {
271 .attrs = mc_default_attrs, 285 .attrs = mc_default_attrs,
272 .name = "microcode", 286 .name = "microcode",
273}; 287};
274 288
275static void __microcode_fini_cpu(int cpu) 289static void __microcode_fini_cpu(int cpu)
@@ -328,9 +342,9 @@ static int microcode_resume_cpu(int cpu)
328 return 0; 342 return 0;
329} 343}
330 344
331static void microcode_update_cpu(int cpu) 345static long microcode_update_cpu(void *unused)
332{ 346{
333 struct ucode_cpu_info *uci = ucode_cpu_info + cpu; 347 struct ucode_cpu_info *uci = ucode_cpu_info + smp_processor_id();
334 int err = 0; 348 int err = 0;
335 349
336 /* 350 /*
@@ -338,30 +352,27 @@ static void microcode_update_cpu(int cpu)
338 * otherwise just request a firmware: 352 * otherwise just request a firmware:
339 */ 353 */
340 if (uci->valid) { 354 if (uci->valid) {
341 err = microcode_resume_cpu(cpu); 355 err = microcode_resume_cpu(smp_processor_id());
342 } else { 356 } else {
343 collect_cpu_info(cpu); 357 collect_cpu_info(smp_processor_id());
344 if (uci->valid && system_state == SYSTEM_RUNNING) 358 if (uci->valid && system_state == SYSTEM_RUNNING)
345 err = microcode_ops->request_microcode_fw(cpu, 359 err = microcode_ops->request_microcode_fw(
360 smp_processor_id(),
346 &microcode_pdev->dev); 361 &microcode_pdev->dev);
347 } 362 }
348 if (!err) 363 if (!err)
349 microcode_ops->apply_microcode(cpu); 364 microcode_ops->apply_microcode(smp_processor_id());
365 return err;
350} 366}
351 367
352static void microcode_init_cpu(int cpu) 368static int microcode_init_cpu(int cpu)
353{ 369{
354 cpumask_t old = current->cpus_allowed; 370 int err;
355
356 set_cpus_allowed_ptr(current, &cpumask_of_cpu(cpu));
357 /* We should bind the task to the CPU */
358 BUG_ON(raw_smp_processor_id() != cpu);
359
360 mutex_lock(&microcode_mutex); 371 mutex_lock(&microcode_mutex);
361 microcode_update_cpu(cpu); 372 err = work_on_cpu(cpu, microcode_update_cpu, NULL);
362 mutex_unlock(&microcode_mutex); 373 mutex_unlock(&microcode_mutex);
363 374
364 set_cpus_allowed_ptr(current, &old); 375 return err;
365} 376}
366 377
367static int mc_sysdev_add(struct sys_device *sys_dev) 378static int mc_sysdev_add(struct sys_device *sys_dev)
@@ -379,8 +390,11 @@ static int mc_sysdev_add(struct sys_device *sys_dev)
379 if (err) 390 if (err)
380 return err; 391 return err;
381 392
382 microcode_init_cpu(cpu); 393 err = microcode_init_cpu(cpu);
383 return 0; 394 if (err)
395 sysfs_remove_group(&sys_dev->kobj, &mc_attr_group);
396
397 return err;
384} 398}
385 399
386static int mc_sysdev_remove(struct sys_device *sys_dev) 400static int mc_sysdev_remove(struct sys_device *sys_dev)
@@ -404,14 +418,14 @@ static int mc_sysdev_resume(struct sys_device *dev)
404 return 0; 418 return 0;
405 419
406 /* only CPU 0 will apply ucode here */ 420 /* only CPU 0 will apply ucode here */
407 microcode_update_cpu(0); 421 microcode_update_cpu(NULL);
408 return 0; 422 return 0;
409} 423}
410 424
411static struct sysdev_driver mc_sysdev_driver = { 425static struct sysdev_driver mc_sysdev_driver = {
412 .add = mc_sysdev_add, 426 .add = mc_sysdev_add,
413 .remove = mc_sysdev_remove, 427 .remove = mc_sysdev_remove,
414 .resume = mc_sysdev_resume, 428 .resume = mc_sysdev_resume,
415}; 429};
416 430
417static __cpuinit int 431static __cpuinit int
@@ -424,7 +438,9 @@ mc_cpu_callback(struct notifier_block *nb, unsigned long action, void *hcpu)
424 switch (action) { 438 switch (action) {
425 case CPU_ONLINE: 439 case CPU_ONLINE:
426 case CPU_ONLINE_FROZEN: 440 case CPU_ONLINE_FROZEN:
427 microcode_init_cpu(cpu); 441 if (microcode_init_cpu(cpu))
442 printk(KERN_ERR "microcode: failed to init CPU%d\n",
443 cpu);
428 case CPU_DOWN_FAILED: 444 case CPU_DOWN_FAILED:
429 case CPU_DOWN_FAILED_FROZEN: 445 case CPU_DOWN_FAILED_FROZEN:
430 pr_debug("microcode: CPU%d added\n", cpu); 446 pr_debug("microcode: CPU%d added\n", cpu);
@@ -448,7 +464,7 @@ mc_cpu_callback(struct notifier_block *nb, unsigned long action, void *hcpu)
448} 464}
449 465
450static struct notifier_block __refdata mc_cpu_notifier = { 466static struct notifier_block __refdata mc_cpu_notifier = {
451 .notifier_call = mc_cpu_callback, 467 .notifier_call = mc_cpu_callback,
452}; 468};
453 469
454static int __init microcode_init(void) 470static int __init microcode_init(void)
diff --git a/arch/x86/kernel/microcode_intel.c b/arch/x86/kernel/microcode_intel.c
index 5e9f4fc51385..149b9ec7c1ab 100644
--- a/arch/x86/kernel/microcode_intel.c
+++ b/arch/x86/kernel/microcode_intel.c
@@ -70,28 +70,28 @@
70 * Fix sigmatch() macro to handle old CPUs with pf == 0. 70 * Fix sigmatch() macro to handle old CPUs with pf == 0.
71 * Thanks to Stuart Swales for pointing out this bug. 71 * Thanks to Stuart Swales for pointing out this bug.
72 */ 72 */
73#include <linux/platform_device.h>
73#include <linux/capability.h> 74#include <linux/capability.h>
74#include <linux/kernel.h> 75#include <linux/miscdevice.h>
75#include <linux/init.h> 76#include <linux/firmware.h>
76#include <linux/sched.h>
77#include <linux/smp_lock.h> 77#include <linux/smp_lock.h>
78#include <linux/spinlock.h>
78#include <linux/cpumask.h> 79#include <linux/cpumask.h>
79#include <linux/module.h> 80#include <linux/uaccess.h>
80#include <linux/slab.h>
81#include <linux/vmalloc.h> 81#include <linux/vmalloc.h>
82#include <linux/miscdevice.h> 82#include <linux/kernel.h>
83#include <linux/spinlock.h> 83#include <linux/module.h>
84#include <linux/mm.h>
85#include <linux/fs.h>
86#include <linux/mutex.h> 84#include <linux/mutex.h>
85#include <linux/sched.h>
86#include <linux/init.h>
87#include <linux/slab.h>
87#include <linux/cpu.h> 88#include <linux/cpu.h>
88#include <linux/firmware.h> 89#include <linux/fs.h>
89#include <linux/platform_device.h> 90#include <linux/mm.h>
90#include <linux/uaccess.h>
91 91
92#include <asm/msr.h>
93#include <asm/processor.h>
94#include <asm/microcode.h> 92#include <asm/microcode.h>
93#include <asm/processor.h>
94#include <asm/msr.h>
95 95
96MODULE_DESCRIPTION("Microcode Update Driver"); 96MODULE_DESCRIPTION("Microcode Update Driver");
97MODULE_AUTHOR("Tigran Aivazian <tigran@aivazian.fsnet.co.uk>"); 97MODULE_AUTHOR("Tigran Aivazian <tigran@aivazian.fsnet.co.uk>");
@@ -129,12 +129,13 @@ struct extended_sigtable {
129 struct extended_signature sigs[0]; 129 struct extended_signature sigs[0];
130}; 130};
131 131
132#define DEFAULT_UCODE_DATASIZE (2000) 132#define DEFAULT_UCODE_DATASIZE (2000)
133#define MC_HEADER_SIZE (sizeof(struct microcode_header_intel)) 133#define MC_HEADER_SIZE (sizeof(struct microcode_header_intel))
134#define DEFAULT_UCODE_TOTALSIZE (DEFAULT_UCODE_DATASIZE + MC_HEADER_SIZE) 134#define DEFAULT_UCODE_TOTALSIZE (DEFAULT_UCODE_DATASIZE + MC_HEADER_SIZE)
135#define EXT_HEADER_SIZE (sizeof(struct extended_sigtable)) 135#define EXT_HEADER_SIZE (sizeof(struct extended_sigtable))
136#define EXT_SIGNATURE_SIZE (sizeof(struct extended_signature)) 136#define EXT_SIGNATURE_SIZE (sizeof(struct extended_signature))
137#define DWSIZE (sizeof(u32)) 137#define DWSIZE (sizeof(u32))
138
138#define get_totalsize(mc) \ 139#define get_totalsize(mc) \
139 (((struct microcode_intel *)mc)->hdr.totalsize ? \ 140 (((struct microcode_intel *)mc)->hdr.totalsize ? \
140 ((struct microcode_intel *)mc)->hdr.totalsize : \ 141 ((struct microcode_intel *)mc)->hdr.totalsize : \
@@ -197,30 +198,31 @@ static inline int update_match_cpu(struct cpu_signature *csig, int sig, int pf)
197} 198}
198 199
199static inline int 200static inline int
200update_match_revision(struct microcode_header_intel *mc_header, int rev) 201update_match_revision(struct microcode_header_intel *mc_header, int rev)
201{ 202{
202 return (mc_header->rev <= rev) ? 0 : 1; 203 return (mc_header->rev <= rev) ? 0 : 1;
203} 204}
204 205
205static int microcode_sanity_check(void *mc) 206static int microcode_sanity_check(void *mc)
206{ 207{
208 unsigned long total_size, data_size, ext_table_size;
207 struct microcode_header_intel *mc_header = mc; 209 struct microcode_header_intel *mc_header = mc;
208 struct extended_sigtable *ext_header = NULL; 210 struct extended_sigtable *ext_header = NULL;
209 struct extended_signature *ext_sig;
210 unsigned long total_size, data_size, ext_table_size;
211 int sum, orig_sum, ext_sigcount = 0, i; 211 int sum, orig_sum, ext_sigcount = 0, i;
212 struct extended_signature *ext_sig;
212 213
213 total_size = get_totalsize(mc_header); 214 total_size = get_totalsize(mc_header);
214 data_size = get_datasize(mc_header); 215 data_size = get_datasize(mc_header);
216
215 if (data_size + MC_HEADER_SIZE > total_size) { 217 if (data_size + MC_HEADER_SIZE > total_size) {
216 printk(KERN_ERR "microcode: error! " 218 printk(KERN_ERR "microcode: error! "
217 "Bad data size in microcode data file\n"); 219 "Bad data size in microcode data file\n");
218 return -EINVAL; 220 return -EINVAL;
219 } 221 }
220 222
221 if (mc_header->ldrver != 1 || mc_header->hdrver != 1) { 223 if (mc_header->ldrver != 1 || mc_header->hdrver != 1) {
222 printk(KERN_ERR "microcode: error! " 224 printk(KERN_ERR "microcode: error! "
223 "Unknown microcode update format\n"); 225 "Unknown microcode update format\n");
224 return -EINVAL; 226 return -EINVAL;
225 } 227 }
226 ext_table_size = total_size - (MC_HEADER_SIZE + data_size); 228 ext_table_size = total_size - (MC_HEADER_SIZE + data_size);
@@ -318,11 +320,15 @@ get_matching_microcode(struct cpu_signature *cpu_sig, void *mc, int rev)
318 320
319static void apply_microcode(int cpu) 321static void apply_microcode(int cpu)
320{ 322{
323 struct microcode_intel *mc_intel;
324 struct ucode_cpu_info *uci;
321 unsigned long flags; 325 unsigned long flags;
322 unsigned int val[2]; 326 unsigned int val[2];
323 int cpu_num = raw_smp_processor_id(); 327 int cpu_num;
324 struct ucode_cpu_info *uci = ucode_cpu_info + cpu; 328
325 struct microcode_intel *mc_intel = uci->mc; 329 cpu_num = raw_smp_processor_id();
330 uci = ucode_cpu_info + cpu;
331 mc_intel = uci->mc;
326 332
327 /* We should bind the task to the CPU */ 333 /* We should bind the task to the CPU */
328 BUG_ON(cpu_num != cpu); 334 BUG_ON(cpu_num != cpu);
@@ -348,15 +354,17 @@ static void apply_microcode(int cpu)
348 spin_unlock_irqrestore(&microcode_update_lock, flags); 354 spin_unlock_irqrestore(&microcode_update_lock, flags);
349 if (val[1] != mc_intel->hdr.rev) { 355 if (val[1] != mc_intel->hdr.rev) {
350 printk(KERN_ERR "microcode: CPU%d update from revision " 356 printk(KERN_ERR "microcode: CPU%d update from revision "
351 "0x%x to 0x%x failed\n", cpu_num, uci->cpu_sig.rev, val[1]); 357 "0x%x to 0x%x failed\n",
358 cpu_num, uci->cpu_sig.rev, val[1]);
352 return; 359 return;
353 } 360 }
354 printk(KERN_INFO "microcode: CPU%d updated from revision " 361 printk(KERN_INFO "microcode: CPU%d updated from revision "
355 "0x%x to 0x%x, date = %04x-%02x-%02x \n", 362 "0x%x to 0x%x, date = %04x-%02x-%02x \n",
356 cpu_num, uci->cpu_sig.rev, val[1], 363 cpu_num, uci->cpu_sig.rev, val[1],
357 mc_intel->hdr.date & 0xffff, 364 mc_intel->hdr.date & 0xffff,
358 mc_intel->hdr.date >> 24, 365 mc_intel->hdr.date >> 24,
359 (mc_intel->hdr.date >> 16) & 0xff); 366 (mc_intel->hdr.date >> 16) & 0xff);
367
360 uci->cpu_sig.rev = val[1]; 368 uci->cpu_sig.rev = val[1];
361} 369}
362 370
@@ -404,18 +412,23 @@ static int generic_load_microcode(int cpu, void *data, size_t size,
404 leftover -= mc_size; 412 leftover -= mc_size;
405 } 413 }
406 414
407 if (new_mc) { 415 if (!new_mc)
408 if (!leftover) { 416 goto out;
409 if (uci->mc) 417
410 vfree(uci->mc); 418 if (leftover) {
411 uci->mc = (struct microcode_intel *)new_mc; 419 vfree(new_mc);
412 pr_debug("microcode: CPU%d found a matching microcode update with" 420 goto out;
413 " version 0x%x (current=0x%x)\n",
414 cpu, new_rev, uci->cpu_sig.rev);
415 } else
416 vfree(new_mc);
417 } 421 }
418 422
423 if (uci->mc)
424 vfree(uci->mc);
425 uci->mc = (struct microcode_intel *)new_mc;
426
427 pr_debug("microcode: CPU%d found a matching microcode update with"
428 " version 0x%x (current=0x%x)\n",
429 cpu, new_rev, uci->cpu_sig.rev);
430
431 out:
419 return (int)leftover; 432 return (int)leftover;
420} 433}
421 434
diff --git a/arch/x86/kernel/process.c b/arch/x86/kernel/process.c
index 62fc75b67e45..ca989158e847 100644
--- a/arch/x86/kernel/process.c
+++ b/arch/x86/kernel/process.c
@@ -328,7 +328,7 @@ void stop_this_cpu(void *dummy)
328 /* 328 /*
329 * Remove this CPU: 329 * Remove this CPU:
330 */ 330 */
331 cpu_clear(smp_processor_id(), cpu_online_map); 331 set_cpu_online(smp_processor_id(), false);
332 disable_local_APIC(); 332 disable_local_APIC();
333 333
334 for (;;) { 334 for (;;) {
@@ -478,12 +478,13 @@ static int __cpuinit check_c1e_idle(const struct cpuinfo_x86 *c)
478 return 1; 478 return 1;
479} 479}
480 480
481static cpumask_t c1e_mask = CPU_MASK_NONE; 481static cpumask_var_t c1e_mask;
482static int c1e_detected; 482static int c1e_detected;
483 483
484void c1e_remove_cpu(int cpu) 484void c1e_remove_cpu(int cpu)
485{ 485{
486 cpu_clear(cpu, c1e_mask); 486 if (c1e_mask != NULL)
487 cpumask_clear_cpu(cpu, c1e_mask);
487} 488}
488 489
489/* 490/*
@@ -512,8 +513,8 @@ static void c1e_idle(void)
512 if (c1e_detected) { 513 if (c1e_detected) {
513 int cpu = smp_processor_id(); 514 int cpu = smp_processor_id();
514 515
515 if (!cpu_isset(cpu, c1e_mask)) { 516 if (!cpumask_test_cpu(cpu, c1e_mask)) {
516 cpu_set(cpu, c1e_mask); 517 cpumask_set_cpu(cpu, c1e_mask);
517 /* 518 /*
518 * Force broadcast so ACPI can not interfere. Needs 519 * Force broadcast so ACPI can not interfere. Needs
519 * to run with interrupts enabled as it uses 520 * to run with interrupts enabled as it uses
@@ -565,6 +566,15 @@ void __cpuinit select_idle_routine(const struct cpuinfo_x86 *c)
565 pm_idle = default_idle; 566 pm_idle = default_idle;
566} 567}
567 568
569void __init init_c1e_mask(void)
570{
571 /* If we're using c1e_idle, we need to allocate c1e_mask. */
572 if (pm_idle == c1e_idle) {
573 alloc_cpumask_var(&c1e_mask, GFP_KERNEL);
574 cpumask_clear(c1e_mask);
575 }
576}
577
568static int __init idle_setup(char *str) 578static int __init idle_setup(char *str)
569{ 579{
570 if (!str) 580 if (!str)
diff --git a/arch/x86/kernel/process_32.c b/arch/x86/kernel/process_32.c
index 14014d766cad..76f8f84043a2 100644
--- a/arch/x86/kernel/process_32.c
+++ b/arch/x86/kernel/process_32.c
@@ -245,7 +245,7 @@ void prepare_to_copy(struct task_struct *tsk)
245 unlazy_fpu(tsk); 245 unlazy_fpu(tsk);
246} 246}
247 247
248int copy_thread(int nr, unsigned long clone_flags, unsigned long sp, 248int copy_thread(unsigned long clone_flags, unsigned long sp,
249 unsigned long unused, 249 unsigned long unused,
250 struct task_struct *p, struct pt_regs *regs) 250 struct task_struct *p, struct pt_regs *regs)
251{ 251{
diff --git a/arch/x86/kernel/process_64.c b/arch/x86/kernel/process_64.c
index abb7e6a7f0c6..b751a41392b1 100644
--- a/arch/x86/kernel/process_64.c
+++ b/arch/x86/kernel/process_64.c
@@ -278,7 +278,7 @@ void prepare_to_copy(struct task_struct *tsk)
278 unlazy_fpu(tsk); 278 unlazy_fpu(tsk);
279} 279}
280 280
281int copy_thread(int nr, unsigned long clone_flags, unsigned long sp, 281int copy_thread(unsigned long clone_flags, unsigned long sp,
282 unsigned long unused, 282 unsigned long unused,
283 struct task_struct *p, struct pt_regs *regs) 283 struct task_struct *p, struct pt_regs *regs)
284{ 284{
diff --git a/arch/x86/kernel/ptrace.c b/arch/x86/kernel/ptrace.c
index 5c6e46320db1..fe9345c967de 100644
--- a/arch/x86/kernel/ptrace.c
+++ b/arch/x86/kernel/ptrace.c
@@ -1462,6 +1462,6 @@ asmregparm void syscall_trace_leave(struct pt_regs *regs)
1462 * system call instruction. 1462 * system call instruction.
1463 */ 1463 */
1464 if (test_thread_flag(TIF_SINGLESTEP) && 1464 if (test_thread_flag(TIF_SINGLESTEP) &&
1465 tracehook_consider_fatal_signal(current, SIGTRAP, SIG_DFL)) 1465 tracehook_consider_fatal_signal(current, SIGTRAP))
1466 send_sigtrap(current, regs, 0, TRAP_BRKPT); 1466 send_sigtrap(current, regs, 0, TRAP_BRKPT);
1467} 1467}
diff --git a/arch/x86/kernel/setup_percpu.c b/arch/x86/kernel/setup_percpu.c
index 400331b50a53..3a97a4cf1872 100644
--- a/arch/x86/kernel/setup_percpu.c
+++ b/arch/x86/kernel/setup_percpu.c
@@ -153,7 +153,6 @@ static struct page * __init pcpur_get_page(unsigned int cpu, int pageno)
153static ssize_t __init setup_pcpu_remap(size_t static_size) 153static ssize_t __init setup_pcpu_remap(size_t static_size)
154{ 154{
155 static struct vm_struct vm; 155 static struct vm_struct vm;
156 pg_data_t *last;
157 size_t ptrs_size, dyn_size; 156 size_t ptrs_size, dyn_size;
158 unsigned int cpu; 157 unsigned int cpu;
159 ssize_t ret; 158 ssize_t ret;
@@ -162,22 +161,9 @@ static ssize_t __init setup_pcpu_remap(size_t static_size)
162 * If large page isn't supported, there's no benefit in doing 161 * If large page isn't supported, there's no benefit in doing
163 * this. Also, on non-NUMA, embedding is better. 162 * this. Also, on non-NUMA, embedding is better.
164 */ 163 */
165 if (!cpu_has_pse || pcpu_need_numa()) 164 if (!cpu_has_pse || !pcpu_need_numa())
166 return -EINVAL; 165 return -EINVAL;
167 166
168 last = NULL;
169 for_each_possible_cpu(cpu) {
170 int node = early_cpu_to_node(cpu);
171
172 if (node_online(node) && NODE_DATA(node) &&
173 last && last != NODE_DATA(node))
174 goto proceed;
175
176 last = NODE_DATA(node);
177 }
178 return -EINVAL;
179
180proceed:
181 /* 167 /*
182 * Currently supports only single page. Supporting multiple 168 * Currently supports only single page. Supporting multiple
183 * pages won't be too difficult if it ever becomes necessary. 169 * pages won't be too difficult if it ever becomes necessary.
diff --git a/arch/x86/kernel/signal.c b/arch/x86/kernel/signal.c
index dfcc74ab0ab6..14425166b8e3 100644
--- a/arch/x86/kernel/signal.c
+++ b/arch/x86/kernel/signal.c
@@ -221,7 +221,7 @@ get_sigframe(struct k_sigaction *ka, struct pt_regs *regs, size_t frame_size,
221 if (!onsigstack) { 221 if (!onsigstack) {
222 /* This is the X/Open sanctioned signal stack switching. */ 222 /* This is the X/Open sanctioned signal stack switching. */
223 if (ka->sa.sa_flags & SA_ONSTACK) { 223 if (ka->sa.sa_flags & SA_ONSTACK) {
224 if (sas_ss_flags(sp) == 0) 224 if (current->sas_ss_size)
225 sp = current->sas_ss_sp + current->sas_ss_size; 225 sp = current->sas_ss_sp + current->sas_ss_size;
226 } else { 226 } else {
227#ifdef CONFIG_X86_32 227#ifdef CONFIG_X86_32
diff --git a/arch/x86/kernel/smpboot.c b/arch/x86/kernel/smpboot.c
index ef7d10170c30..58d24ef917d8 100644
--- a/arch/x86/kernel/smpboot.c
+++ b/arch/x86/kernel/smpboot.c
@@ -101,11 +101,11 @@ EXPORT_SYMBOL(smp_num_siblings);
101DEFINE_PER_CPU(u16, cpu_llc_id) = BAD_APICID; 101DEFINE_PER_CPU(u16, cpu_llc_id) = BAD_APICID;
102 102
103/* representing HT siblings of each logical CPU */ 103/* representing HT siblings of each logical CPU */
104DEFINE_PER_CPU(cpumask_t, cpu_sibling_map); 104DEFINE_PER_CPU(cpumask_var_t, cpu_sibling_map);
105EXPORT_PER_CPU_SYMBOL(cpu_sibling_map); 105EXPORT_PER_CPU_SYMBOL(cpu_sibling_map);
106 106
107/* representing HT and core siblings of each logical CPU */ 107/* representing HT and core siblings of each logical CPU */
108DEFINE_PER_CPU(cpumask_t, cpu_core_map); 108DEFINE_PER_CPU(cpumask_var_t, cpu_core_map);
109EXPORT_PER_CPU_SYMBOL(cpu_core_map); 109EXPORT_PER_CPU_SYMBOL(cpu_core_map);
110 110
111/* Per CPU bogomips and other parameters */ 111/* Per CPU bogomips and other parameters */
@@ -115,11 +115,6 @@ EXPORT_PER_CPU_SYMBOL(cpu_info);
115atomic_t init_deasserted; 115atomic_t init_deasserted;
116 116
117#if defined(CONFIG_NUMA) && defined(CONFIG_X86_32) 117#if defined(CONFIG_NUMA) && defined(CONFIG_X86_32)
118
119/* which logical CPUs are on which nodes */
120cpumask_t node_to_cpumask_map[MAX_NUMNODES] __read_mostly =
121 { [0 ... MAX_NUMNODES-1] = CPU_MASK_NONE };
122EXPORT_SYMBOL(node_to_cpumask_map);
123/* which node each logical CPU is on */ 118/* which node each logical CPU is on */
124int cpu_to_node_map[NR_CPUS] __read_mostly = { [0 ... NR_CPUS-1] = 0 }; 119int cpu_to_node_map[NR_CPUS] __read_mostly = { [0 ... NR_CPUS-1] = 0 };
125EXPORT_SYMBOL(cpu_to_node_map); 120EXPORT_SYMBOL(cpu_to_node_map);
@@ -128,7 +123,7 @@ EXPORT_SYMBOL(cpu_to_node_map);
128static void map_cpu_to_node(int cpu, int node) 123static void map_cpu_to_node(int cpu, int node)
129{ 124{
130 printk(KERN_INFO "Mapping cpu %d to node %d\n", cpu, node); 125 printk(KERN_INFO "Mapping cpu %d to node %d\n", cpu, node);
131 cpumask_set_cpu(cpu, &node_to_cpumask_map[node]); 126 cpumask_set_cpu(cpu, node_to_cpumask_map[node]);
132 cpu_to_node_map[cpu] = node; 127 cpu_to_node_map[cpu] = node;
133} 128}
134 129
@@ -139,7 +134,7 @@ static void unmap_cpu_to_node(int cpu)
139 134
140 printk(KERN_INFO "Unmapping cpu %d from all nodes\n", cpu); 135 printk(KERN_INFO "Unmapping cpu %d from all nodes\n", cpu);
141 for (node = 0; node < MAX_NUMNODES; node++) 136 for (node = 0; node < MAX_NUMNODES; node++)
142 cpumask_clear_cpu(cpu, &node_to_cpumask_map[node]); 137 cpumask_clear_cpu(cpu, node_to_cpumask_map[node]);
143 cpu_to_node_map[cpu] = 0; 138 cpu_to_node_map[cpu] = 0;
144} 139}
145#else /* !(CONFIG_NUMA && CONFIG_X86_32) */ 140#else /* !(CONFIG_NUMA && CONFIG_X86_32) */
@@ -301,7 +296,7 @@ notrace static void __cpuinit start_secondary(void *unused)
301 __flush_tlb_all(); 296 __flush_tlb_all();
302#endif 297#endif
303 298
304 /* This must be done before setting cpu_online_map */ 299 /* This must be done before setting cpu_online_mask */
305 set_cpu_sibling_map(raw_smp_processor_id()); 300 set_cpu_sibling_map(raw_smp_processor_id());
306 wmb(); 301 wmb();
307 302
@@ -334,6 +329,23 @@ notrace static void __cpuinit start_secondary(void *unused)
334 cpu_idle(); 329 cpu_idle();
335} 330}
336 331
332#ifdef CONFIG_CPUMASK_OFFSTACK
333/* In this case, llc_shared_map is a pointer to a cpumask. */
334static inline void copy_cpuinfo_x86(struct cpuinfo_x86 *dst,
335 const struct cpuinfo_x86 *src)
336{
337 struct cpumask *llc = dst->llc_shared_map;
338 *dst = *src;
339 dst->llc_shared_map = llc;
340}
341#else
342static inline void copy_cpuinfo_x86(struct cpuinfo_x86 *dst,
343 const struct cpuinfo_x86 *src)
344{
345 *dst = *src;
346}
347#endif /* CONFIG_CPUMASK_OFFSTACK */
348
337/* 349/*
338 * The bootstrap kernel entry code has set these up. Save them for 350 * The bootstrap kernel entry code has set these up. Save them for
339 * a given CPU 351 * a given CPU
@@ -343,7 +355,7 @@ void __cpuinit smp_store_cpu_info(int id)
343{ 355{
344 struct cpuinfo_x86 *c = &cpu_data(id); 356 struct cpuinfo_x86 *c = &cpu_data(id);
345 357
346 *c = boot_cpu_data; 358 copy_cpuinfo_x86(c, &boot_cpu_data);
347 c->cpu_index = id; 359 c->cpu_index = id;
348 if (id != 0) 360 if (id != 0)
349 identify_secondary_cpu(c); 361 identify_secondary_cpu(c);
@@ -367,15 +379,15 @@ void __cpuinit set_cpu_sibling_map(int cpu)
367 cpumask_set_cpu(cpu, cpu_sibling_mask(i)); 379 cpumask_set_cpu(cpu, cpu_sibling_mask(i));
368 cpumask_set_cpu(i, cpu_core_mask(cpu)); 380 cpumask_set_cpu(i, cpu_core_mask(cpu));
369 cpumask_set_cpu(cpu, cpu_core_mask(i)); 381 cpumask_set_cpu(cpu, cpu_core_mask(i));
370 cpumask_set_cpu(i, &c->llc_shared_map); 382 cpumask_set_cpu(i, c->llc_shared_map);
371 cpumask_set_cpu(cpu, &o->llc_shared_map); 383 cpumask_set_cpu(cpu, o->llc_shared_map);
372 } 384 }
373 } 385 }
374 } else { 386 } else {
375 cpumask_set_cpu(cpu, cpu_sibling_mask(cpu)); 387 cpumask_set_cpu(cpu, cpu_sibling_mask(cpu));
376 } 388 }
377 389
378 cpumask_set_cpu(cpu, &c->llc_shared_map); 390 cpumask_set_cpu(cpu, c->llc_shared_map);
379 391
380 if (current_cpu_data.x86_max_cores == 1) { 392 if (current_cpu_data.x86_max_cores == 1) {
381 cpumask_copy(cpu_core_mask(cpu), cpu_sibling_mask(cpu)); 393 cpumask_copy(cpu_core_mask(cpu), cpu_sibling_mask(cpu));
@@ -386,8 +398,8 @@ void __cpuinit set_cpu_sibling_map(int cpu)
386 for_each_cpu(i, cpu_sibling_setup_mask) { 398 for_each_cpu(i, cpu_sibling_setup_mask) {
387 if (per_cpu(cpu_llc_id, cpu) != BAD_APICID && 399 if (per_cpu(cpu_llc_id, cpu) != BAD_APICID &&
388 per_cpu(cpu_llc_id, cpu) == per_cpu(cpu_llc_id, i)) { 400 per_cpu(cpu_llc_id, cpu) == per_cpu(cpu_llc_id, i)) {
389 cpumask_set_cpu(i, &c->llc_shared_map); 401 cpumask_set_cpu(i, c->llc_shared_map);
390 cpumask_set_cpu(cpu, &cpu_data(i).llc_shared_map); 402 cpumask_set_cpu(cpu, cpu_data(i).llc_shared_map);
391 } 403 }
392 if (c->phys_proc_id == cpu_data(i).phys_proc_id) { 404 if (c->phys_proc_id == cpu_data(i).phys_proc_id) {
393 cpumask_set_cpu(i, cpu_core_mask(cpu)); 405 cpumask_set_cpu(i, cpu_core_mask(cpu));
@@ -425,12 +437,7 @@ const struct cpumask *cpu_coregroup_mask(int cpu)
425 if (sched_mc_power_savings || sched_smt_power_savings) 437 if (sched_mc_power_savings || sched_smt_power_savings)
426 return cpu_core_mask(cpu); 438 return cpu_core_mask(cpu);
427 else 439 else
428 return &c->llc_shared_map; 440 return c->llc_shared_map;
429}
430
431cpumask_t cpu_coregroup_map(int cpu)
432{
433 return *cpu_coregroup_mask(cpu);
434} 441}
435 442
436static void impress_friends(void) 443static void impress_friends(void)
@@ -897,9 +904,8 @@ int __cpuinit native_cpu_up(unsigned int cpu)
897 */ 904 */
898static __init void disable_smp(void) 905static __init void disable_smp(void)
899{ 906{
900 /* use the read/write pointers to the present and possible maps */ 907 init_cpu_present(cpumask_of(0));
901 cpumask_copy(&cpu_present_map, cpumask_of(0)); 908 init_cpu_possible(cpumask_of(0));
902 cpumask_copy(&cpu_possible_map, cpumask_of(0));
903 smpboot_clear_io_apic_irqs(); 909 smpboot_clear_io_apic_irqs();
904 910
905 if (smp_found_config) 911 if (smp_found_config)
@@ -1031,6 +1037,8 @@ static void __init smp_cpu_index_default(void)
1031 */ 1037 */
1032void __init native_smp_prepare_cpus(unsigned int max_cpus) 1038void __init native_smp_prepare_cpus(unsigned int max_cpus)
1033{ 1039{
1040 unsigned int i;
1041
1034 preempt_disable(); 1042 preempt_disable();
1035 smp_cpu_index_default(); 1043 smp_cpu_index_default();
1036 current_cpu_data = boot_cpu_data; 1044 current_cpu_data = boot_cpu_data;
@@ -1044,6 +1052,14 @@ void __init native_smp_prepare_cpus(unsigned int max_cpus)
1044 boot_cpu_logical_apicid = logical_smp_processor_id(); 1052 boot_cpu_logical_apicid = logical_smp_processor_id();
1045#endif 1053#endif
1046 current_thread_info()->cpu = 0; /* needed? */ 1054 current_thread_info()->cpu = 0; /* needed? */
1055 for_each_possible_cpu(i) {
1056 alloc_cpumask_var(&per_cpu(cpu_sibling_map, i), GFP_KERNEL);
1057 alloc_cpumask_var(&per_cpu(cpu_core_map, i), GFP_KERNEL);
1058 alloc_cpumask_var(&cpu_data(i).llc_shared_map, GFP_KERNEL);
1059 cpumask_clear(per_cpu(cpu_core_map, i));
1060 cpumask_clear(per_cpu(cpu_sibling_map, i));
1061 cpumask_clear(cpu_data(i).llc_shared_map);
1062 }
1047 set_cpu_sibling_map(0); 1063 set_cpu_sibling_map(0);
1048 1064
1049 enable_IR_x2apic(); 1065 enable_IR_x2apic();
@@ -1132,11 +1148,11 @@ early_param("possible_cpus", _setup_possible_cpus);
1132 1148
1133 1149
1134/* 1150/*
1135 * cpu_possible_map should be static, it cannot change as cpu's 1151 * cpu_possible_mask should be static, it cannot change as cpu's
1136 * are onlined, or offlined. The reason is per-cpu data-structures 1152 * are onlined, or offlined. The reason is per-cpu data-structures
1137 * are allocated by some modules at init time, and dont expect to 1153 * are allocated by some modules at init time, and dont expect to
1138 * do this dynamically on cpu arrival/departure. 1154 * do this dynamically on cpu arrival/departure.
1139 * cpu_present_map on the other hand can change dynamically. 1155 * cpu_present_mask on the other hand can change dynamically.
1140 * In case when cpu_hotplug is not compiled, then we resort to current 1156 * In case when cpu_hotplug is not compiled, then we resort to current
1141 * behaviour, which is cpu_possible == cpu_present. 1157 * behaviour, which is cpu_possible == cpu_present.
1142 * - Ashok Raj 1158 * - Ashok Raj
diff --git a/arch/x86/kernel/syscall_table_32.S b/arch/x86/kernel/syscall_table_32.S
index 3bdb64829b82..ff5c8736b491 100644
--- a/arch/x86/kernel/syscall_table_32.S
+++ b/arch/x86/kernel/syscall_table_32.S
@@ -332,3 +332,5 @@ ENTRY(sys_call_table)
332 .long sys_dup3 /* 330 */ 332 .long sys_dup3 /* 330 */
333 .long sys_pipe2 333 .long sys_pipe2
334 .long sys_inotify_init1 334 .long sys_inotify_init1
335 .long sys_preadv
336 .long sys_pwritev
diff --git a/arch/x86/kernel/tlb_uv.c b/arch/x86/kernel/tlb_uv.c
index 79c073247284..deb5ebb32c3b 100644
--- a/arch/x86/kernel/tlb_uv.c
+++ b/arch/x86/kernel/tlb_uv.c
@@ -275,6 +275,8 @@ const struct cpumask *uv_flush_send_and_wait(int cpu, int this_blade,
275 return NULL; 275 return NULL;
276} 276}
277 277
278static DEFINE_PER_CPU(cpumask_var_t, uv_flush_tlb_mask);
279
278/** 280/**
279 * uv_flush_tlb_others - globally purge translation cache of a virtual 281 * uv_flush_tlb_others - globally purge translation cache of a virtual
280 * address or all TLB's 282 * address or all TLB's
@@ -304,8 +306,7 @@ const struct cpumask *uv_flush_tlb_others(const struct cpumask *cpumask,
304 struct mm_struct *mm, 306 struct mm_struct *mm,
305 unsigned long va, unsigned int cpu) 307 unsigned long va, unsigned int cpu)
306{ 308{
307 static DEFINE_PER_CPU(cpumask_t, flush_tlb_mask); 309 struct cpumask *flush_mask = __get_cpu_var(uv_flush_tlb_mask);
308 struct cpumask *flush_mask = &__get_cpu_var(flush_tlb_mask);
309 int i; 310 int i;
310 int bit; 311 int bit;
311 int blade; 312 int blade;
@@ -755,6 +756,10 @@ static int __init uv_bau_init(void)
755 if (!is_uv_system()) 756 if (!is_uv_system())
756 return 0; 757 return 0;
757 758
759 for_each_possible_cpu(cur_cpu)
760 alloc_cpumask_var_node(&per_cpu(uv_flush_tlb_mask, cur_cpu),
761 GFP_KERNEL, cpu_to_node(cur_cpu));
762
758 uv_bau_retry_limit = 1; 763 uv_bau_retry_limit = 1;
759 uv_nshift = uv_hub_info->n_val; 764 uv_nshift = uv_hub_info->n_val;
760 uv_mmask = (1UL << uv_hub_info->n_val) - 1; 765 uv_mmask = (1UL << uv_hub_info->n_val) - 1;
diff --git a/arch/x86/mm/Makefile b/arch/x86/mm/Makefile
index 08537747cb58..fdd30d08ab52 100644
--- a/arch/x86/mm/Makefile
+++ b/arch/x86/mm/Makefile
@@ -14,7 +14,7 @@ obj-$(CONFIG_MMIOTRACE) += mmiotrace.o
14mmiotrace-y := kmmio.o pf_in.o mmio-mod.o 14mmiotrace-y := kmmio.o pf_in.o mmio-mod.o
15obj-$(CONFIG_MMIOTRACE_TEST) += testmmiotrace.o 15obj-$(CONFIG_MMIOTRACE_TEST) += testmmiotrace.o
16 16
17obj-$(CONFIG_NUMA) += numa_$(BITS).o 17obj-$(CONFIG_NUMA) += numa.o numa_$(BITS).o
18obj-$(CONFIG_K8_NUMA) += k8topology_64.o 18obj-$(CONFIG_K8_NUMA) += k8topology_64.o
19obj-$(CONFIG_ACPI_NUMA) += srat_$(BITS).o 19obj-$(CONFIG_ACPI_NUMA) += srat_$(BITS).o
20 20
diff --git a/arch/x86/mm/highmem_32.c b/arch/x86/mm/highmem_32.c
index 5bc5d1688c1c..8126e8d1a2a4 100644
--- a/arch/x86/mm/highmem_32.c
+++ b/arch/x86/mm/highmem_32.c
@@ -40,7 +40,6 @@ void *kmap_atomic_prot(struct page *page, enum km_type type, pgprot_t prot)
40 40
41 debug_kmap_atomic(type); 41 debug_kmap_atomic(type);
42 42
43 debug_kmap_atomic(type);
44 idx = type + KM_TYPE_NR*smp_processor_id(); 43 idx = type + KM_TYPE_NR*smp_processor_id();
45 vaddr = __fix_to_virt(FIX_KMAP_BEGIN + idx); 44 vaddr = __fix_to_virt(FIX_KMAP_BEGIN + idx);
46 BUG_ON(!pte_none(*(kmap_pte-idx))); 45 BUG_ON(!pte_none(*(kmap_pte-idx)));
diff --git a/arch/x86/mm/iomap_32.c b/arch/x86/mm/iomap_32.c
index bff0c9032f8c..8056545e2d39 100644
--- a/arch/x86/mm/iomap_32.c
+++ b/arch/x86/mm/iomap_32.c
@@ -23,7 +23,7 @@
23 23
24int is_io_mapping_possible(resource_size_t base, unsigned long size) 24int is_io_mapping_possible(resource_size_t base, unsigned long size)
25{ 25{
26#ifndef CONFIG_X86_PAE 26#if !defined(CONFIG_X86_PAE) && defined(CONFIG_PHYS_ADDR_T_64BIT)
27 /* There is no way to map greater than 1 << 32 address without PAE */ 27 /* There is no way to map greater than 1 << 32 address without PAE */
28 if (base + size > 0x100000000ULL) 28 if (base + size > 0x100000000ULL)
29 return 0; 29 return 0;
@@ -39,6 +39,7 @@ void *kmap_atomic_prot_pfn(unsigned long pfn, enum km_type type, pgprot_t prot)
39 39
40 pagefault_disable(); 40 pagefault_disable();
41 41
42 debug_kmap_atomic(type);
42 idx = type + KM_TYPE_NR * smp_processor_id(); 43 idx = type + KM_TYPE_NR * smp_processor_id();
43 vaddr = __fix_to_virt(FIX_KMAP_BEGIN + idx); 44 vaddr = __fix_to_virt(FIX_KMAP_BEGIN + idx);
44 set_pte(kmap_pte - idx, pfn_pte(pfn, prot)); 45 set_pte(kmap_pte - idx, pfn_pte(pfn, prot));
@@ -72,7 +73,6 @@ iounmap_atomic(void *kvaddr, enum km_type type)
72 unsigned long vaddr = (unsigned long) kvaddr & PAGE_MASK; 73 unsigned long vaddr = (unsigned long) kvaddr & PAGE_MASK;
73 enum fixed_addresses idx = type + KM_TYPE_NR*smp_processor_id(); 74 enum fixed_addresses idx = type + KM_TYPE_NR*smp_processor_id();
74 75
75 debug_kmap_atomic(type);
76 /* 76 /*
77 * Force other mappings to Oops if they'll try to access this pte 77 * Force other mappings to Oops if they'll try to access this pte
78 * without first remap it. Keeping stale mappings around is a bad idea 78 * without first remap it. Keeping stale mappings around is a bad idea
diff --git a/arch/x86/mm/mmio-mod.c b/arch/x86/mm/mmio-mod.c
index 2c4baa88f2cb..c9342ed8b402 100644
--- a/arch/x86/mm/mmio-mod.c
+++ b/arch/x86/mm/mmio-mod.c
@@ -378,27 +378,34 @@ static void clear_trace_list(void)
378} 378}
379 379
380#ifdef CONFIG_HOTPLUG_CPU 380#ifdef CONFIG_HOTPLUG_CPU
381static cpumask_t downed_cpus; 381static cpumask_var_t downed_cpus;
382 382
383static void enter_uniprocessor(void) 383static void enter_uniprocessor(void)
384{ 384{
385 int cpu; 385 int cpu;
386 int err; 386 int err;
387 387
388 if (downed_cpus == NULL &&
389 !alloc_cpumask_var(&downed_cpus, GFP_KERNEL)) {
390 pr_notice(NAME "Failed to allocate mask\n");
391 goto out;
392 }
393
388 get_online_cpus(); 394 get_online_cpus();
389 downed_cpus = cpu_online_map; 395 cpumask_copy(downed_cpus, cpu_online_mask);
390 cpu_clear(first_cpu(cpu_online_map), downed_cpus); 396 cpumask_clear_cpu(cpumask_first(cpu_online_mask), downed_cpus);
391 if (num_online_cpus() > 1) 397 if (num_online_cpus() > 1)
392 pr_notice(NAME "Disabling non-boot CPUs...\n"); 398 pr_notice(NAME "Disabling non-boot CPUs...\n");
393 put_online_cpus(); 399 put_online_cpus();
394 400
395 for_each_cpu_mask(cpu, downed_cpus) { 401 for_each_cpu(cpu, downed_cpus) {
396 err = cpu_down(cpu); 402 err = cpu_down(cpu);
397 if (!err) 403 if (!err)
398 pr_info(NAME "CPU%d is down.\n", cpu); 404 pr_info(NAME "CPU%d is down.\n", cpu);
399 else 405 else
400 pr_err(NAME "Error taking CPU%d down: %d\n", cpu, err); 406 pr_err(NAME "Error taking CPU%d down: %d\n", cpu, err);
401 } 407 }
408out:
402 if (num_online_cpus() > 1) 409 if (num_online_cpus() > 1)
403 pr_warning(NAME "multiple CPUs still online, " 410 pr_warning(NAME "multiple CPUs still online, "
404 "may miss events.\n"); 411 "may miss events.\n");
@@ -411,10 +418,10 @@ static void __ref leave_uniprocessor(void)
411 int cpu; 418 int cpu;
412 int err; 419 int err;
413 420
414 if (cpus_weight(downed_cpus) == 0) 421 if (downed_cpus == NULL || cpumask_weight(downed_cpus) == 0)
415 return; 422 return;
416 pr_notice(NAME "Re-enabling CPUs...\n"); 423 pr_notice(NAME "Re-enabling CPUs...\n");
417 for_each_cpu_mask(cpu, downed_cpus) { 424 for_each_cpu(cpu, downed_cpus) {
418 err = cpu_up(cpu); 425 err = cpu_up(cpu);
419 if (!err) 426 if (!err)
420 pr_info(NAME "enabled CPU%d.\n", cpu); 427 pr_info(NAME "enabled CPU%d.\n", cpu);
diff --git a/arch/x86/mm/numa.c b/arch/x86/mm/numa.c
new file mode 100644
index 000000000000..550df481accd
--- /dev/null
+++ b/arch/x86/mm/numa.c
@@ -0,0 +1,67 @@
1/* Common code for 32 and 64-bit NUMA */
2#include <linux/topology.h>
3#include <linux/module.h>
4#include <linux/bootmem.h>
5
6#ifdef CONFIG_DEBUG_PER_CPU_MAPS
7# define DBG(x...) printk(KERN_DEBUG x)
8#else
9# define DBG(x...)
10#endif
11
12/*
13 * Which logical CPUs are on which nodes
14 */
15cpumask_var_t node_to_cpumask_map[MAX_NUMNODES];
16EXPORT_SYMBOL(node_to_cpumask_map);
17
18/*
19 * Allocate node_to_cpumask_map based on number of available nodes
20 * Requires node_possible_map to be valid.
21 *
22 * Note: node_to_cpumask() is not valid until after this is done.
23 * (Use CONFIG_DEBUG_PER_CPU_MAPS to check this.)
24 */
25void __init setup_node_to_cpumask_map(void)
26{
27 unsigned int node, num = 0;
28
29 /* setup nr_node_ids if not done yet */
30 if (nr_node_ids == MAX_NUMNODES) {
31 for_each_node_mask(node, node_possible_map)
32 num = node;
33 nr_node_ids = num + 1;
34 }
35
36 /* allocate the map */
37 for (node = 0; node < nr_node_ids; node++)
38 alloc_bootmem_cpumask_var(&node_to_cpumask_map[node]);
39
40 /* cpumask_of_node() will now work */
41 pr_debug("Node to cpumask map for %d nodes\n", nr_node_ids);
42}
43
44#ifdef CONFIG_DEBUG_PER_CPU_MAPS
45/*
46 * Returns a pointer to the bitmask of CPUs on Node 'node'.
47 */
48const struct cpumask *cpumask_of_node(int node)
49{
50 if (node >= nr_node_ids) {
51 printk(KERN_WARNING
52 "cpumask_of_node(%d): node > nr_node_ids(%d)\n",
53 node, nr_node_ids);
54 dump_stack();
55 return cpu_none_mask;
56 }
57 if (node_to_cpumask_map[node] == NULL) {
58 printk(KERN_WARNING
59 "cpumask_of_node(%d): no node_to_cpumask_map!\n",
60 node);
61 dump_stack();
62 return cpu_online_mask;
63 }
64 return node_to_cpumask_map[node];
65}
66EXPORT_SYMBOL(cpumask_of_node);
67#endif
diff --git a/arch/x86/mm/numa_64.c b/arch/x86/mm/numa_64.c
index 64c9cf043cdd..d73aaa892371 100644
--- a/arch/x86/mm/numa_64.c
+++ b/arch/x86/mm/numa_64.c
@@ -20,12 +20,6 @@
20#include <asm/acpi.h> 20#include <asm/acpi.h>
21#include <asm/k8.h> 21#include <asm/k8.h>
22 22
23#ifdef CONFIG_DEBUG_PER_CPU_MAPS
24# define DBG(x...) printk(KERN_DEBUG x)
25#else
26# define DBG(x...)
27#endif
28
29struct pglist_data *node_data[MAX_NUMNODES] __read_mostly; 23struct pglist_data *node_data[MAX_NUMNODES] __read_mostly;
30EXPORT_SYMBOL(node_data); 24EXPORT_SYMBOL(node_data);
31 25
@@ -49,12 +43,6 @@ DEFINE_EARLY_PER_CPU(int, x86_cpu_to_node_map, NUMA_NO_NODE);
49EXPORT_EARLY_PER_CPU_SYMBOL(x86_cpu_to_node_map); 43EXPORT_EARLY_PER_CPU_SYMBOL(x86_cpu_to_node_map);
50 44
51/* 45/*
52 * Which logical CPUs are on which nodes
53 */
54cpumask_t *node_to_cpumask_map;
55EXPORT_SYMBOL(node_to_cpumask_map);
56
57/*
58 * Given a shift value, try to populate memnodemap[] 46 * Given a shift value, try to populate memnodemap[]
59 * Returns : 47 * Returns :
60 * 1 if OK 48 * 1 if OK
@@ -661,36 +649,6 @@ void __init init_cpu_to_node(void)
661#endif 649#endif
662 650
663 651
664/*
665 * Allocate node_to_cpumask_map based on number of available nodes
666 * Requires node_possible_map to be valid.
667 *
668 * Note: node_to_cpumask() is not valid until after this is done.
669 * (Use CONFIG_DEBUG_PER_CPU_MAPS to check this.)
670 */
671void __init setup_node_to_cpumask_map(void)
672{
673 unsigned int node, num = 0;
674 cpumask_t *map;
675
676 /* setup nr_node_ids if not done yet */
677 if (nr_node_ids == MAX_NUMNODES) {
678 for_each_node_mask(node, node_possible_map)
679 num = node;
680 nr_node_ids = num + 1;
681 }
682
683 /* allocate the map */
684 map = alloc_bootmem_low(nr_node_ids * sizeof(cpumask_t));
685 DBG("node_to_cpumask_map at %p for %d nodes\n", map, nr_node_ids);
686
687 pr_debug("Node to cpumask map at %p for %d nodes\n",
688 map, nr_node_ids);
689
690 /* node_to_cpumask() will now work */
691 node_to_cpumask_map = map;
692}
693
694void __cpuinit numa_set_node(int cpu, int node) 652void __cpuinit numa_set_node(int cpu, int node)
695{ 653{
696 int *cpu_to_node_map = early_per_cpu_ptr(x86_cpu_to_node_map); 654 int *cpu_to_node_map = early_per_cpu_ptr(x86_cpu_to_node_map);
@@ -723,12 +681,12 @@ void __cpuinit numa_clear_node(int cpu)
723 681
724void __cpuinit numa_add_cpu(int cpu) 682void __cpuinit numa_add_cpu(int cpu)
725{ 683{
726 cpu_set(cpu, node_to_cpumask_map[early_cpu_to_node(cpu)]); 684 cpumask_set_cpu(cpu, node_to_cpumask_map[early_cpu_to_node(cpu)]);
727} 685}
728 686
729void __cpuinit numa_remove_cpu(int cpu) 687void __cpuinit numa_remove_cpu(int cpu)
730{ 688{
731 cpu_clear(cpu, node_to_cpumask_map[early_cpu_to_node(cpu)]); 689 cpumask_clear_cpu(cpu, node_to_cpumask_map[early_cpu_to_node(cpu)]);
732} 690}
733 691
734#else /* CONFIG_DEBUG_PER_CPU_MAPS */ 692#else /* CONFIG_DEBUG_PER_CPU_MAPS */
@@ -739,20 +697,20 @@ void __cpuinit numa_remove_cpu(int cpu)
739static void __cpuinit numa_set_cpumask(int cpu, int enable) 697static void __cpuinit numa_set_cpumask(int cpu, int enable)
740{ 698{
741 int node = early_cpu_to_node(cpu); 699 int node = early_cpu_to_node(cpu);
742 cpumask_t *mask; 700 struct cpumask *mask;
743 char buf[64]; 701 char buf[64];
744 702
745 if (node_to_cpumask_map == NULL) { 703 mask = node_to_cpumask_map[node];
746 printk(KERN_ERR "node_to_cpumask_map NULL\n"); 704 if (mask == NULL) {
705 printk(KERN_ERR "node_to_cpumask_map[%i] NULL\n", node);
747 dump_stack(); 706 dump_stack();
748 return; 707 return;
749 } 708 }
750 709
751 mask = &node_to_cpumask_map[node];
752 if (enable) 710 if (enable)
753 cpu_set(cpu, *mask); 711 cpumask_set_cpu(cpu, mask);
754 else 712 else
755 cpu_clear(cpu, *mask); 713 cpumask_clear_cpu(cpu, mask);
756 714
757 cpulist_scnprintf(buf, sizeof(buf), mask); 715 cpulist_scnprintf(buf, sizeof(buf), mask);
758 printk(KERN_DEBUG "%s cpu %d node %d: mask now %s\n", 716 printk(KERN_DEBUG "%s cpu %d node %d: mask now %s\n",
@@ -799,59 +757,6 @@ int early_cpu_to_node(int cpu)
799 return per_cpu(x86_cpu_to_node_map, cpu); 757 return per_cpu(x86_cpu_to_node_map, cpu);
800} 758}
801 759
802
803/* empty cpumask */
804static const cpumask_t cpu_mask_none;
805
806/*
807 * Returns a pointer to the bitmask of CPUs on Node 'node'.
808 */
809const cpumask_t *cpumask_of_node(int node)
810{
811 if (node_to_cpumask_map == NULL) {
812 printk(KERN_WARNING
813 "cpumask_of_node(%d): no node_to_cpumask_map!\n",
814 node);
815 dump_stack();
816 return (const cpumask_t *)&cpu_online_map;
817 }
818 if (node >= nr_node_ids) {
819 printk(KERN_WARNING
820 "cpumask_of_node(%d): node > nr_node_ids(%d)\n",
821 node, nr_node_ids);
822 dump_stack();
823 return &cpu_mask_none;
824 }
825 return &node_to_cpumask_map[node];
826}
827EXPORT_SYMBOL(cpumask_of_node);
828
829/*
830 * Returns a bitmask of CPUs on Node 'node'.
831 *
832 * Side note: this function creates the returned cpumask on the stack
833 * so with a high NR_CPUS count, excessive stack space is used. The
834 * node_to_cpumask_ptr function should be used whenever possible.
835 */
836cpumask_t node_to_cpumask(int node)
837{
838 if (node_to_cpumask_map == NULL) {
839 printk(KERN_WARNING
840 "node_to_cpumask(%d): no node_to_cpumask_map!\n", node);
841 dump_stack();
842 return cpu_online_map;
843 }
844 if (node >= nr_node_ids) {
845 printk(KERN_WARNING
846 "node_to_cpumask(%d): node > nr_node_ids(%d)\n",
847 node, nr_node_ids);
848 dump_stack();
849 return cpu_mask_none;
850 }
851 return node_to_cpumask_map[node];
852}
853EXPORT_SYMBOL(node_to_cpumask);
854
855/* 760/*
856 * --------- end of debug versions of the numa functions --------- 761 * --------- end of debug versions of the numa functions ---------
857 */ 762 */
diff --git a/arch/x86/oprofile/op_model_p4.c b/arch/x86/oprofile/op_model_p4.c
index 4c4a51c90bc2..819b131fd752 100644
--- a/arch/x86/oprofile/op_model_p4.c
+++ b/arch/x86/oprofile/op_model_p4.c
@@ -380,7 +380,7 @@ static unsigned int get_stagger(void)
380{ 380{
381#ifdef CONFIG_SMP 381#ifdef CONFIG_SMP
382 int cpu = smp_processor_id(); 382 int cpu = smp_processor_id();
383 return (cpu != first_cpu(per_cpu(cpu_sibling_map, cpu))); 383 return cpu != cpumask_first(__get_cpu_var(cpu_sibling_map));
384#endif 384#endif
385 return 0; 385 return 0;
386} 386}
diff --git a/arch/x86/pci/i386.c b/arch/x86/pci/i386.c
index f234a37bd428..f1817f71e009 100644
--- a/arch/x86/pci/i386.c
+++ b/arch/x86/pci/i386.c
@@ -258,24 +258,7 @@ void pcibios_set_master(struct pci_dev *dev)
258 pci_write_config_byte(dev, PCI_LATENCY_TIMER, lat); 258 pci_write_config_byte(dev, PCI_LATENCY_TIMER, lat);
259} 259}
260 260
261static void pci_unmap_page_range(struct vm_area_struct *vma)
262{
263 u64 addr = (u64)vma->vm_pgoff << PAGE_SHIFT;
264 free_memtype(addr, addr + vma->vm_end - vma->vm_start);
265}
266
267static void pci_track_mmap_page_range(struct vm_area_struct *vma)
268{
269 u64 addr = (u64)vma->vm_pgoff << PAGE_SHIFT;
270 unsigned long flags = pgprot_val(vma->vm_page_prot)
271 & _PAGE_CACHE_MASK;
272
273 reserve_memtype(addr, addr + vma->vm_end - vma->vm_start, flags, NULL);
274}
275
276static struct vm_operations_struct pci_mmap_ops = { 261static struct vm_operations_struct pci_mmap_ops = {
277 .open = pci_track_mmap_page_range,
278 .close = pci_unmap_page_range,
279 .access = generic_access_phys, 262 .access = generic_access_phys,
280}; 263};
281 264
@@ -283,11 +266,6 @@ int pci_mmap_page_range(struct pci_dev *dev, struct vm_area_struct *vma,
283 enum pci_mmap_state mmap_state, int write_combine) 266 enum pci_mmap_state mmap_state, int write_combine)
284{ 267{
285 unsigned long prot; 268 unsigned long prot;
286 u64 addr = vma->vm_pgoff << PAGE_SHIFT;
287 unsigned long len = vma->vm_end - vma->vm_start;
288 unsigned long flags;
289 unsigned long new_flags;
290 int retval;
291 269
292 /* I/O space cannot be accessed via normal processor loads and 270 /* I/O space cannot be accessed via normal processor loads and
293 * stores on this platform. 271 * stores on this platform.
@@ -308,30 +286,6 @@ int pci_mmap_page_range(struct pci_dev *dev, struct vm_area_struct *vma,
308 286
309 vma->vm_page_prot = __pgprot(prot); 287 vma->vm_page_prot = __pgprot(prot);
310 288
311 flags = pgprot_val(vma->vm_page_prot) & _PAGE_CACHE_MASK;
312 retval = reserve_memtype(addr, addr + len, flags, &new_flags);
313 if (retval)
314 return retval;
315
316 if (flags != new_flags) {
317 if (!is_new_memtype_allowed(flags, new_flags)) {
318 free_memtype(addr, addr+len);
319 return -EINVAL;
320 }
321 flags = new_flags;
322 vma->vm_page_prot = __pgprot(
323 (pgprot_val(vma->vm_page_prot) & ~_PAGE_CACHE_MASK) |
324 flags);
325 }
326
327 if (((vma->vm_pgoff < max_low_pfn_mapped) ||
328 (vma->vm_pgoff >= (1UL<<(32 - PAGE_SHIFT)) &&
329 vma->vm_pgoff < max_pfn_mapped)) &&
330 ioremap_change_attr((unsigned long)__va(addr), len, flags)) {
331 free_memtype(addr, addr + len);
332 return -EINVAL;
333 }
334
335 if (io_remap_pfn_range(vma, vma->vm_start, vma->vm_pgoff, 289 if (io_remap_pfn_range(vma, vma->vm_start, vma->vm_pgoff,
336 vma->vm_end - vma->vm_start, 290 vma->vm_end - vma->vm_start,
337 vma->vm_page_prot)) 291 vma->vm_page_prot))
diff --git a/arch/x86/power/Makefile b/arch/x86/power/Makefile
index 9ff4d5b55ad1..58b32db33125 100644
--- a/arch/x86/power/Makefile
+++ b/arch/x86/power/Makefile
@@ -1,2 +1,7 @@
1# __restore_processor_state() restores %gs after S3 resume and so should not
2# itself be stack-protected
3nostackp := $(call cc-option, -fno-stack-protector)
4CFLAGS_cpu_$(BITS).o := $(nostackp)
5
1obj-$(CONFIG_PM_SLEEP) += cpu_$(BITS).o 6obj-$(CONFIG_PM_SLEEP) += cpu_$(BITS).o
2obj-$(CONFIG_HIBERNATION) += hibernate_$(BITS).o hibernate_asm_$(BITS).o 7obj-$(CONFIG_HIBERNATION) += hibernate_$(BITS).o hibernate_asm_$(BITS).o
diff --git a/arch/x86/xen/smp.c b/arch/x86/xen/smp.c
index 8d470562ffc9..585a6e330837 100644
--- a/arch/x86/xen/smp.c
+++ b/arch/x86/xen/smp.c
@@ -158,7 +158,7 @@ static void __init xen_fill_possible_map(void)
158 rc = HYPERVISOR_vcpu_op(VCPUOP_is_up, i, NULL); 158 rc = HYPERVISOR_vcpu_op(VCPUOP_is_up, i, NULL);
159 if (rc >= 0) { 159 if (rc >= 0) {
160 num_processors++; 160 num_processors++;
161 cpu_set(i, cpu_possible_map); 161 set_cpu_possible(i, true);
162 } 162 }
163 } 163 }
164} 164}
@@ -197,7 +197,7 @@ static void __init xen_smp_prepare_cpus(unsigned int max_cpus)
197 while ((num_possible_cpus() > 1) && (num_possible_cpus() > max_cpus)) { 197 while ((num_possible_cpus() > 1) && (num_possible_cpus() > max_cpus)) {
198 for (cpu = nr_cpu_ids - 1; !cpu_possible(cpu); cpu--) 198 for (cpu = nr_cpu_ids - 1; !cpu_possible(cpu); cpu--)
199 continue; 199 continue;
200 cpu_clear(cpu, cpu_possible_map); 200 set_cpu_possible(cpu, false);
201 } 201 }
202 202
203 for_each_possible_cpu (cpu) { 203 for_each_possible_cpu (cpu) {
@@ -210,7 +210,7 @@ static void __init xen_smp_prepare_cpus(unsigned int max_cpus)
210 if (IS_ERR(idle)) 210 if (IS_ERR(idle))
211 panic("failed fork for CPU %d", cpu); 211 panic("failed fork for CPU %d", cpu);
212 212
213 cpu_set(cpu, cpu_present_map); 213 set_cpu_present(cpu, true);
214 } 214 }
215} 215}
216 216
diff --git a/arch/xtensa/Kconfig b/arch/xtensa/Kconfig
index 981200830432..fa6dc4dd3b19 100644
--- a/arch/xtensa/Kconfig
+++ b/arch/xtensa/Kconfig
@@ -4,16 +4,13 @@
4mainmenu "Linux/Xtensa Kernel Configuration" 4mainmenu "Linux/Xtensa Kernel Configuration"
5 5
6config FRAME_POINTER 6config FRAME_POINTER
7 bool 7 def_bool n
8 default n
9 8
10config ZONE_DMA 9config ZONE_DMA
11 bool 10 def_bool y
12 default y
13 11
14config XTENSA 12config XTENSA
15 bool 13 def_bool y
16 default y
17 select HAVE_IDE 14 select HAVE_IDE
18 help 15 help
19 Xtensa processors are 32-bit RISC machines designed by Tensilica 16 Xtensa processors are 32-bit RISC machines designed by Tensilica
@@ -24,28 +21,25 @@ config XTENSA
24 a home page at <http://xtensa.sourceforge.net/>. 21 a home page at <http://xtensa.sourceforge.net/>.
25 22
26config RWSEM_XCHGADD_ALGORITHM 23config RWSEM_XCHGADD_ALGORITHM
27 bool 24 def_bool y
28 default y
29 25
30config GENERIC_FIND_NEXT_BIT 26config GENERIC_FIND_NEXT_BIT
31 bool 27 def_bool y
32 default y
33 28
34config GENERIC_HWEIGHT 29config GENERIC_HWEIGHT
35 bool 30 def_bool y
36 default y
37 31
38config GENERIC_HARDIRQS 32config GENERIC_HARDIRQS
39 bool 33 def_bool y
40 default y 34
35config GENERIC_GPIO
36 def_bool y
41 37
42config ARCH_HAS_ILOG2_U32 38config ARCH_HAS_ILOG2_U32
43 bool 39 def_bool n
44 default n
45 40
46config ARCH_HAS_ILOG2_U64 41config ARCH_HAS_ILOG2_U64
47 bool 42 def_bool n
48 default n
49 43
50config NO_IOPORT 44config NO_IOPORT
51 def_bool y 45 def_bool y
@@ -54,9 +48,18 @@ config HZ
54 int 48 int
55 default 100 49 default 100
56 50
51config GENERIC_TIME
52 def_bool y
53
57source "init/Kconfig" 54source "init/Kconfig"
58source "kernel/Kconfig.freezer" 55source "kernel/Kconfig.freezer"
59 56
57config MMU
58 def_bool n
59
60config VARIANT_IRQ_SWITCH
61 def_bool n
62
60menu "Processor type and features" 63menu "Processor type and features"
61 64
62choice 65choice
@@ -65,38 +68,41 @@ choice
65 68
66config XTENSA_VARIANT_FSF 69config XTENSA_VARIANT_FSF
67 bool "fsf - default (not generic) configuration" 70 bool "fsf - default (not generic) configuration"
71 select MMU
68 72
69config XTENSA_VARIANT_DC232B 73config XTENSA_VARIANT_DC232B
70 bool "dc232b - Diamond 232L Standard Core Rev.B (LE)" 74 bool "dc232b - Diamond 232L Standard Core Rev.B (LE)"
75 select MMU
71 help 76 help
72 This variant refers to Tensilica's Diamond 232L Standard core Rev.B (LE). 77 This variant refers to Tensilica's Diamond 232L Standard core Rev.B (LE).
73endchoice
74 78
75config MMU 79config XTENSA_VARIANT_S6000
76 bool 80 bool "s6000 - Stretch software configurable processor"
77 default y 81 select VARIANT_IRQ_SWITCH
82 select ARCH_REQUIRE_GPIOLIB
83endchoice
78 84
79config XTENSA_UNALIGNED_USER 85config XTENSA_UNALIGNED_USER
80 bool "Unaligned memory access in use space" 86 bool "Unaligned memory access in use space"
81 ---help--- 87 help
82 The Xtensa architecture currently does not handle unaligned 88 The Xtensa architecture currently does not handle unaligned
83 memory accesses in hardware but through an exception handler. 89 memory accesses in hardware but through an exception handler.
84 Per default, unaligned memory accesses are disabled in user space. 90 Per default, unaligned memory accesses are disabled in user space.
85 91
86 Say Y here to enable unaligned memory access in user space. 92 Say Y here to enable unaligned memory access in user space.
87 93
88config PREEMPT 94config PREEMPT
89 bool "Preemptible Kernel" 95 bool "Preemptible Kernel"
90 ---help--- 96 help
91 This option reduces the latency of the kernel when reacting to 97 This option reduces the latency of the kernel when reacting to
92 real-time or interactive events by allowing a low priority process to 98 real-time or interactive events by allowing a low priority process to
93 be preempted even if it is in kernel mode executing a system call. 99 be preempted even if it is in kernel mode executing a system call.
94 Unfortunately the kernel code has some race conditions if both 100 Unfortunately the kernel code has some race conditions if both
95 CONFIG_SMP and CONFIG_PREEMPT are enabled, so this option is 101 CONFIG_SMP and CONFIG_PREEMPT are enabled, so this option is
96 currently disabled if you are building an SMP kernel. 102 currently disabled if you are building an SMP kernel.
97 103
98 Say Y here if you are building a kernel for a desktop, embedded 104 Say Y here if you are building a kernel for a desktop, embedded
99 or real-time system. Say N if you are unsure. 105 or real-time system. Say N if you are unsure.
100 106
101config MATH_EMULATION 107config MATH_EMULATION
102 bool "Math emulation" 108 bool "Math emulation"
@@ -105,6 +111,32 @@ config MATH_EMULATION
105 111
106endmenu 112endmenu
107 113
114config XTENSA_CALIBRATE_CCOUNT
115 def_bool n
116 help
117 On some platforms (XT2000, for example), the CPU clock rate can
118 vary. The frequency can be determined, however, by measuring
119 against a well known, fixed frequency, such as an UART oscillator.
120
121config SERIAL_CONSOLE
122 def_bool n
123
124config XTENSA_ISS_NETWORK
125 def_bool n
126
127menu "Bus options"
128
129config PCI
130 bool "PCI support"
131 default y
132 help
133 Find out whether you have a PCI motherboard. PCI is the name of a
134 bus system, i.e. the way the CPU talks to the other stuff inside
135 your box. Other bus systems are ISA, EISA, MicroChannel (MCA) or
136 VESA. If you have PCI, say Y, otherwise N.
137
138source "drivers/pci/Kconfig"
139
108menu "Platform options" 140menu "Platform options"
109 141
110choice 142choice
@@ -113,33 +145,35 @@ choice
113 145
114config XTENSA_PLATFORM_ISS 146config XTENSA_PLATFORM_ISS
115 bool "ISS" 147 bool "ISS"
148 select XTENSA_CALIBRATE_CCOUNT
149 select SERIAL_CONSOLE
150 select XTENSA_ISS_NETWORK
116 help 151 help
117 ISS is an acronym for Tensilica's Instruction Set Simulator. 152 ISS is an acronym for Tensilica's Instruction Set Simulator.
118 153
119config XTENSA_PLATFORM_XT2000 154config XTENSA_PLATFORM_XT2000
120 bool "XT2000" 155 bool "XT2000"
156 select XTENSA_CALIBRATE_CCOUNT
157 select PCI
121 help 158 help
122 XT2000 is the name of Tensilica's feature-rich emulation platform. 159 XT2000 is the name of Tensilica's feature-rich emulation platform.
123 This hardware is capable of running a full Linux distribution. 160 This hardware is capable of running a full Linux distribution.
124 161
125endchoice 162config XTENSA_PLATFORM_S6105
163 bool "S6105"
164 select SERIAL_CONSOLE
126 165
166endchoice
127 167
128config XTENSA_CALIBRATE_CCOUNT
129 bool "Auto calibration of the CPU clock rate"
130 ---help---
131 On some platforms (XT2000, for example), the CPU clock rate can
132 vary. The frequency can be determined, however, by measuring
133 against a well known, fixed frequency, such as an UART oscillator.
134 168
135config XTENSA_CPU_CLOCK 169config XTENSA_CPU_CLOCK
136 int "CPU clock rate [MHz]" 170 int "CPU clock rate [MHz]"
137 depends on !XTENSA_CALIBRATE_CCOUNT 171 depends on !XTENSA_CALIBRATE_CCOUNT
138 default "16" 172 default 16
139 173
140config GENERIC_CALIBRATE_DELAY 174config GENERIC_CALIBRATE_DELAY
141 bool "Auto calibration of the BogoMIPS value" 175 bool "Auto calibration of the BogoMIPS value"
142 ---help--- 176 help
143 The BogoMIPS value can easily be derived from the CPU frequency. 177 The BogoMIPS value can easily be derived from the CPU frequency.
144 178
145config CMDLINE_BOOL 179config CMDLINE_BOOL
@@ -156,52 +190,27 @@ config CMDLINE
156 time by entering them here. As a minimum, you should specify the 190 time by entering them here. As a minimum, you should specify the
157 memory size and the root device (e.g., mem=64M root=/dev/nfs). 191 memory size and the root device (e.g., mem=64M root=/dev/nfs).
158 192
159config SERIAL_CONSOLE
160 bool
161 depends on XTENSA_PLATFORM_ISS
162 default y
163
164config XTENSA_ISS_NETWORK
165 bool
166 depends on XTENSA_PLATFORM_ISS
167 default y
168
169source "mm/Kconfig" 193source "mm/Kconfig"
170 194
171endmenu 195endmenu
172 196
173menu "Bus options" 197config HOTPLUG
174 198 bool "Support for hot-pluggable devices"
175config PCI
176 bool "PCI support" if !XTENSA_PLATFORM_ISS
177 depends on !XTENSA_PLATFORM_ISS
178 default y
179 help 199 help
180 Find out whether you have a PCI motherboard. PCI is the name of a 200 Say Y here if you want to plug devices into your computer while
181 bus system, i.e. the way the CPU talks to the other stuff inside 201 the system is running, and be able to use them quickly. In many
182 your box. Other bus systems are ISA, EISA, MicroChannel (MCA) or 202 cases, the devices can likewise be unplugged at any time too.
183 VESA. If you have PCI, say Y, otherwise N.
184 203
185source "drivers/pci/Kconfig" 204 One well known example of this is PCMCIA- or PC-cards, credit-card
205 size devices such as network cards, modems or hard drives which are
206 plugged into slots found on all modern laptop computers. Another
207 example, used on modern desktops as well as laptops, is USB.
186 208
187config HOTPLUG 209 Enable HOTPLUG and build a modular kernel. Get agent software
188 210 (from <http://linux-hotplug.sourceforge.net/>) and install it.
189 bool "Support for hot-pluggable devices" 211 Then your kernel will automatically call out to a user mode "policy
190 ---help--- 212 agent" (/sbin/hotplug) to load modules and set up software needed
191 Say Y here if you want to plug devices into your computer while 213 to use devices as you hotplug them.
192 the system is running, and be able to use them quickly. In many
193 cases, the devices can likewise be unplugged at any time too.
194
195 One well known example of this is PCMCIA- or PC-cards, credit-card
196 size devices such as network cards, modems or hard drives which are
197 plugged into slots found on all modern laptop computers. Another
198 example, used on modern desktops as well as laptops, is USB.
199
200 Enable HOTPLUG and build a modular kernel. Get agent software
201 (from <http://linux-hotplug.sourceforge.net/>) and install it.
202 Then your kernel will automatically call out to a user mode "policy
203 agent" (/sbin/hotplug) to load modules and set up software needed
204 to use devices as you hotplug them.
205 214
206source "drivers/pcmcia/Kconfig" 215source "drivers/pcmcia/Kconfig"
207 216
@@ -213,9 +222,8 @@ menu "Executable file formats"
213 222
214# only elf supported 223# only elf supported
215config KCORE_ELF 224config KCORE_ELF
216 bool 225 def_bool y
217 depends on PROC_FS 226 depends on PROC_FS
218 default y
219 help 227 help
220 If you enabled support for /proc file system then the file 228 If you enabled support for /proc file system then the file
221 /proc/kcore will contain the kernel core image in ELF format. This 229 /proc/kcore will contain the kernel core image in ELF format. This
@@ -240,7 +248,7 @@ source "fs/Kconfig"
240menu "Xtensa initrd options" 248menu "Xtensa initrd options"
241 depends on BLK_DEV_INITRD 249 depends on BLK_DEV_INITRD
242 250
243 config EMBEDDED_RAMDISK 251config EMBEDDED_RAMDISK
244 bool "Embed root filesystem ramdisk into the kernel" 252 bool "Embed root filesystem ramdisk into the kernel"
245 253
246config EMBEDDED_RAMDISK_IMAGE 254config EMBEDDED_RAMDISK_IMAGE
diff --git a/arch/xtensa/Makefile b/arch/xtensa/Makefile
index 1da55fe4beff..4caffac3ca2e 100644
--- a/arch/xtensa/Makefile
+++ b/arch/xtensa/Makefile
@@ -15,6 +15,7 @@
15 15
16variant-$(CONFIG_XTENSA_VARIANT_FSF) := fsf 16variant-$(CONFIG_XTENSA_VARIANT_FSF) := fsf
17variant-$(CONFIG_XTENSA_VARIANT_DC232B) := dc232b 17variant-$(CONFIG_XTENSA_VARIANT_DC232B) := dc232b
18variant-$(CONFIG_XTENSA_VARIANT_S6000) := s6000
18variant-$(CONFIG_XTENSA_VARIANT_LINUX_CUSTOM) := custom 19variant-$(CONFIG_XTENSA_VARIANT_LINUX_CUSTOM) := custom
19 20
20VARIANT = $(variant-y) 21VARIANT = $(variant-y)
@@ -24,6 +25,7 @@ export VARIANT
24 25
25platform-$(CONFIG_XTENSA_PLATFORM_XT2000) := xt2000 26platform-$(CONFIG_XTENSA_PLATFORM_XT2000) := xt2000
26platform-$(CONFIG_XTENSA_PLATFORM_ISS) := iss 27platform-$(CONFIG_XTENSA_PLATFORM_ISS) := iss
28platform-$(CONFIG_XTENSA_PLATFORM_S6105) := s6105
27 29
28PLATFORM = $(platform-y) 30PLATFORM = $(platform-y)
29export PLATFORM 31export PLATFORM
@@ -62,20 +64,23 @@ ifneq ($(VARIANT),)
62 endif 64 endif
63endif 65endif
64 66
65# 67# Only build variant and/or platform if it includes a Makefile
68
69buildvar := $(shell test -a $(srctree)/arch/xtensa/variants/$(VARIANT)/Makefile && echo arch/xtensa/variants/$(VARIANT)/)
70buildplf := $(shell test -a $(srctree)/arch/xtensa/platforms/$(PLATFORM)/Makefile && echo arch/xtensa/platforms/$(PLATFORM)/)
71
72# Find libgcc.a
66 73
67LIBGCC := $(shell $(CC) $(KBUILD_CFLAGS) -print-libgcc-file-name) 74LIBGCC := $(shell $(CC) $(KBUILD_CFLAGS) -print-libgcc-file-name)
68 75
69head-y := arch/xtensa/kernel/head.o 76head-y := arch/xtensa/kernel/head.o
70core-y += arch/xtensa/kernel/ arch/xtensa/mm/ 77core-y += arch/xtensa/kernel/ arch/xtensa/mm/
71ifneq ($(PLATFORM),) 78core-y += $(buildvar) $(buildplf)
72core-y += arch/xtensa/platforms/$(PLATFORM)/ 79
73endif
74libs-y += arch/xtensa/lib/ $(LIBGCC) 80libs-y += arch/xtensa/lib/ $(LIBGCC)
75 81
76boot := arch/xtensa/boot 82boot := arch/xtensa/boot
77 83
78
79all: zImage 84all: zImage
80 85
81bzImage : zImage 86bzImage : zImage
diff --git a/arch/xtensa/configs/s6105_defconfig b/arch/xtensa/configs/s6105_defconfig
new file mode 100644
index 000000000000..6e1deff41590
--- /dev/null
+++ b/arch/xtensa/configs/s6105_defconfig
@@ -0,0 +1,530 @@
1#
2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.29-rc7-s6
4# Tue Mar 10 11:09:26 2009
5#
6# CONFIG_FRAME_POINTER is not set
7CONFIG_ZONE_DMA=y
8CONFIG_XTENSA=y
9CONFIG_RWSEM_XCHGADD_ALGORITHM=y
10CONFIG_GENERIC_FIND_NEXT_BIT=y
11CONFIG_GENERIC_HWEIGHT=y
12CONFIG_GENERIC_HARDIRQS=y
13CONFIG_GENERIC_GPIO=y
14# CONFIG_ARCH_HAS_ILOG2_U32 is not set
15# CONFIG_ARCH_HAS_ILOG2_U64 is not set
16CONFIG_NO_IOPORT=y
17CONFIG_HZ=100
18CONFIG_GENERIC_TIME=y
19CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
20
21#
22# General setup
23#
24CONFIG_EXPERIMENTAL=y
25CONFIG_BROKEN_ON_SMP=y
26CONFIG_LOCK_KERNEL=y
27CONFIG_INIT_ENV_ARG_LIMIT=32
28CONFIG_LOCALVERSION=""
29CONFIG_LOCALVERSION_AUTO=y
30CONFIG_SYSVIPC=y
31CONFIG_SYSVIPC_SYSCTL=y
32# CONFIG_POSIX_MQUEUE is not set
33# CONFIG_BSD_PROCESS_ACCT is not set
34# CONFIG_TASKSTATS is not set
35# CONFIG_AUDIT is not set
36
37#
38# RCU Subsystem
39#
40# CONFIG_CLASSIC_RCU is not set
41# CONFIG_TREE_RCU is not set
42CONFIG_PREEMPT_RCU=y
43# CONFIG_RCU_TRACE is not set
44# CONFIG_TREE_RCU_TRACE is not set
45# CONFIG_PREEMPT_RCU_TRACE is not set
46CONFIG_IKCONFIG=y
47CONFIG_IKCONFIG_PROC=y
48CONFIG_LOG_BUF_SHIFT=16
49# CONFIG_GROUP_SCHED is not set
50# CONFIG_CGROUPS is not set
51# CONFIG_SYSFS_DEPRECATED_V2 is not set
52# CONFIG_RELAY is not set
53# CONFIG_NAMESPACES is not set
54CONFIG_BLK_DEV_INITRD=y
55CONFIG_INITRAMFS_SOURCE=""
56CONFIG_CC_OPTIMIZE_FOR_SIZE=y
57CONFIG_SYSCTL=y
58CONFIG_EMBEDDED=y
59CONFIG_SYSCTL_SYSCALL=y
60CONFIG_KALLSYMS=y
61# CONFIG_KALLSYMS_ALL is not set
62# CONFIG_KALLSYMS_EXTRA_PASS is not set
63# CONFIG_HOTPLUG is not set
64CONFIG_PRINTK=y
65CONFIG_BUG=y
66CONFIG_ELF_CORE=y
67# CONFIG_COMPAT_BRK is not set
68CONFIG_BASE_FULL=y
69CONFIG_FUTEX=y
70CONFIG_ANON_INODES=y
71CONFIG_EPOLL=y
72CONFIG_SIGNALFD=y
73CONFIG_TIMERFD=y
74CONFIG_EVENTFD=y
75CONFIG_AIO=y
76CONFIG_VM_EVENT_COUNTERS=y
77CONFIG_SLAB=y
78# CONFIG_SLUB is not set
79# CONFIG_SLOB is not set
80# CONFIG_PROFILING is not set
81# CONFIG_HAVE_GENERIC_DMA_COHERENT is not set
82CONFIG_SLABINFO=y
83CONFIG_RT_MUTEXES=y
84CONFIG_BASE_SMALL=0
85# CONFIG_MODULES is not set
86CONFIG_BLOCK=y
87# CONFIG_LBD is not set
88# CONFIG_BLK_DEV_IO_TRACE is not set
89# CONFIG_BLK_DEV_BSG is not set
90# CONFIG_BLK_DEV_INTEGRITY is not set
91
92#
93# IO Schedulers
94#
95CONFIG_IOSCHED_NOOP=y
96# CONFIG_IOSCHED_AS is not set
97# CONFIG_IOSCHED_DEADLINE is not set
98CONFIG_IOSCHED_CFQ=y
99# CONFIG_DEFAULT_AS is not set
100# CONFIG_DEFAULT_DEADLINE is not set
101CONFIG_DEFAULT_CFQ=y
102# CONFIG_DEFAULT_NOOP is not set
103CONFIG_DEFAULT_IOSCHED="cfq"
104# CONFIG_FREEZER is not set
105# CONFIG_MMU is not set
106CONFIG_VARIANT_IRQ_SWITCH=y
107
108#
109# Processor type and features
110#
111# CONFIG_XTENSA_VARIANT_FSF is not set
112# CONFIG_XTENSA_VARIANT_DC232B is not set
113CONFIG_XTENSA_VARIANT_S6000=y
114# CONFIG_XTENSA_UNALIGNED_USER is not set
115CONFIG_PREEMPT=y
116# CONFIG_MATH_EMULATION is not set
117# CONFIG_HIGHMEM is not set
118# CONFIG_XTENSA_CALIBRATE_CCOUNT is not set
119CONFIG_SERIAL_CONSOLE=y
120# CONFIG_XTENSA_ISS_NETWORK is not set
121
122#
123# Bus options
124#
125# CONFIG_PCI is not set
126# CONFIG_ARCH_SUPPORTS_MSI is not set
127
128#
129# Platform options
130#
131# CONFIG_XTENSA_PLATFORM_ISS is not set
132# CONFIG_XTENSA_PLATFORM_XT2000 is not set
133CONFIG_XTENSA_PLATFORM_S6105=y
134CONFIG_XTENSA_CPU_CLOCK=300
135CONFIG_GENERIC_CALIBRATE_DELAY=y
136CONFIG_CMDLINE_BOOL=y
137CONFIG_CMDLINE="console=ttyS1,38400 debug bootmem_debug loglevel=7"
138CONFIG_SELECT_MEMORY_MODEL=y
139CONFIG_FLATMEM_MANUAL=y
140# CONFIG_DISCONTIGMEM_MANUAL is not set
141# CONFIG_SPARSEMEM_MANUAL is not set
142CONFIG_FLATMEM=y
143CONFIG_FLAT_NODE_MEM_MAP=y
144CONFIG_PAGEFLAGS_EXTENDED=y
145CONFIG_SPLIT_PTLOCK_CPUS=4
146# CONFIG_PHYS_ADDR_T_64BIT is not set
147CONFIG_ZONE_DMA_FLAG=1
148CONFIG_VIRT_TO_BUS=y
149
150#
151# Executable file formats
152#
153CONFIG_KCORE_ELF=y
154CONFIG_BINFMT_FLAT=y
155# CONFIG_BINFMT_ZFLAT is not set
156# CONFIG_BINFMT_SHARED_FLAT is not set
157# CONFIG_HAVE_AOUT is not set
158# CONFIG_BINFMT_MISC is not set
159CONFIG_NET=y
160
161#
162# Networking options
163#
164CONFIG_COMPAT_NET_DEV_OPS=y
165CONFIG_PACKET=y
166# CONFIG_PACKET_MMAP is not set
167CONFIG_UNIX=y
168# CONFIG_NET_KEY is not set
169CONFIG_INET=y
170# CONFIG_IP_MULTICAST is not set
171# CONFIG_IP_ADVANCED_ROUTER is not set
172CONFIG_IP_FIB_HASH=y
173# CONFIG_IP_PNP is not set
174# CONFIG_NET_IPIP is not set
175# CONFIG_NET_IPGRE is not set
176# CONFIG_ARPD is not set
177# CONFIG_SYN_COOKIES is not set
178# CONFIG_INET_AH is not set
179# CONFIG_INET_ESP is not set
180# CONFIG_INET_IPCOMP is not set
181# CONFIG_INET_XFRM_TUNNEL is not set
182# CONFIG_INET_TUNNEL is not set
183# CONFIG_INET_XFRM_MODE_TRANSPORT is not set
184# CONFIG_INET_XFRM_MODE_TUNNEL is not set
185# CONFIG_INET_XFRM_MODE_BEET is not set
186# CONFIG_INET_LRO is not set
187# CONFIG_INET_DIAG is not set
188# CONFIG_TCP_CONG_ADVANCED is not set
189CONFIG_TCP_CONG_CUBIC=y
190CONFIG_DEFAULT_TCP_CONG="cubic"
191# CONFIG_TCP_MD5SIG is not set
192# CONFIG_IPV6 is not set
193# CONFIG_NETWORK_SECMARK is not set
194# CONFIG_NETFILTER is not set
195# CONFIG_IP_DCCP is not set
196# CONFIG_IP_SCTP is not set
197# CONFIG_TIPC is not set
198# CONFIG_ATM is not set
199# CONFIG_BRIDGE is not set
200# CONFIG_NET_DSA is not set
201# CONFIG_VLAN_8021Q is not set
202# CONFIG_DECNET is not set
203# CONFIG_LLC2 is not set
204# CONFIG_IPX is not set
205# CONFIG_ATALK is not set
206# CONFIG_X25 is not set
207# CONFIG_LAPB is not set
208# CONFIG_ECONET is not set
209# CONFIG_WAN_ROUTER is not set
210# CONFIG_NET_SCHED is not set
211# CONFIG_DCB is not set
212
213#
214# Network testing
215#
216# CONFIG_NET_PKTGEN is not set
217# CONFIG_HAMRADIO is not set
218# CONFIG_CAN is not set
219# CONFIG_IRDA is not set
220# CONFIG_BT is not set
221# CONFIG_AF_RXRPC is not set
222# CONFIG_PHONET is not set
223# CONFIG_WIRELESS is not set
224# CONFIG_WIMAX is not set
225# CONFIG_RFKILL is not set
226# CONFIG_NET_9P is not set
227
228#
229# Device Drivers
230#
231
232#
233# Generic Driver Options
234#
235CONFIG_STANDALONE=y
236CONFIG_PREVENT_FIRMWARE_BUILD=y
237# CONFIG_DEBUG_DRIVER is not set
238# CONFIG_DEBUG_DEVRES is not set
239# CONFIG_SYS_HYPERVISOR is not set
240# CONFIG_CONNECTOR is not set
241# CONFIG_MTD is not set
242# CONFIG_PARPORT is not set
243CONFIG_BLK_DEV=y
244# CONFIG_BLK_DEV_COW_COMMON is not set
245# CONFIG_BLK_DEV_LOOP is not set
246# CONFIG_BLK_DEV_NBD is not set
247CONFIG_BLK_DEV_RAM=y
248CONFIG_BLK_DEV_RAM_COUNT=16
249CONFIG_BLK_DEV_RAM_SIZE=4096
250# CONFIG_BLK_DEV_XIP is not set
251# CONFIG_CDROM_PKTCDVD is not set
252# CONFIG_ATA_OVER_ETH is not set
253# CONFIG_BLK_DEV_HD is not set
254# CONFIG_MISC_DEVICES is not set
255CONFIG_HAVE_IDE=y
256# CONFIG_IDE is not set
257
258#
259# SCSI device support
260#
261# CONFIG_RAID_ATTRS is not set
262# CONFIG_SCSI is not set
263# CONFIG_SCSI_DMA is not set
264# CONFIG_SCSI_NETLINK is not set
265# CONFIG_ATA is not set
266# CONFIG_MD is not set
267# CONFIG_NETDEVICES is not set
268# CONFIG_ISDN is not set
269# CONFIG_PHONE is not set
270
271#
272# Input device support
273#
274# CONFIG_INPUT is not set
275
276#
277# Hardware I/O ports
278#
279# CONFIG_SERIO is not set
280# CONFIG_GAMEPORT is not set
281
282#
283# Character devices
284#
285# CONFIG_VT is not set
286# CONFIG_DEVKMEM is not set
287# CONFIG_SERIAL_NONSTANDARD is not set
288
289#
290# Serial drivers
291#
292CONFIG_SERIAL_8250=y
293CONFIG_SERIAL_8250_CONSOLE=y
294CONFIG_SERIAL_8250_NR_UARTS=2
295CONFIG_SERIAL_8250_RUNTIME_UARTS=2
296# CONFIG_SERIAL_8250_EXTENDED is not set
297
298#
299# Non-8250 serial port support
300#
301CONFIG_SERIAL_CORE=y
302CONFIG_SERIAL_CORE_CONSOLE=y
303CONFIG_UNIX98_PTYS=y
304# CONFIG_DEVPTS_MULTIPLE_INSTANCES is not set
305# CONFIG_LEGACY_PTYS is not set
306# CONFIG_IPMI_HANDLER is not set
307# CONFIG_HW_RANDOM is not set
308# CONFIG_RTC is not set
309# CONFIG_GEN_RTC is not set
310# CONFIG_R3964 is not set
311# CONFIG_RAW_DRIVER is not set
312# CONFIG_TCG_TPM is not set
313# CONFIG_I2C is not set
314# CONFIG_SPI is not set
315CONFIG_ARCH_REQUIRE_GPIOLIB=y
316CONFIG_GPIOLIB=y
317# CONFIG_DEBUG_GPIO is not set
318# CONFIG_GPIO_SYSFS is not set
319
320#
321# Memory mapped GPIO expanders:
322#
323
324#
325# I2C GPIO expanders:
326#
327
328#
329# PCI GPIO expanders:
330#
331
332#
333# SPI GPIO expanders:
334#
335# CONFIG_W1 is not set
336# CONFIG_POWER_SUPPLY is not set
337# CONFIG_HWMON is not set
338# CONFIG_THERMAL is not set
339# CONFIG_THERMAL_HWMON is not set
340# CONFIG_WATCHDOG is not set
341CONFIG_SSB_POSSIBLE=y
342
343#
344# Sonics Silicon Backplane
345#
346# CONFIG_SSB is not set
347
348#
349# Multifunction device drivers
350#
351# CONFIG_MFD_CORE is not set
352# CONFIG_MFD_SM501 is not set
353# CONFIG_HTC_PASIC3 is not set
354# CONFIG_MFD_TMIO is not set
355# CONFIG_REGULATOR is not set
356
357#
358# Multimedia devices
359#
360
361#
362# Multimedia core support
363#
364# CONFIG_VIDEO_DEV is not set
365# CONFIG_DVB_CORE is not set
366# CONFIG_VIDEO_MEDIA is not set
367
368#
369# Multimedia drivers
370#
371# CONFIG_DAB is not set
372
373#
374# Graphics support
375#
376# CONFIG_VGASTATE is not set
377# CONFIG_VIDEO_OUTPUT_CONTROL is not set
378# CONFIG_FB is not set
379# CONFIG_BACKLIGHT_LCD_SUPPORT is not set
380
381#
382# Display device support
383#
384# CONFIG_DISPLAY_SUPPORT is not set
385# CONFIG_SOUND is not set
386# CONFIG_USB_SUPPORT is not set
387# CONFIG_MMC is not set
388# CONFIG_MEMSTICK is not set
389# CONFIG_NEW_LEDS is not set
390# CONFIG_ACCESSIBILITY is not set
391# CONFIG_RTC_CLASS is not set
392# CONFIG_DMADEVICES is not set
393# CONFIG_UIO is not set
394# CONFIG_STAGING is not set
395
396#
397# File systems
398#
399# CONFIG_EXT2_FS is not set
400# CONFIG_EXT3_FS is not set
401# CONFIG_EXT4_FS is not set
402# CONFIG_REISERFS_FS is not set
403# CONFIG_JFS_FS is not set
404# CONFIG_FS_POSIX_ACL is not set
405CONFIG_FILE_LOCKING=y
406# CONFIG_XFS_FS is not set
407# CONFIG_OCFS2_FS is not set
408# CONFIG_BTRFS_FS is not set
409# CONFIG_DNOTIFY is not set
410# CONFIG_INOTIFY is not set
411# CONFIG_QUOTA is not set
412# CONFIG_AUTOFS_FS is not set
413# CONFIG_AUTOFS4_FS is not set
414# CONFIG_FUSE_FS is not set
415
416#
417# CD-ROM/DVD Filesystems
418#
419# CONFIG_ISO9660_FS is not set
420# CONFIG_UDF_FS is not set
421
422#
423# DOS/FAT/NT Filesystems
424#
425# CONFIG_MSDOS_FS is not set
426# CONFIG_VFAT_FS is not set
427# CONFIG_NTFS_FS is not set
428
429#
430# Pseudo filesystems
431#
432CONFIG_PROC_FS=y
433CONFIG_PROC_SYSCTL=y
434CONFIG_SYSFS=y
435# CONFIG_TMPFS is not set
436# CONFIG_HUGETLB_PAGE is not set
437# CONFIG_CONFIGFS_FS is not set
438# CONFIG_MISC_FILESYSTEMS is not set
439# CONFIG_NETWORK_FILESYSTEMS is not set
440
441#
442# Partition Types
443#
444# CONFIG_PARTITION_ADVANCED is not set
445CONFIG_MSDOS_PARTITION=y
446# CONFIG_NLS is not set
447# CONFIG_DLM is not set
448
449#
450# Xtensa initrd options
451#
452# CONFIG_EMBEDDED_RAMDISK is not set
453
454#
455# Kernel hacking
456#
457CONFIG_PRINTK_TIME=y
458# CONFIG_ENABLE_WARN_DEPRECATED is not set
459# CONFIG_ENABLE_MUST_CHECK is not set
460CONFIG_FRAME_WARN=1024
461# CONFIG_MAGIC_SYSRQ is not set
462# CONFIG_UNUSED_SYMBOLS is not set
463# CONFIG_DEBUG_FS is not set
464# CONFIG_HEADERS_CHECK is not set
465CONFIG_DEBUG_KERNEL=y
466CONFIG_DEBUG_SHIRQ=y
467CONFIG_DETECT_SOFTLOCKUP=y
468# CONFIG_BOOTPARAM_SOFTLOCKUP_PANIC is not set
469CONFIG_BOOTPARAM_SOFTLOCKUP_PANIC_VALUE=0
470# CONFIG_SCHED_DEBUG is not set
471# CONFIG_SCHEDSTATS is not set
472# CONFIG_TIMER_STATS is not set
473# CONFIG_DEBUG_OBJECTS is not set
474# CONFIG_DEBUG_SLAB is not set
475# CONFIG_DEBUG_RT_MUTEXES is not set
476# CONFIG_RT_MUTEX_TESTER is not set
477CONFIG_DEBUG_SPINLOCK=y
478CONFIG_DEBUG_MUTEXES=y
479CONFIG_DEBUG_SPINLOCK_SLEEP=y
480# CONFIG_DEBUG_LOCKING_API_SELFTESTS is not set
481# CONFIG_DEBUG_KOBJECT is not set
482# CONFIG_DEBUG_INFO is not set
483# CONFIG_DEBUG_VM is not set
484CONFIG_DEBUG_NOMMU_REGIONS=y
485# CONFIG_DEBUG_WRITECOUNT is not set
486# CONFIG_DEBUG_MEMORY_INIT is not set
487# CONFIG_DEBUG_LIST is not set
488# CONFIG_DEBUG_SG is not set
489# CONFIG_DEBUG_NOTIFIERS is not set
490# CONFIG_BOOT_PRINTK_DELAY is not set
491# CONFIG_RCU_TORTURE_TEST is not set
492# CONFIG_BACKTRACE_SELF_TEST is not set
493# CONFIG_DEBUG_BLOCK_EXT_DEVT is not set
494# CONFIG_FAULT_INJECTION is not set
495# CONFIG_SYSCTL_SYSCALL_CHECK is not set
496
497#
498# Tracers
499#
500# CONFIG_PREEMPT_TRACER is not set
501# CONFIG_SCHED_TRACER is not set
502# CONFIG_CONTEXT_SWITCH_TRACER is not set
503# CONFIG_BOOT_TRACER is not set
504# CONFIG_TRACE_BRANCH_PROFILING is not set
505# CONFIG_DYNAMIC_PRINTK_DEBUG is not set
506# CONFIG_SAMPLES is not set
507
508#
509# Security options
510#
511# CONFIG_KEYS is not set
512# CONFIG_SECURITY is not set
513# CONFIG_SECURITYFS is not set
514# CONFIG_SECURITY_FILE_CAPABILITIES is not set
515# CONFIG_CRYPTO is not set
516
517#
518# Library routines
519#
520CONFIG_GENERIC_FIND_LAST_BIT=y
521# CONFIG_CRC_CCITT is not set
522# CONFIG_CRC16 is not set
523# CONFIG_CRC_T10DIF is not set
524# CONFIG_CRC_ITU_T is not set
525# CONFIG_CRC32 is not set
526# CONFIG_CRC7 is not set
527# CONFIG_LIBCRC32C is not set
528CONFIG_PLIST=y
529CONFIG_HAS_IOMEM=y
530CONFIG_HAS_DMA=y
diff --git a/arch/xtensa/include/asm/cacheflush.h b/arch/xtensa/include/asm/cacheflush.h
index 94c4c53a099e..8fc1c0c8de07 100644
--- a/arch/xtensa/include/asm/cacheflush.h
+++ b/arch/xtensa/include/asm/cacheflush.h
@@ -65,13 +65,17 @@ extern void __flush_invalidate_dcache_range(unsigned long, unsigned long);
65# define __flush_invalidate_dcache_range(p,s) __invalidate_dcache_range(p,s) 65# define __flush_invalidate_dcache_range(p,s) __invalidate_dcache_range(p,s)
66#endif 66#endif
67 67
68#if (DCACHE_WAY_SIZE > PAGE_SIZE) 68#if defined(CONFIG_MMU) && (DCACHE_WAY_SIZE > PAGE_SIZE)
69extern void __flush_invalidate_dcache_page_alias(unsigned long, unsigned long); 69extern void __flush_invalidate_dcache_page_alias(unsigned long, unsigned long);
70#else
71static inline void __flush_invalidate_dcache_page_alias(unsigned long virt,
72 unsigned long phys) { }
70#endif 73#endif
71#if (ICACHE_WAY_SIZE > PAGE_SIZE) 74#if defined(CONFIG_MMU) && (ICACHE_WAY_SIZE > PAGE_SIZE)
72extern void __invalidate_icache_page_alias(unsigned long, unsigned long); 75extern void __invalidate_icache_page_alias(unsigned long, unsigned long);
73#else 76#else
74# define __invalidate_icache_page_alias(v,p) do { } while(0) 77static inline void __invalidate_icache_page_alias(unsigned long virt,
78 unsigned long phys) { }
75#endif 79#endif
76 80
77/* 81/*
diff --git a/arch/xtensa/include/asm/dma.h b/arch/xtensa/include/asm/dma.h
index e30f3abf48f0..137ca3945b07 100644
--- a/arch/xtensa/include/asm/dma.h
+++ b/arch/xtensa/include/asm/dma.h
@@ -44,8 +44,9 @@
44 * the value desired). 44 * the value desired).
45 */ 45 */
46 46
47#ifndef MAX_DMA_ADDRESS
47#define MAX_DMA_ADDRESS (PAGE_OFFSET + XCHAL_KIO_SIZE - 1) 48#define MAX_DMA_ADDRESS (PAGE_OFFSET + XCHAL_KIO_SIZE - 1)
48 49#endif
49 50
50/* Reserve and release a DMA channel */ 51/* Reserve and release a DMA channel */
51extern int request_dma(unsigned int dmanr, const char * device_id); 52extern int request_dma(unsigned int dmanr, const char * device_id);
diff --git a/arch/xtensa/include/asm/flat.h b/arch/xtensa/include/asm/flat.h
new file mode 100644
index 000000000000..94c44abf15e4
--- /dev/null
+++ b/arch/xtensa/include/asm/flat.h
@@ -0,0 +1,12 @@
1#ifndef __ASM_XTENSA_FLAT_H
2#define __ASM_XTENSA_FLAT_H
3
4#define flat_argvp_envp_on_stack() 0
5#define flat_old_ram_flag(flags) (flags)
6#define flat_reloc_valid(reloc, size) ((reloc) <= (size))
7#define flat_get_addr_from_rp(rp, relval, flags, p) get_unaligned(rp)
8#define flat_put_addr_at_rp(rp, val, relval ) put_unaligned(val, rp)
9#define flat_get_relocate_addr(rel) (rel)
10#define flat_set_persistent(relval, p) 0
11
12#endif /* __ASM_XTENSA_FLAT_H */
diff --git a/arch/xtensa/include/asm/gpio.h b/arch/xtensa/include/asm/gpio.h
new file mode 100644
index 000000000000..0763b0763960
--- /dev/null
+++ b/arch/xtensa/include/asm/gpio.h
@@ -0,0 +1,56 @@
1/*
2 * Generic GPIO API implementation for xtensa.
3 *
4 * Stolen from x86, which is derived from the generic GPIO API for powerpc:
5 *
6 * Copyright (c) 2007-2008 MontaVista Software, Inc.
7 *
8 * Author: Anton Vorontsov <avorontsov@ru.mvista.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 as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
14 */
15
16#ifndef _ASM_XTENSA_GPIO_H
17#define _ASM_XTENSA_GPIO_H
18
19#include <asm-generic/gpio.h>
20
21#ifdef CONFIG_GPIOLIB
22
23/*
24 * Just call gpiolib.
25 */
26static inline int gpio_get_value(unsigned int gpio)
27{
28 return __gpio_get_value(gpio);
29}
30
31static inline void gpio_set_value(unsigned int gpio, int value)
32{
33 __gpio_set_value(gpio, value);
34}
35
36static inline int gpio_cansleep(unsigned int gpio)
37{
38 return __gpio_cansleep(gpio);
39}
40
41/*
42 * Not implemented, yet.
43 */
44static inline int gpio_to_irq(unsigned int gpio)
45{
46 return -ENOSYS;
47}
48
49static inline int irq_to_gpio(unsigned int irq)
50{
51 return -EINVAL;
52}
53
54#endif /* CONFIG_GPIOLIB */
55
56#endif /* _ASM_XTENSA_GPIO_H */
diff --git a/arch/xtensa/include/asm/io.h b/arch/xtensa/include/asm/io.h
index 07b7299dab20..d04cd3a625fa 100644
--- a/arch/xtensa/include/asm/io.h
+++ b/arch/xtensa/include/asm/io.h
@@ -69,21 +69,28 @@ static inline void * phys_to_virt(unsigned long address)
69 69
70static inline void *ioremap(unsigned long offset, unsigned long size) 70static inline void *ioremap(unsigned long offset, unsigned long size)
71{ 71{
72#ifdef CONFIG_MMU
72 if (offset >= XCHAL_KIO_PADDR 73 if (offset >= XCHAL_KIO_PADDR
73 && offset < XCHAL_KIO_PADDR + XCHAL_KIO_SIZE) 74 && offset < XCHAL_KIO_PADDR + XCHAL_KIO_SIZE)
74 return (void*)(offset-XCHAL_KIO_PADDR+XCHAL_KIO_BYPASS_VADDR); 75 return (void*)(offset-XCHAL_KIO_PADDR+XCHAL_KIO_BYPASS_VADDR);
75
76 else 76 else
77 BUG(); 77 BUG();
78#else
79 return (void *)offset;
80#endif
78} 81}
79 82
80static inline void *ioremap_nocache(unsigned long offset, unsigned long size) 83static inline void *ioremap_nocache(unsigned long offset, unsigned long size)
81{ 84{
85#ifdef CONFIG_MMU
82 if (offset >= XCHAL_KIO_PADDR 86 if (offset >= XCHAL_KIO_PADDR
83 && offset < XCHAL_KIO_PADDR + XCHAL_KIO_SIZE) 87 && offset < XCHAL_KIO_PADDR + XCHAL_KIO_SIZE)
84 return (void*)(offset-XCHAL_KIO_PADDR+XCHAL_KIO_CACHED_VADDR); 88 return (void*)(offset-XCHAL_KIO_PADDR+XCHAL_KIO_CACHED_VADDR);
85 else 89 else
86 BUG(); 90 BUG();
91#else
92 return (void *)offset;
93#endif
87} 94}
88 95
89static inline void iounmap(void *addr) 96static inline void iounmap(void *addr)
diff --git a/arch/xtensa/include/asm/irq.h b/arch/xtensa/include/asm/irq.h
index 1620d1e0e695..dfac82dc52ad 100644
--- a/arch/xtensa/include/asm/irq.h
+++ b/arch/xtensa/include/asm/irq.h
@@ -14,6 +14,13 @@
14#include <platform/hardware.h> 14#include <platform/hardware.h>
15#include <variant/core.h> 15#include <variant/core.h>
16 16
17#ifdef CONFIG_VARIANT_IRQ_SWITCH
18#include <variant/irq.h>
19#else
20static inline void variant_irq_enable(unsigned int irq) { }
21static inline void variant_irq_disable(unsigned int irq) { }
22#endif
23
17#ifndef PLATFORM_NR_IRQS 24#ifndef PLATFORM_NR_IRQS
18# define PLATFORM_NR_IRQS 0 25# define PLATFORM_NR_IRQS 0
19#endif 26#endif
diff --git a/arch/xtensa/include/asm/mmu.h b/arch/xtensa/include/asm/mmu.h
index 44c5bb04c55c..04890d6e2335 100644
--- a/arch/xtensa/include/asm/mmu.h
+++ b/arch/xtensa/include/asm/mmu.h
@@ -11,7 +11,12 @@
11#ifndef _XTENSA_MMU_H 11#ifndef _XTENSA_MMU_H
12#define _XTENSA_MMU_H 12#define _XTENSA_MMU_H
13 13
14#ifndef CONFIG_MMU
15#include <asm/nommu.h>
16#else
17
14/* Default "unsigned long" context */ 18/* Default "unsigned long" context */
15typedef unsigned long mm_context_t; 19typedef unsigned long mm_context_t;
16 20
21#endif /* CONFIG_MMU */
17#endif /* _XTENSA_MMU_H */ 22#endif /* _XTENSA_MMU_H */
diff --git a/arch/xtensa/include/asm/mmu_context.h b/arch/xtensa/include/asm/mmu_context.h
index c0fd8e5b4513..dbd8731a876a 100644
--- a/arch/xtensa/include/asm/mmu_context.h
+++ b/arch/xtensa/include/asm/mmu_context.h
@@ -13,16 +13,20 @@
13#ifndef _XTENSA_MMU_CONTEXT_H 13#ifndef _XTENSA_MMU_CONTEXT_H
14#define _XTENSA_MMU_CONTEXT_H 14#define _XTENSA_MMU_CONTEXT_H
15 15
16#ifndef CONFIG_MMU
17#include <asm/nommu_context.h>
18#else
19
16#include <linux/stringify.h> 20#include <linux/stringify.h>
17#include <linux/sched.h> 21#include <linux/sched.h>
18 22
23#include <variant/core.h>
24
19#include <asm/pgtable.h> 25#include <asm/pgtable.h>
20#include <asm/cacheflush.h> 26#include <asm/cacheflush.h>
21#include <asm/tlbflush.h> 27#include <asm/tlbflush.h>
22#include <asm-generic/mm_hooks.h> 28#include <asm-generic/mm_hooks.h>
23 29
24#define XCHAL_MMU_ASID_BITS 8
25
26#if (XCHAL_HAVE_TLBS != 1) 30#if (XCHAL_HAVE_TLBS != 1)
27# error "Linux must have an MMU!" 31# error "Linux must have an MMU!"
28#endif 32#endif
@@ -133,4 +137,5 @@ static inline void enter_lazy_tlb(struct mm_struct *mm, struct task_struct *tsk)
133 137
134} 138}
135 139
140#endif /* CONFIG_MMU */
136#endif /* _XTENSA_MMU_CONTEXT_H */ 141#endif /* _XTENSA_MMU_CONTEXT_H */
diff --git a/arch/xtensa/include/asm/nommu.h b/arch/xtensa/include/asm/nommu.h
new file mode 100644
index 000000000000..dce2c438c5ba
--- /dev/null
+++ b/arch/xtensa/include/asm/nommu.h
@@ -0,0 +1,3 @@
1typedef struct {
2 unsigned long end_brk;
3} mm_context_t;
diff --git a/arch/xtensa/include/asm/nommu_context.h b/arch/xtensa/include/asm/nommu_context.h
new file mode 100644
index 000000000000..599e7a2e729d
--- /dev/null
+++ b/arch/xtensa/include/asm/nommu_context.h
@@ -0,0 +1,25 @@
1static inline void enter_lazy_tlb(struct mm_struct *mm, struct task_struct *tsk)
2{
3}
4
5static inline int init_new_context(struct task_struct *tsk, struct mm_struct *mm)
6{
7 return 0;
8}
9
10static inline void destroy_context(struct mm_struct *mm)
11{
12}
13
14static inline void activate_mm(struct mm_struct *prev, struct mm_struct *next)
15{
16}
17
18static inline void switch_mm(struct mm_struct *prev, struct mm_struct *next,
19 struct task_struct *tsk)
20{
21}
22
23static inline void deactivate_mm(struct task_struct *tsk, struct mm_struct *mm)
24{
25}
diff --git a/arch/xtensa/include/asm/page.h b/arch/xtensa/include/asm/page.h
index 11f7dc2dbec7..17e0c5383b10 100644
--- a/arch/xtensa/include/asm/page.h
+++ b/arch/xtensa/include/asm/page.h
@@ -14,6 +14,7 @@
14#include <asm/processor.h> 14#include <asm/processor.h>
15#include <asm/types.h> 15#include <asm/types.h>
16#include <asm/cache.h> 16#include <asm/cache.h>
17#include <platform/hardware.h>
17 18
18/* 19/*
19 * Fixed TLB translations in the processor. 20 * Fixed TLB translations in the processor.
@@ -32,8 +33,14 @@
32#define PAGE_SIZE (__XTENSA_UL_CONST(1) << PAGE_SHIFT) 33#define PAGE_SIZE (__XTENSA_UL_CONST(1) << PAGE_SHIFT)
33#define PAGE_MASK (~(PAGE_SIZE-1)) 34#define PAGE_MASK (~(PAGE_SIZE-1))
34 35
36#ifdef CONFIG_MMU
35#define PAGE_OFFSET XCHAL_KSEG_CACHED_VADDR 37#define PAGE_OFFSET XCHAL_KSEG_CACHED_VADDR
36#define MAX_MEM_PFN XCHAL_KSEG_SIZE 38#define MAX_MEM_PFN XCHAL_KSEG_SIZE
39#else
40#define PAGE_OFFSET 0
41#define MAX_MEM_PFN (PLATFORM_DEFAULT_MEM_START + PLATFORM_DEFAULT_MEM_SIZE)
42#endif
43
37#define PGTABLE_START 0x80000000 44#define PGTABLE_START 0x80000000
38 45
39/* 46/*
@@ -150,9 +157,11 @@ extern void copy_user_page(void*, void*, unsigned long, struct page*);
150 * addresses. 157 * addresses.
151 */ 158 */
152 159
160#define ARCH_PFN_OFFSET (PLATFORM_DEFAULT_MEM_START >> PAGE_SHIFT)
161
153#define __pa(x) ((unsigned long) (x) - PAGE_OFFSET) 162#define __pa(x) ((unsigned long) (x) - PAGE_OFFSET)
154#define __va(x) ((void *)((unsigned long) (x) + PAGE_OFFSET)) 163#define __va(x) ((void *)((unsigned long) (x) + PAGE_OFFSET))
155#define pfn_valid(pfn) ((unsigned long)pfn < max_mapnr) 164#define pfn_valid(pfn) ((pfn) >= ARCH_PFN_OFFSET && ((pfn) - ARCH_PFN_OFFSET) < max_mapnr)
156#ifdef CONFIG_DISCONTIGMEM 165#ifdef CONFIG_DISCONTIGMEM
157# error CONFIG_DISCONTIGMEM not supported 166# error CONFIG_DISCONTIGMEM not supported
158#endif 167#endif
@@ -162,8 +171,9 @@ extern void copy_user_page(void*, void*, unsigned long, struct page*);
162#define virt_addr_valid(kaddr) pfn_valid(__pa(kaddr) >> PAGE_SHIFT) 171#define virt_addr_valid(kaddr) pfn_valid(__pa(kaddr) >> PAGE_SHIFT)
163#define page_to_phys(page) (page_to_pfn(page) << PAGE_SHIFT) 172#define page_to_phys(page) (page_to_pfn(page) << PAGE_SHIFT)
164 173
174#ifdef CONFIG_MMU
165#define WANT_PAGE_VIRTUAL 175#define WANT_PAGE_VIRTUAL
166 176#endif
167 177
168#endif /* __ASSEMBLY__ */ 178#endif /* __ASSEMBLY__ */
169 179
diff --git a/arch/xtensa/include/asm/pgtable.h b/arch/xtensa/include/asm/pgtable.h
index 8014d96b21f1..a138770c358e 100644
--- a/arch/xtensa/include/asm/pgtable.h
+++ b/arch/xtensa/include/asm/pgtable.h
@@ -183,7 +183,15 @@ extern unsigned long empty_zero_page[1024];
183 183
184#define ZERO_PAGE(vaddr) (virt_to_page(empty_zero_page)) 184#define ZERO_PAGE(vaddr) (virt_to_page(empty_zero_page))
185 185
186#ifdef CONFIG_MMU
186extern pgd_t swapper_pg_dir[PAGE_SIZE/sizeof(pgd_t)]; 187extern pgd_t swapper_pg_dir[PAGE_SIZE/sizeof(pgd_t)];
188extern void paging_init(void);
189extern void pgtable_cache_init(void);
190#else
191# define swapper_pg_dir NULL
192static inline void paging_init(void) { }
193static inline void pgtable_cache_init(void) { }
194#endif
187 195
188/* 196/*
189 * The pmd contains the kernel virtual address of the pte page. 197 * The pmd contains the kernel virtual address of the pte page.
@@ -383,8 +391,6 @@ ptep_set_wrprotect(struct mm_struct *mm, unsigned long addr, pte_t *ptep)
383 391
384#else 392#else
385 393
386extern void paging_init(void);
387
388#define kern_addr_valid(addr) (1) 394#define kern_addr_valid(addr) (1)
389 395
390extern void update_mmu_cache(struct vm_area_struct * vma, 396extern void update_mmu_cache(struct vm_area_struct * vma,
@@ -398,9 +404,6 @@ extern void update_mmu_cache(struct vm_area_struct * vma,
398#define io_remap_pfn_range(vma,from,pfn,size,prot) \ 404#define io_remap_pfn_range(vma,from,pfn,size,prot) \
399 remap_pfn_range(vma, from, pfn, size, prot) 405 remap_pfn_range(vma, from, pfn, size, prot)
400 406
401
402extern void pgtable_cache_init(void);
403
404typedef pte_t *pte_addr_t; 407typedef pte_t *pte_addr_t;
405 408
406#endif /* !defined (__ASSEMBLY__) */ 409#endif /* !defined (__ASSEMBLY__) */
diff --git a/arch/xtensa/include/asm/platform.h b/arch/xtensa/include/asm/platform.h
index e3d5a48ad495..7d936e58e9be 100644
--- a/arch/xtensa/include/asm/platform.h
+++ b/arch/xtensa/include/asm/platform.h
@@ -74,16 +74,5 @@ extern int platform_pcibios_fixup (void);
74 */ 74 */
75extern void platform_calibrate_ccount (void); 75extern void platform_calibrate_ccount (void);
76 76
77/*
78 * platform_get_rtc_time returns RTC seconds (returns 0 for no error)
79 */
80extern int platform_get_rtc_time(time_t*);
81
82/*
83 * platform_set_rtc_time set RTC seconds (returns 0 for no error)
84 */
85extern int platform_set_rtc_time(time_t);
86
87
88#endif /* _XTENSA_PLATFORM_H */ 77#endif /* _XTENSA_PLATFORM_H */
89 78
diff --git a/arch/xtensa/include/asm/processor.h b/arch/xtensa/include/asm/processor.h
index 07387d3b99f4..0ea4937c0b61 100644
--- a/arch/xtensa/include/asm/processor.h
+++ b/arch/xtensa/include/asm/processor.h
@@ -13,6 +13,7 @@
13 13
14#include <variant/core.h> 14#include <variant/core.h>
15#include <asm/coprocessor.h> 15#include <asm/coprocessor.h>
16#include <platform/hardware.h>
16 17
17#include <linux/compiler.h> 18#include <linux/compiler.h>
18#include <asm/ptrace.h> 19#include <asm/ptrace.h>
@@ -25,6 +26,8 @@
25# error Linux requires the Xtensa Windowed Registers Option. 26# error Linux requires the Xtensa Windowed Registers Option.
26#endif 27#endif
27 28
29#define ARCH_SLAB_MINALIGN XCHAL_DATA_WIDTH
30
28/* 31/*
29 * User space process size: 1 GB. 32 * User space process size: 1 GB.
30 * Windowed call ABI requires caller and callee to be located within the same 33 * Windowed call ABI requires caller and callee to be located within the same
@@ -33,7 +36,12 @@
33 * the 1 GB requirement applies to the stack as well. 36 * the 1 GB requirement applies to the stack as well.
34 */ 37 */
35 38
39#ifdef CONFIG_MMU
36#define TASK_SIZE __XTENSA_UL_CONST(0x40000000) 40#define TASK_SIZE __XTENSA_UL_CONST(0x40000000)
41#else
42#define TASK_SIZE (PLATFORM_DEFAULT_MEM_START + PLATFORM_DEFAULT_MEM_SIZE)
43#endif
44
37#define STACK_TOP TASK_SIZE 45#define STACK_TOP TASK_SIZE
38#define STACK_TOP_MAX STACK_TOP 46#define STACK_TOP_MAX STACK_TOP
39 47
diff --git a/arch/xtensa/kernel/entry.S b/arch/xtensa/kernel/entry.S
index a51d36a27389..80d24c485fd3 100644
--- a/arch/xtensa/kernel/entry.S
+++ b/arch/xtensa/kernel/entry.S
@@ -1463,6 +1463,7 @@ ENTRY(_spill_registers)
1463 callx0 a0 # should not return 1463 callx0 a0 # should not return
14641: j 1b 14641: j 1b
1465 1465
1466#ifdef CONFIG_MMU
1466/* 1467/*
1467 * We should never get here. Bail out! 1468 * We should never get here. Bail out!
1468 */ 1469 */
@@ -1775,7 +1776,7 @@ ENTRY(fast_store_prohibited)
1775 bbsi.l a2, PS_UM_BIT, 1f 1776 bbsi.l a2, PS_UM_BIT, 1f
1776 j _kernel_exception 1777 j _kernel_exception
17771: j _user_exception 17781: j _user_exception
1778 1779#endif /* CONFIG_MMU */
1779 1780
1780/* 1781/*
1781 * System Calls. 1782 * System Calls.
diff --git a/arch/xtensa/kernel/head.S b/arch/xtensa/kernel/head.S
index 67e69139520b..0817f9db836e 100644
--- a/arch/xtensa/kernel/head.S
+++ b/arch/xtensa/kernel/head.S
@@ -53,7 +53,7 @@ _start: _j 2f
532: l32r a0, 1b 532: l32r a0, 1b
54 jx a0 54 jx a0
55 55
56 .text 56 .section .init.text, "ax"
57 .align 4 57 .align 4
58_startup: 58_startup:
59 59
@@ -235,8 +235,9 @@ should_never_return:
235 */ 235 */
236 236
237.section ".bss.page_aligned", "w" 237.section ".bss.page_aligned", "w"
238#ifdef CONFIG_MMU
238ENTRY(swapper_pg_dir) 239ENTRY(swapper_pg_dir)
239 .fill PAGE_SIZE, 1, 0 240 .fill PAGE_SIZE, 1, 0
241#endif
240ENTRY(empty_zero_page) 242ENTRY(empty_zero_page)
241 .fill PAGE_SIZE, 1, 0 243 .fill PAGE_SIZE, 1, 0
242
diff --git a/arch/xtensa/kernel/irq.c b/arch/xtensa/kernel/irq.c
index f3b66fba5b8f..a36c85edd045 100644
--- a/arch/xtensa/kernel/irq.c
+++ b/arch/xtensa/kernel/irq.c
@@ -132,6 +132,18 @@ static void xtensa_irq_unmask(unsigned int irq)
132 set_sr (cached_irq_mask, INTENABLE); 132 set_sr (cached_irq_mask, INTENABLE);
133} 133}
134 134
135static void xtensa_irq_enable(unsigned int irq)
136{
137 variant_irq_enable(irq);
138 xtensa_irq_unmask(irq);
139}
140
141static void xtensa_irq_disable(unsigned int irq)
142{
143 xtensa_irq_mask(irq);
144 variant_irq_disable(irq);
145}
146
135static void xtensa_irq_ack(unsigned int irq) 147static void xtensa_irq_ack(unsigned int irq)
136{ 148{
137 set_sr(1 << irq, INTCLEAR); 149 set_sr(1 << irq, INTCLEAR);
@@ -146,6 +158,8 @@ static int xtensa_irq_retrigger(unsigned int irq)
146 158
147static struct irq_chip xtensa_irq_chip = { 159static struct irq_chip xtensa_irq_chip = {
148 .name = "xtensa", 160 .name = "xtensa",
161 .enable = xtensa_irq_enable,
162 .disable = xtensa_irq_disable,
149 .mask = xtensa_irq_mask, 163 .mask = xtensa_irq_mask,
150 .unmask = xtensa_irq_unmask, 164 .unmask = xtensa_irq_unmask,
151 .ack = xtensa_irq_ack, 165 .ack = xtensa_irq_ack,
diff --git a/arch/xtensa/kernel/platform.c b/arch/xtensa/kernel/platform.c
index 69675f216062..1b91a97f1d84 100644
--- a/arch/xtensa/kernel/platform.c
+++ b/arch/xtensa/kernel/platform.c
@@ -36,8 +36,6 @@ _F(void, power_off, (void), { while(1); });
36_F(void, idle, (void), { __asm__ __volatile__ ("waiti 0" ::: "memory"); }); 36_F(void, idle, (void), { __asm__ __volatile__ ("waiti 0" ::: "memory"); });
37_F(void, heartbeat, (void), { }); 37_F(void, heartbeat, (void), { });
38_F(int, pcibios_fixup, (void), { return 0; }); 38_F(int, pcibios_fixup, (void), { return 0; });
39_F(int, get_rtc_time, (time_t* t), { return 0; });
40_F(int, set_rtc_time, (time_t t), { return 0; });
41 39
42#ifdef CONFIG_XTENSA_CALIBRATE_CCOUNT 40#ifdef CONFIG_XTENSA_CALIBRATE_CCOUNT
43_F(void, calibrate_ccount, (void), 41_F(void, calibrate_ccount, (void),
diff --git a/arch/xtensa/kernel/process.c b/arch/xtensa/kernel/process.c
index 9185597eb6a0..031f36685710 100644
--- a/arch/xtensa/kernel/process.c
+++ b/arch/xtensa/kernel/process.c
@@ -172,7 +172,7 @@ void prepare_to_copy(struct task_struct *tsk)
172 * childregs. 172 * childregs.
173 */ 173 */
174 174
175int copy_thread(int nr, unsigned long clone_flags, unsigned long usp, 175int copy_thread(unsigned long clone_flags, unsigned long usp,
176 unsigned long unused, 176 unsigned long unused,
177 struct task_struct * p, struct pt_regs * regs) 177 struct task_struct * p, struct pt_regs * regs)
178{ 178{
diff --git a/arch/xtensa/kernel/setup.c b/arch/xtensa/kernel/setup.c
index 4ec1633c2941..1e5a034fe011 100644
--- a/arch/xtensa/kernel/setup.c
+++ b/arch/xtensa/kernel/setup.c
@@ -84,7 +84,13 @@ sysmem_info_t __initdata sysmem;
84int initrd_is_mapped; 84int initrd_is_mapped;
85#endif 85#endif
86 86
87#ifdef CONFIG_MMU
87extern void init_mmu(void); 88extern void init_mmu(void);
89#else
90static inline void init_mmu(void) { }
91#endif
92
93extern void zones_init(void);
88 94
89/* 95/*
90 * Boot parameter parsing. 96 * Boot parameter parsing.
@@ -286,6 +292,7 @@ void __init setup_arch(char **cmdline_p)
286 292
287 293
288 paging_init(); 294 paging_init();
295 zones_init();
289 296
290#ifdef CONFIG_VT 297#ifdef CONFIG_VT
291# if defined(CONFIG_VGA_CONSOLE) 298# if defined(CONFIG_VGA_CONSOLE)
diff --git a/arch/xtensa/kernel/time.c b/arch/xtensa/kernel/time.c
index 8df1e842f6d4..8848120d291b 100644
--- a/arch/xtensa/kernel/time.c
+++ b/arch/xtensa/kernel/time.c
@@ -14,7 +14,7 @@
14 14
15#include <linux/errno.h> 15#include <linux/errno.h>
16#include <linux/time.h> 16#include <linux/time.h>
17#include <linux/timex.h> 17#include <linux/clocksource.h>
18#include <linux/interrupt.h> 18#include <linux/interrupt.h>
19#include <linux/module.h> 19#include <linux/module.h>
20#include <linux/init.h> 20#include <linux/init.h>
@@ -25,27 +25,31 @@
25#include <asm/timex.h> 25#include <asm/timex.h>
26#include <asm/platform.h> 26#include <asm/platform.h>
27 27
28
29DEFINE_SPINLOCK(rtc_lock);
30EXPORT_SYMBOL(rtc_lock);
31
32
33#ifdef CONFIG_XTENSA_CALIBRATE_CCOUNT 28#ifdef CONFIG_XTENSA_CALIBRATE_CCOUNT
34unsigned long ccount_per_jiffy; /* per 1/HZ */ 29unsigned long ccount_per_jiffy; /* per 1/HZ */
35unsigned long nsec_per_ccount; /* nsec per ccount increment */ 30unsigned long nsec_per_ccount; /* nsec per ccount increment */
36#endif 31#endif
37 32
38static long last_rtc_update = 0; 33static cycle_t ccount_read(void)
39
40/*
41 * Scheduler clock - returns current tim in nanosec units.
42 */
43
44unsigned long long sched_clock(void)
45{ 34{
46 return (unsigned long long)jiffies * (1000000000 / HZ); 35 return (cycle_t)get_ccount();
47} 36}
48 37
38static struct clocksource ccount_clocksource = {
39 .name = "ccount",
40 .rating = 200,
41 .read = ccount_read,
42 .mask = CLOCKSOURCE_MASK(32),
43 /*
44 * With a shift of 22 the lower limit of the cpu clock is
45 * 1MHz, where NSEC_PER_CCOUNT is 1000 or a bit less than
46 * 2^10: Since we have 32 bits and the multiplicator can
47 * already take up as much as 10 bits, this leaves us with
48 * remaining upper 22 bits.
49 */
50 .shift = 22,
51};
52
49static irqreturn_t timer_interrupt(int irq, void *dev_id); 53static irqreturn_t timer_interrupt(int irq, void *dev_id);
50static struct irqaction timer_irqaction = { 54static struct irqaction timer_irqaction = {
51 .handler = timer_interrupt, 55 .handler = timer_interrupt,
@@ -55,11 +59,11 @@ static struct irqaction timer_irqaction = {
55 59
56void __init time_init(void) 60void __init time_init(void)
57{ 61{
58 time_t sec_o, sec_n = 0; 62 xtime.tv_nsec = 0;
63 xtime.tv_sec = read_persistent_clock();
59 64
60 /* The platform must provide a function to calibrate the processor 65 set_normalized_timespec(&wall_to_monotonic,
61 * speed for the CALIBRATE. 66 -xtime.tv_sec, -xtime.tv_nsec);
62 */
63 67
64#ifdef CONFIG_XTENSA_CALIBRATE_CCOUNT 68#ifdef CONFIG_XTENSA_CALIBRATE_CCOUNT
65 printk("Calibrating CPU frequency "); 69 printk("Calibrating CPU frequency ");
@@ -67,19 +71,10 @@ void __init time_init(void)
67 printk("%d.%02d MHz\n", (int)ccount_per_jiffy/(1000000/HZ), 71 printk("%d.%02d MHz\n", (int)ccount_per_jiffy/(1000000/HZ),
68 (int)(ccount_per_jiffy/(10000/HZ))%100); 72 (int)(ccount_per_jiffy/(10000/HZ))%100);
69#endif 73#endif
70 74 ccount_clocksource.mult =
71 /* Set time from RTC (if provided) */ 75 clocksource_hz2mult(CCOUNT_PER_JIFFY * HZ,
72 76 ccount_clocksource.shift);
73 if (platform_get_rtc_time(&sec_o) == 0) 77 clocksource_register(&ccount_clocksource);
74 while (platform_get_rtc_time(&sec_n))
75 if (sec_o != sec_n)
76 break;
77
78 xtime.tv_nsec = 0;
79 last_rtc_update = xtime.tv_sec = sec_n;
80
81 set_normalized_timespec(&wall_to_monotonic,
82 -xtime.tv_sec, -xtime.tv_nsec);
83 78
84 /* Initialize the linux timer interrupt. */ 79 /* Initialize the linux timer interrupt. */
85 80
@@ -87,69 +82,6 @@ void __init time_init(void)
87 set_linux_timer(get_ccount() + CCOUNT_PER_JIFFY); 82 set_linux_timer(get_ccount() + CCOUNT_PER_JIFFY);
88} 83}
89 84
90
91int do_settimeofday(struct timespec *tv)
92{
93 time_t wtm_sec, sec = tv->tv_sec;
94 long wtm_nsec, nsec = tv->tv_nsec;
95 unsigned long delta;
96
97 if ((unsigned long)tv->tv_nsec >= NSEC_PER_SEC)
98 return -EINVAL;
99
100 write_seqlock_irq(&xtime_lock);
101
102 /* This is revolting. We need to set "xtime" correctly. However, the
103 * value in this location is the value at the most recent update of
104 * wall time. Discover what correction gettimeofday() would have
105 * made, and then undo it!
106 */
107
108 delta = CCOUNT_PER_JIFFY;
109 delta += get_ccount() - get_linux_timer();
110 nsec -= delta * NSEC_PER_CCOUNT;
111
112 wtm_sec = wall_to_monotonic.tv_sec + (xtime.tv_sec - sec);
113 wtm_nsec = wall_to_monotonic.tv_nsec + (xtime.tv_nsec - nsec);
114
115 set_normalized_timespec(&xtime, sec, nsec);
116 set_normalized_timespec(&wall_to_monotonic, wtm_sec, wtm_nsec);
117
118 ntp_clear();
119 write_sequnlock_irq(&xtime_lock);
120 return 0;
121}
122
123EXPORT_SYMBOL(do_settimeofday);
124
125
126void do_gettimeofday(struct timeval *tv)
127{
128 unsigned long flags;
129 unsigned long volatile sec, usec, delta, seq;
130
131 do {
132 seq = read_seqbegin_irqsave(&xtime_lock, flags);
133
134 sec = xtime.tv_sec;
135 usec = (xtime.tv_nsec / NSEC_PER_USEC);
136
137 delta = get_linux_timer() - get_ccount();
138
139 } while (read_seqretry_irqrestore(&xtime_lock, seq, flags));
140
141 usec += (((unsigned long) CCOUNT_PER_JIFFY - delta)
142 * (unsigned long) NSEC_PER_CCOUNT) / NSEC_PER_USEC;
143
144 for (; usec >= 1000000; sec++, usec -= 1000000)
145 ;
146
147 tv->tv_sec = sec;
148 tv->tv_usec = usec;
149}
150
151EXPORT_SYMBOL(do_gettimeofday);
152
153/* 85/*
154 * The timer interrupt is called HZ times per second. 86 * The timer interrupt is called HZ times per second.
155 */ 87 */
@@ -178,16 +110,6 @@ again:
178 next += CCOUNT_PER_JIFFY; 110 next += CCOUNT_PER_JIFFY;
179 set_linux_timer(next); 111 set_linux_timer(next);
180 112
181 if (ntp_synced() &&
182 xtime.tv_sec - last_rtc_update >= 659 &&
183 abs((xtime.tv_nsec/1000)-(1000000-1000000/HZ))<5000000/HZ) {
184
185 if (platform_set_rtc_time(xtime.tv_sec+1) == 0)
186 last_rtc_update = xtime.tv_sec+1;
187 else
188 /* Do it again in 60 s */
189 last_rtc_update += 60;
190 }
191 write_sequnlock(&xtime_lock); 113 write_sequnlock(&xtime_lock);
192 } 114 }
193 115
@@ -213,4 +135,3 @@ void __cpuinit calibrate_delay(void)
213 (loops_per_jiffy/(10000/HZ)) % 100); 135 (loops_per_jiffy/(10000/HZ)) % 100);
214} 136}
215#endif 137#endif
216
diff --git a/arch/xtensa/kernel/traps.c b/arch/xtensa/kernel/traps.c
index c44f830b6c7a..9f0b71189e94 100644
--- a/arch/xtensa/kernel/traps.c
+++ b/arch/xtensa/kernel/traps.c
@@ -104,6 +104,7 @@ static dispatch_init_table_t __initdata dispatch_init_table[] = {
104#endif 104#endif
105{ EXCCAUSE_UNALIGNED, KRNL, fast_unaligned }, 105{ EXCCAUSE_UNALIGNED, KRNL, fast_unaligned },
106#endif 106#endif
107#ifdef CONFIG_MMU
107{ EXCCAUSE_ITLB_MISS, 0, do_page_fault }, 108{ EXCCAUSE_ITLB_MISS, 0, do_page_fault },
108{ EXCCAUSE_ITLB_MISS, USER|KRNL, fast_second_level_miss}, 109{ EXCCAUSE_ITLB_MISS, USER|KRNL, fast_second_level_miss},
109{ EXCCAUSE_ITLB_MULTIHIT, 0, do_multihit }, 110{ EXCCAUSE_ITLB_MULTIHIT, 0, do_multihit },
@@ -118,6 +119,7 @@ static dispatch_init_table_t __initdata dispatch_init_table[] = {
118{ EXCCAUSE_STORE_CACHE_ATTRIBUTE, USER|KRNL, fast_store_prohibited }, 119{ EXCCAUSE_STORE_CACHE_ATTRIBUTE, USER|KRNL, fast_store_prohibited },
119{ EXCCAUSE_STORE_CACHE_ATTRIBUTE, 0, do_page_fault }, 120{ EXCCAUSE_STORE_CACHE_ATTRIBUTE, 0, do_page_fault },
120{ EXCCAUSE_LOAD_CACHE_ATTRIBUTE, 0, do_page_fault }, 121{ EXCCAUSE_LOAD_CACHE_ATTRIBUTE, 0, do_page_fault },
122#endif /* CONFIG_MMU */
121/* XCCHAL_EXCCAUSE_FLOATING_POINT unhandled */ 123/* XCCHAL_EXCCAUSE_FLOATING_POINT unhandled */
122#if XTENSA_HAVE_COPROCESSOR(0) 124#if XTENSA_HAVE_COPROCESSOR(0)
123COPROCESSOR(0), 125COPROCESSOR(0),
@@ -372,11 +374,10 @@ void show_trace(struct task_struct *task, unsigned long *sp)
372 unsigned long a0, a1, pc; 374 unsigned long a0, a1, pc;
373 unsigned long sp_start, sp_end; 375 unsigned long sp_start, sp_end;
374 376
375 a1 = (unsigned long)sp; 377 if (sp)
376 378 a1 = (unsigned long)sp;
377 if (a1 == 0) 379 else
378 __asm__ __volatile__ ("mov %0, a1\n" : "=a"(a1)); 380 a1 = task->thread.sp;
379
380 381
381 sp_start = a1 & ~(THREAD_SIZE-1); 382 sp_start = a1 & ~(THREAD_SIZE-1);
382 sp_end = sp_start + THREAD_SIZE; 383 sp_end = sp_start + THREAD_SIZE;
@@ -418,9 +419,8 @@ void show_stack(struct task_struct *task, unsigned long *sp)
418 int i = 0; 419 int i = 0;
419 unsigned long *stack; 420 unsigned long *stack;
420 421
421 if (sp == 0) 422 if (!sp)
422 __asm__ __volatile__ ("mov %0, a1\n" : "=a"(sp)); 423 sp = (unsigned long *)task->thread.sp;
423
424 stack = sp; 424 stack = sp;
425 425
426 printk("\nStack: "); 426 printk("\nStack: ");
diff --git a/arch/xtensa/kernel/vectors.S b/arch/xtensa/kernel/vectors.S
index eb2d7bb69ee0..74a7518faf16 100644
--- a/arch/xtensa/kernel/vectors.S
+++ b/arch/xtensa/kernel/vectors.S
@@ -309,6 +309,7 @@ ENTRY(_DoubleExceptionVector)
309 * All other exceptions are unexpected and thus unrecoverable! 309 * All other exceptions are unexpected and thus unrecoverable!
310 */ 310 */
311 311
312#ifdef CONFIG_MMU
312 .extern fast_second_level_miss_double_kernel 313 .extern fast_second_level_miss_double_kernel
313 314
314.Lksp: /* a0: a0, a1: a1, a2: a2, a3: trashed, depc: depc, excsave: a3 */ 315.Lksp: /* a0: a0, a1: a1, a2: a2, a3: trashed, depc: depc, excsave: a3 */
@@ -319,6 +320,9 @@ ENTRY(_DoubleExceptionVector)
319 bnez a3, .Lunrecoverable 320 bnez a3, .Lunrecoverable
3201: movi a3, fast_second_level_miss_double_kernel 3211: movi a3, fast_second_level_miss_double_kernel
321 jx a3 322 jx a3
323#else
324.equ .Lksp, .Lunrecoverable
325#endif
322 326
323 /* Critical! We can't handle this situation. PANIC! */ 327 /* Critical! We can't handle this situation. PANIC! */
324 328
diff --git a/arch/xtensa/kernel/vmlinux.lds.S b/arch/xtensa/kernel/vmlinux.lds.S
index d506774f4b05..c1be9a4a740c 100644
--- a/arch/xtensa/kernel/vmlinux.lds.S
+++ b/arch/xtensa/kernel/vmlinux.lds.S
@@ -17,6 +17,7 @@
17#include <asm-generic/vmlinux.lds.h> 17#include <asm-generic/vmlinux.lds.h>
18 18
19#include <variant/core.h> 19#include <variant/core.h>
20#include <platform/hardware.h>
20OUTPUT_ARCH(xtensa) 21OUTPUT_ARCH(xtensa)
21ENTRY(_start) 22ENTRY(_start)
22 23
@@ -26,7 +27,9 @@ jiffies = jiffies_64 + 4;
26jiffies = jiffies_64; 27jiffies = jiffies_64;
27#endif 28#endif
28 29
30#ifndef KERNELOFFSET
29#define KERNELOFFSET 0xd0001000 31#define KERNELOFFSET 0xd0001000
32#endif
30 33
31/* Note: In the following macros, it would be nice to specify only the 34/* Note: In the following macros, it would be nice to specify only the
32 vector name and section kind and construct "sym" and "section" using 35 vector name and section kind and construct "sym" and "section" using
diff --git a/arch/xtensa/mm/Makefile b/arch/xtensa/mm/Makefile
index 64e304a2f884..f0b646d2f843 100644
--- a/arch/xtensa/mm/Makefile
+++ b/arch/xtensa/mm/Makefile
@@ -2,4 +2,5 @@
2# Makefile for the Linux/Xtensa-specific parts of the memory manager. 2# Makefile for the Linux/Xtensa-specific parts of the memory manager.
3# 3#
4 4
5obj-y := init.o fault.o tlb.o misc.o cache.o 5obj-y := init.o cache.o misc.o
6obj-$(CONFIG_MMU) += fault.o mmu.o tlb.o
diff --git a/arch/xtensa/mm/init.c b/arch/xtensa/mm/init.c
index 34163cfaaffc..427e14fa43c5 100644
--- a/arch/xtensa/mm/init.c
+++ b/arch/xtensa/mm/init.c
@@ -24,15 +24,8 @@
24#include <linux/mm.h> 24#include <linux/mm.h>
25#include <linux/slab.h> 25#include <linux/slab.h>
26 26
27#include <asm/pgtable.h>
28#include <asm/bootparam.h> 27#include <asm/bootparam.h>
29#include <asm/mmu_context.h>
30#include <asm/tlb.h>
31#include <asm/page.h> 28#include <asm/page.h>
32#include <asm/pgalloc.h>
33
34
35DEFINE_PER_CPU(struct mmu_gather, mmu_gathers);
36 29
37/* References to section boundaries */ 30/* References to section boundaries */
38 31
@@ -130,7 +123,8 @@ void __init bootmem_init(void)
130 123
131 /* Find an area to use for the bootmem bitmap. */ 124 /* Find an area to use for the bootmem bitmap. */
132 125
133 bootmap_size = bootmem_bootmap_pages(max_low_pfn) << PAGE_SHIFT; 126 bootmap_size = bootmem_bootmap_pages(max_low_pfn - min_low_pfn);
127 bootmap_size <<= PAGE_SHIFT;
134 bootmap_start = ~0; 128 bootmap_start = ~0;
135 129
136 for (i=0; i<sysmem.nr_banks; i++) 130 for (i=0; i<sysmem.nr_banks; i++)
@@ -145,8 +139,9 @@ void __init bootmem_init(void)
145 /* Reserve the bootmem bitmap area */ 139 /* Reserve the bootmem bitmap area */
146 140
147 mem_reserve(bootmap_start, bootmap_start + bootmap_size, 1); 141 mem_reserve(bootmap_start, bootmap_start + bootmap_size, 1);
148 bootmap_size = init_bootmem_node(NODE_DATA(0), min_low_pfn, 142 bootmap_size = init_bootmem_node(NODE_DATA(0),
149 bootmap_start >> PAGE_SHIFT, 143 bootmap_start >> PAGE_SHIFT,
144 min_low_pfn,
150 max_low_pfn); 145 max_low_pfn);
151 146
152 /* Add all remaining memory pieces into the bootmem map */ 147 /* Add all remaining memory pieces into the bootmem map */
@@ -158,14 +153,14 @@ void __init bootmem_init(void)
158} 153}
159 154
160 155
161void __init paging_init(void) 156void __init zones_init(void)
162{ 157{
163 unsigned long zones_size[MAX_NR_ZONES]; 158 unsigned long zones_size[MAX_NR_ZONES];
164 int i; 159 int i;
165 160
166 /* All pages are DMA-able, so we put them all in the DMA zone. */ 161 /* All pages are DMA-able, so we put them all in the DMA zone. */
167 162
168 zones_size[ZONE_DMA] = max_low_pfn; 163 zones_size[ZONE_DMA] = max_low_pfn - ARCH_PFN_OFFSET;
169 for (i = 1; i < MAX_NR_ZONES; i++) 164 for (i = 1; i < MAX_NR_ZONES; i++)
170 zones_size[i] = 0; 165 zones_size[i] = 0;
171 166
@@ -173,40 +168,7 @@ void __init paging_init(void)
173 zones_size[ZONE_HIGHMEM] = max_pfn - max_low_pfn; 168 zones_size[ZONE_HIGHMEM] = max_pfn - max_low_pfn;
174#endif 169#endif
175 170
176 /* Initialize the kernel's page tables. */ 171 free_area_init_node(0, zones_size, ARCH_PFN_OFFSET, NULL);
177
178 memset(swapper_pg_dir, 0, PAGE_SIZE);
179
180 free_area_init(zones_size);
181}
182
183/*
184 * Flush the mmu and reset associated register to default values.
185 */
186
187void __init init_mmu (void)
188{
189 /* Writing zeros to the <t>TLBCFG special registers ensure
190 * that valid values exist in the register. For existing
191 * PGSZID<w> fields, zero selects the first element of the
192 * page-size array. For nonexistent PGSZID<w> fields, zero is
193 * the best value to write. Also, when changing PGSZID<w>
194 * fields, the corresponding TLB must be flushed.
195 */
196 set_itlbcfg_register (0);
197 set_dtlbcfg_register (0);
198 flush_tlb_all ();
199
200 /* Set rasid register to a known value. */
201
202 set_rasid_register (ASID_USER_FIRST);
203
204 /* Set PTEVADDR special register to the start of the page
205 * table, which is in kernel mappable space (ie. not
206 * statically mapped). This register's value is undefined on
207 * reset.
208 */
209 set_ptevaddr_register (PGTABLE_START);
210} 172}
211 173
212/* 174/*
@@ -218,8 +180,8 @@ void __init mem_init(void)
218 unsigned long codesize, reservedpages, datasize, initsize; 180 unsigned long codesize, reservedpages, datasize, initsize;
219 unsigned long highmemsize, tmp, ram; 181 unsigned long highmemsize, tmp, ram;
220 182
221 max_mapnr = num_physpages = max_low_pfn; 183 max_mapnr = num_physpages = max_low_pfn - ARCH_PFN_OFFSET;
222 high_memory = (void *) __va(max_mapnr << PAGE_SHIFT); 184 high_memory = (void *) __va(max_low_pfn << PAGE_SHIFT);
223 highmemsize = 0; 185 highmemsize = 0;
224 186
225#ifdef CONFIG_HIGHMEM 187#ifdef CONFIG_HIGHMEM
@@ -229,7 +191,7 @@ void __init mem_init(void)
229 totalram_pages += free_all_bootmem(); 191 totalram_pages += free_all_bootmem();
230 192
231 reservedpages = ram = 0; 193 reservedpages = ram = 0;
232 for (tmp = 0; tmp < max_low_pfn; tmp++) { 194 for (tmp = 0; tmp < max_mapnr; tmp++) {
233 ram++; 195 ram++;
234 if (PageReserved(mem_map+tmp)) 196 if (PageReserved(mem_map+tmp))
235 reservedpages++; 197 reservedpages++;
@@ -279,23 +241,3 @@ void free_initmem(void)
279 printk("Freeing unused kernel memory: %dk freed\n", 241 printk("Freeing unused kernel memory: %dk freed\n",
280 (&__init_end - &__init_begin) >> 10); 242 (&__init_end - &__init_begin) >> 10);
281} 243}
282
283struct kmem_cache *pgtable_cache __read_mostly;
284
285static void pgd_ctor(void* addr)
286{
287 pte_t* ptep = (pte_t*)addr;
288 int i;
289
290 for (i = 0; i < 1024; i++, ptep++)
291 pte_clear(NULL, 0, ptep);
292
293}
294
295void __init pgtable_cache_init(void)
296{
297 pgtable_cache = kmem_cache_create("pgd",
298 PAGE_SIZE, PAGE_SIZE,
299 SLAB_HWCACHE_ALIGN,
300 pgd_ctor);
301}
diff --git a/arch/xtensa/mm/misc.S b/arch/xtensa/mm/misc.S
index c885664211d1..b048406d8756 100644
--- a/arch/xtensa/mm/misc.S
+++ b/arch/xtensa/mm/misc.S
@@ -84,6 +84,7 @@ ENTRY(copy_page)
84 84
85 retw 85 retw
86 86
87#ifdef CONFIG_MMU
87/* 88/*
88 * If we have to deal with cache aliasing, we use temporary memory mappings 89 * If we have to deal with cache aliasing, we use temporary memory mappings
89 * to ensure that the source and destination pages have the same color as 90 * to ensure that the source and destination pages have the same color as
@@ -311,6 +312,7 @@ ENTRY(__invalidate_icache_page_alias)
311/* End of special treatment in tlb miss exception */ 312/* End of special treatment in tlb miss exception */
312 313
313ENTRY(__tlbtemp_mapping_end) 314ENTRY(__tlbtemp_mapping_end)
315#endif /* CONFIG_MMU
314 316
315/* 317/*
316 * void __invalidate_icache_page(ulong start) 318 * void __invalidate_icache_page(ulong start)
diff --git a/arch/xtensa/mm/mmu.c b/arch/xtensa/mm/mmu.c
new file mode 100644
index 000000000000..4bb91a970f1f
--- /dev/null
+++ b/arch/xtensa/mm/mmu.c
@@ -0,0 +1,70 @@
1/*
2 * xtensa mmu stuff
3 *
4 * Extracted from init.c
5 */
6#include <linux/percpu.h>
7#include <linux/init.h>
8#include <linux/string.h>
9#include <linux/slab.h>
10#include <linux/cache.h>
11
12#include <asm/tlb.h>
13#include <asm/tlbflush.h>
14#include <asm/mmu_context.h>
15#include <asm/page.h>
16
17DEFINE_PER_CPU(struct mmu_gather, mmu_gathers);
18
19void __init paging_init(void)
20{
21 memset(swapper_pg_dir, 0, PAGE_SIZE);
22}
23
24/*
25 * Flush the mmu and reset associated register to default values.
26 */
27void __init init_mmu(void)
28{
29 /* Writing zeros to the <t>TLBCFG special registers ensure
30 * that valid values exist in the register. For existing
31 * PGSZID<w> fields, zero selects the first element of the
32 * page-size array. For nonexistent PGSZID<w> fields, zero is
33 * the best value to write. Also, when changing PGSZID<w>
34 * fields, the corresponding TLB must be flushed.
35 */
36 set_itlbcfg_register(0);
37 set_dtlbcfg_register(0);
38 flush_tlb_all();
39
40 /* Set rasid register to a known value. */
41
42 set_rasid_register(ASID_USER_FIRST);
43
44 /* Set PTEVADDR special register to the start of the page
45 * table, which is in kernel mappable space (ie. not
46 * statically mapped). This register's value is undefined on
47 * reset.
48 */
49 set_ptevaddr_register(PGTABLE_START);
50}
51
52struct kmem_cache *pgtable_cache __read_mostly;
53
54static void pgd_ctor(void *addr)
55{
56 pte_t *ptep = (pte_t *)addr;
57 int i;
58
59 for (i = 0; i < 1024; i++, ptep++)
60 pte_clear(NULL, 0, ptep);
61
62}
63
64void __init pgtable_cache_init(void)
65{
66 pgtable_cache = kmem_cache_create("pgd",
67 PAGE_SIZE, PAGE_SIZE,
68 SLAB_HWCACHE_ALIGN,
69 pgd_ctor);
70}
diff --git a/arch/xtensa/platforms/s6105/Makefile b/arch/xtensa/platforms/s6105/Makefile
new file mode 100644
index 000000000000..0be6194bcb72
--- /dev/null
+++ b/arch/xtensa/platforms/s6105/Makefile
@@ -0,0 +1,3 @@
1# Makefile for the Stretch S6105 eval board
2
3obj-y := setup.o device.o
diff --git a/arch/xtensa/platforms/s6105/device.c b/arch/xtensa/platforms/s6105/device.c
new file mode 100644
index 000000000000..78b08be5a92d
--- /dev/null
+++ b/arch/xtensa/platforms/s6105/device.c
@@ -0,0 +1,67 @@
1/*
2 * s6105 platform devices
3 *
4 * Copyright (c) 2009 emlix GmbH
5 */
6
7#include <linux/kernel.h>
8#include <linux/init.h>
9#include <linux/platform_device.h>
10#include <linux/serial.h>
11#include <linux/serial_8250.h>
12
13#include <variant/hardware.h>
14
15#define UART_INTNUM 4
16
17static const signed char uart_irq_mappings[] = {
18 S6_INTC_UART(0),
19 S6_INTC_UART(1),
20 -1,
21};
22
23const signed char *platform_irq_mappings[NR_IRQS] = {
24 [UART_INTNUM] = uart_irq_mappings,
25};
26
27static struct plat_serial8250_port serial_platform_data[] = {
28 {
29 .membase = (void *)S6_REG_UART + 0x0000,
30 .mapbase = S6_REG_UART + 0x0000,
31 .irq = UART_INTNUM,
32 .uartclk = S6_SCLK,
33 .regshift = 2,
34 .iotype = SERIAL_IO_MEM,
35 .flags = ASYNC_BOOT_AUTOCONF | ASYNC_SKIP_TEST,
36 },
37 {
38 .membase = (void *)S6_REG_UART + 0x1000,
39 .mapbase = S6_REG_UART + 0x1000,
40 .irq = UART_INTNUM,
41 .uartclk = S6_SCLK,
42 .regshift = 2,
43 .iotype = SERIAL_IO_MEM,
44 .flags = ASYNC_BOOT_AUTOCONF | ASYNC_SKIP_TEST,
45 },
46 { },
47};
48
49static struct platform_device platform_devices[] = {
50 {
51 .name = "serial8250",
52 .id = PLAT8250_DEV_PLATFORM,
53 .dev = {
54 .platform_data = serial_platform_data,
55 },
56 },
57};
58
59static int __init device_init(void)
60{
61 int i;
62
63 for (i = 0; i < ARRAY_SIZE(platform_devices); i++)
64 platform_device_register(&platform_devices[i]);
65 return 0;
66}
67arch_initcall_sync(device_init);
diff --git a/arch/xtensa/platforms/s6105/include/platform/gpio.h b/arch/xtensa/platforms/s6105/include/platform/gpio.h
new file mode 100644
index 000000000000..fa11aa4b61e9
--- /dev/null
+++ b/arch/xtensa/platforms/s6105/include/platform/gpio.h
@@ -0,0 +1,27 @@
1#ifndef __ASM_XTENSA_S6105_GPIO_H
2#define __ASM_XTENSA_S6105_GPIO_H
3
4#define GPIO_BP_TEMP_ALARM 0
5#define GPIO_PB_RESET_IN 1
6#define GPIO_EXP_IRQ 2
7#define GPIO_TRIGGER_IRQ 3
8#define GPIO_RTC_IRQ 4
9#define GPIO_PHY_IRQ 5
10#define GPIO_IMAGER_RESET 6
11#define GPIO_SD_IRQ 7
12#define GPIO_MINI_BOOT_INH 8
13#define GPIO_BOARD_RESET 9
14#define GPIO_EXP_PRESENT 10
15#define GPIO_LED1_NGREEN 12
16#define GPIO_LED1_RED 13
17#define GPIO_LED0_NGREEN 14
18#define GPIO_LED0_NRED 15
19#define GPIO_SPI_CS0 16
20#define GPIO_SPI_CS1 17
21#define GPIO_SPI_CS3 19
22#define GPIO_SPI_CS4 20
23#define GPIO_SD_WP 21
24#define GPIO_BP_RESET 22
25#define GPIO_ALARM_OUT 23
26
27#endif /* __ASM_XTENSA_S6105_GPIO_H */
diff --git a/arch/xtensa/platforms/s6105/include/platform/hardware.h b/arch/xtensa/platforms/s6105/include/platform/hardware.h
new file mode 100644
index 000000000000..d628efac7089
--- /dev/null
+++ b/arch/xtensa/platforms/s6105/include/platform/hardware.h
@@ -0,0 +1,11 @@
1#ifndef __XTENSA_S6105_HARDWARE_H
2#define __XTENSA_S6105_HARDWARE_H
3
4#define PLATFORM_DEFAULT_MEM_START 0x40000000
5#define PLATFORM_DEFAULT_MEM_SIZE 0x08000000
6
7#define MAX_DMA_ADDRESS 0
8
9#define KERNELOFFSET (PLATFORM_DEFAULT_MEM_START + 0x1000)
10
11#endif /* __XTENSA_S6105_HARDWARE_H */
diff --git a/arch/xtensa/platforms/s6105/include/platform/serial.h b/arch/xtensa/platforms/s6105/include/platform/serial.h
new file mode 100644
index 000000000000..c8a771e5981b
--- /dev/null
+++ b/arch/xtensa/platforms/s6105/include/platform/serial.h
@@ -0,0 +1,8 @@
1#ifndef __ASM_XTENSA_S6105_SERIAL_H
2#define __ASM_XTENSA_S6105_SERIAL_H
3
4#include <variant/hardware.h>
5
6#define BASE_BAUD (S6_SCLK / 16)
7
8#endif /* __ASM_XTENSA_S6105_SERIAL_H */
diff --git a/arch/xtensa/platforms/s6105/setup.c b/arch/xtensa/platforms/s6105/setup.c
new file mode 100644
index 000000000000..ae041d5027a2
--- /dev/null
+++ b/arch/xtensa/platforms/s6105/setup.c
@@ -0,0 +1,61 @@
1/*
2 * s6105 control routines
3 *
4 * Copyright (c) 2009 emlix GmbH
5 */
6#include <linux/irq.h>
7#include <linux/io.h>
8#include <linux/gpio.h>
9
10#include <asm/bootparam.h>
11
12#include <variant/hardware.h>
13#include <platform/gpio.h>
14
15void platform_halt(void)
16{
17 local_irq_disable();
18 while (1)
19 ;
20}
21
22void platform_power_off(void)
23{
24 platform_halt();
25}
26
27void platform_restart(void)
28{
29 platform_halt();
30}
31
32void __init platform_setup(char **cmdline)
33{
34 unsigned long reg;
35
36 reg = readl(S6_REG_GREG1 + S6_GREG1_CLKGATE);
37 reg &= ~(1 << S6_GREG1_BLOCK_SB);
38 writel(reg, S6_REG_GREG1 + S6_GREG1_CLKGATE);
39
40 reg = readl(S6_REG_GREG1 + S6_GREG1_BLOCKENA);
41 reg |= 1 << S6_GREG1_BLOCK_SB;
42 writel(reg, S6_REG_GREG1 + S6_GREG1_BLOCKENA);
43
44 printk(KERN_NOTICE "S6105 on Stretch S6000 - "
45 "Copyright (C) 2009 emlix GmbH <info@emlix.com>\n");
46}
47
48void __init platform_init(bp_tag_t *first)
49{
50 gpio_request(GPIO_LED1_NGREEN, "led1_green");
51 gpio_request(GPIO_LED1_RED, "led1_red");
52 gpio_direction_output(GPIO_LED1_NGREEN, 1);
53}
54
55void platform_heartbeat(void)
56{
57 static unsigned int c;
58
59 if (!(++c & 0x4F))
60 gpio_direction_output(GPIO_LED1_RED, !(c & 0x10));
61}
diff --git a/arch/xtensa/platforms/xt2000/include/platform/hardware.h b/arch/xtensa/platforms/xt2000/include/platform/hardware.h
index 41459ad07766..886ef156ded3 100644
--- a/arch/xtensa/platforms/xt2000/include/platform/hardware.h
+++ b/arch/xtensa/platforms/xt2000/include/platform/hardware.h
@@ -16,7 +16,6 @@
16#define _XTENSA_XT2000_HARDWARE_H 16#define _XTENSA_XT2000_HARDWARE_H
17 17
18#include <variant/core.h> 18#include <variant/core.h>
19#include <asm/io.h>
20 19
21/* 20/*
22 * Memory configuration. 21 * Memory configuration.
diff --git a/arch/xtensa/variants/s6000/Makefile b/arch/xtensa/variants/s6000/Makefile
new file mode 100644
index 000000000000..03b3975468bd
--- /dev/null
+++ b/arch/xtensa/variants/s6000/Makefile
@@ -0,0 +1,3 @@
1# s6000 Makefile
2
3obj-y += irq.o gpio.o
diff --git a/arch/xtensa/variants/s6000/gpio.c b/arch/xtensa/variants/s6000/gpio.c
new file mode 100644
index 000000000000..33a8d952934c
--- /dev/null
+++ b/arch/xtensa/variants/s6000/gpio.c
@@ -0,0 +1,71 @@
1/*
2 * s6000 gpio driver
3 *
4 * Copyright (c) 2009 emlix GmbH
5 * Authors: Oskar Schirmer <os@emlix.com>
6 * Johannes Weiner <jw@emlix.com>
7 */
8#include <linux/kernel.h>
9#include <linux/module.h>
10#include <linux/init.h>
11#include <linux/io.h>
12#include <linux/gpio.h>
13
14#include <variant/hardware.h>
15
16#define S6_GPIO_DATA 0x000
17#define S6_GPIO_IS 0x404
18#define S6_GPIO_IBE 0x408
19#define S6_GPIO_IEV 0x40C
20#define S6_GPIO_IE 0x410
21#define S6_GPIO_RIS 0x414
22#define S6_GPIO_MIS 0x418
23#define S6_GPIO_IC 0x41C
24#define S6_GPIO_AFSEL 0x420
25#define S6_GPIO_DIR 0x800
26#define S6_GPIO_BANK(nr) ((nr) * 0x1000)
27#define S6_GPIO_MASK(nr) (4 << (nr))
28#define S6_GPIO_OFFSET(nr) \
29 (S6_GPIO_BANK((nr) >> 3) + S6_GPIO_MASK((nr) & 7))
30
31static int direction_input(struct gpio_chip *chip, unsigned int off)
32{
33 writeb(0, S6_REG_GPIO + S6_GPIO_DIR + S6_GPIO_OFFSET(off));
34 return 0;
35}
36
37static int get(struct gpio_chip *chip, unsigned int off)
38{
39 return readb(S6_REG_GPIO + S6_GPIO_DATA + S6_GPIO_OFFSET(off));
40}
41
42static int direction_output(struct gpio_chip *chip, unsigned int off, int val)
43{
44 unsigned rel = S6_GPIO_OFFSET(off);
45 writeb(~0, S6_REG_GPIO + S6_GPIO_DIR + rel);
46 writeb(val ? ~0 : 0, S6_REG_GPIO + S6_GPIO_DATA + rel);
47 return 0;
48}
49
50static void set(struct gpio_chip *chip, unsigned int off, int val)
51{
52 writeb(val ? ~0 : 0, S6_REG_GPIO + S6_GPIO_DATA + S6_GPIO_OFFSET(off));
53}
54
55static struct gpio_chip gpiochip = {
56 .owner = THIS_MODULE,
57 .direction_input = direction_input,
58 .get = get,
59 .direction_output = direction_output,
60 .set = set,
61 .base = 0,
62 .ngpio = 24,
63 .can_sleep = 0, /* no blocking io needed */
64 .exported = 0, /* no exporting to userspace */
65};
66
67static int gpio_init(void)
68{
69 return gpiochip_add(&gpiochip);
70}
71device_initcall(gpio_init);
diff --git a/arch/xtensa/variants/s6000/include/variant/core.h b/arch/xtensa/variants/s6000/include/variant/core.h
new file mode 100644
index 000000000000..af007953027e
--- /dev/null
+++ b/arch/xtensa/variants/s6000/include/variant/core.h
@@ -0,0 +1,431 @@
1/*
2 * Xtensa processor core configuration information.
3 *
4 * This file is subject to the terms and conditions of the GNU General Public
5 * License. See the file "COPYING" in the main directory of this archive
6 * for more details.
7 *
8 * Copyright (c) 1999-2008 Tensilica Inc.
9 */
10
11#ifndef _XTENSA_CORE_CONFIGURATION_H
12#define _XTENSA_CORE_CONFIGURATION_H
13
14
15/****************************************************************************
16 Parameters Useful for Any Code, USER or PRIVILEGED
17 ****************************************************************************/
18
19/*
20 * Note: Macros of the form XCHAL_HAVE_*** have a value of 1 if the option is
21 * configured, and a value of 0 otherwise. These macros are always defined.
22 */
23
24
25/*----------------------------------------------------------------------
26 ISA
27 ----------------------------------------------------------------------*/
28
29#define XCHAL_HAVE_BE 0 /* big-endian byte ordering */
30#define XCHAL_HAVE_WINDOWED 1 /* windowed registers option */
31#define XCHAL_NUM_AREGS 64 /* num of physical addr regs */
32#define XCHAL_NUM_AREGS_LOG2 6 /* log2(XCHAL_NUM_AREGS) */
33#define XCHAL_MAX_INSTRUCTION_SIZE 8 /* max instr bytes (3..8) */
34#define XCHAL_HAVE_DEBUG 1 /* debug option */
35#define XCHAL_HAVE_DENSITY 1 /* 16-bit instructions */
36#define XCHAL_HAVE_LOOPS 1 /* zero-overhead loops */
37#define XCHAL_HAVE_NSA 1 /* NSA/NSAU instructions */
38#define XCHAL_HAVE_MINMAX 1 /* MIN/MAX instructions */
39#define XCHAL_HAVE_SEXT 1 /* SEXT instruction */
40#define XCHAL_HAVE_CLAMPS 1 /* CLAMPS instruction */
41#define XCHAL_HAVE_MUL16 1 /* MUL16S/MUL16U instructions */
42#define XCHAL_HAVE_MUL32 1 /* MULL instruction */
43#define XCHAL_HAVE_MUL32_HIGH 1 /* MULUH/MULSH instructions */
44#define XCHAL_HAVE_DIV32 0 /* QUOS/QUOU/REMS/REMU instructions */
45#define XCHAL_HAVE_L32R 1 /* L32R instruction */
46#define XCHAL_HAVE_ABSOLUTE_LITERALS 1 /* non-PC-rel (extended) L32R */
47#define XCHAL_HAVE_CONST16 0 /* CONST16 instruction */
48#define XCHAL_HAVE_ADDX 1 /* ADDX#/SUBX# instructions */
49#define XCHAL_HAVE_WIDE_BRANCHES 0 /* B*.W18 or B*.W15 instr's */
50#define XCHAL_HAVE_PREDICTED_BRANCHES 0 /* B[EQ/EQZ/NE/NEZ]T instr's */
51#define XCHAL_HAVE_CALL4AND12 1 /* (obsolete option) */
52#define XCHAL_HAVE_ABS 1 /* ABS instruction */
53/*#define XCHAL_HAVE_POPC 0*/ /* POPC instruction */
54/*#define XCHAL_HAVE_CRC 0*/ /* CRC instruction */
55#define XCHAL_HAVE_RELEASE_SYNC 0 /* L32AI/S32RI instructions */
56#define XCHAL_HAVE_S32C1I 0 /* S32C1I instruction */
57#define XCHAL_HAVE_SPECULATION 0 /* speculation */
58#define XCHAL_HAVE_FULL_RESET 0 /* all regs/state reset */
59#define XCHAL_NUM_CONTEXTS 1 /* */
60#define XCHAL_NUM_MISC_REGS 4 /* num of scratch regs (0..4) */
61#define XCHAL_HAVE_TAP_MASTER 0 /* JTAG TAP control instr's */
62#define XCHAL_HAVE_PRID 0 /* processor ID register */
63#define XCHAL_HAVE_THREADPTR 0 /* THREADPTR register */
64#define XCHAL_HAVE_BOOLEANS 1 /* boolean registers */
65#define XCHAL_HAVE_CP 1 /* CPENABLE reg (coprocessor) */
66#define XCHAL_CP_MAXCFG 8 /* max allowed cp id plus one */
67#define XCHAL_HAVE_MAC16 0 /* MAC16 package */
68#define XCHAL_HAVE_VECTORFPU2005 0 /* vector floating-point pkg */
69#define XCHAL_HAVE_FP 1 /* floating point pkg */
70#define XCHAL_HAVE_VECTRA1 0 /* Vectra I pkg */
71#define XCHAL_HAVE_VECTRALX 0 /* Vectra LX pkg */
72#define XCHAL_HAVE_HIFI2 0 /* HiFi2 Audio Engine pkg */
73
74
75/*----------------------------------------------------------------------
76 MISC
77 ----------------------------------------------------------------------*/
78
79#define XCHAL_NUM_WRITEBUFFER_ENTRIES 8 /* size of write buffer */
80#define XCHAL_INST_FETCH_WIDTH 8 /* instr-fetch width in bytes */
81#define XCHAL_DATA_WIDTH 16 /* data width in bytes */
82/* In T1050, applies to selected core load and store instructions (see ISA): */
83#define XCHAL_UNALIGNED_LOAD_EXCEPTION 1 /* unaligned loads cause exc. */
84#define XCHAL_UNALIGNED_STORE_EXCEPTION 1 /* unaligned stores cause exc.*/
85
86#define XCHAL_SW_VERSION 701001 /* sw version of this header */
87
88#define XCHAL_CORE_ID "stretch_bali" /* alphanum core name
89 (CoreID) set in the Xtensa
90 Processor Generator */
91
92#define XCHAL_BUILD_UNIQUE_ID 0x000104B9 /* 22-bit sw build ID */
93
94/*
95 * These definitions describe the hardware targeted by this software.
96 */
97#define XCHAL_HW_CONFIGID0 0xC2F3F9FE /* ConfigID hi 32 bits*/
98#define XCHAL_HW_CONFIGID1 0x054104B9 /* ConfigID lo 32 bits*/
99#define XCHAL_HW_VERSION_NAME "LX1.0.2" /* full version name */
100#define XCHAL_HW_VERSION_MAJOR 2100 /* major ver# of targeted hw */
101#define XCHAL_HW_VERSION_MINOR 2 /* minor ver# of targeted hw */
102#define XCHAL_HW_VERSION 210002 /* major*100+minor */
103#define XCHAL_HW_REL_LX1 1
104#define XCHAL_HW_REL_LX1_0 1
105#define XCHAL_HW_REL_LX1_0_2 1
106#define XCHAL_HW_CONFIGID_RELIABLE 1
107/* If software targets a *range* of hardware versions, these are the bounds: */
108#define XCHAL_HW_MIN_VERSION_MAJOR 2100 /* major v of earliest tgt hw */
109#define XCHAL_HW_MIN_VERSION_MINOR 2 /* minor v of earliest tgt hw */
110#define XCHAL_HW_MIN_VERSION 210002 /* earliest targeted hw */
111#define XCHAL_HW_MAX_VERSION_MAJOR 2100 /* major v of latest tgt hw */
112#define XCHAL_HW_MAX_VERSION_MINOR 2 /* minor v of latest tgt hw */
113#define XCHAL_HW_MAX_VERSION 210002 /* latest targeted hw */
114
115
116/*----------------------------------------------------------------------
117 CACHE
118 ----------------------------------------------------------------------*/
119
120#define XCHAL_ICACHE_LINESIZE 16 /* I-cache line size in bytes */
121#define XCHAL_DCACHE_LINESIZE 16 /* D-cache line size in bytes */
122#define XCHAL_ICACHE_LINEWIDTH 4 /* log2(I line size in bytes) */
123#define XCHAL_DCACHE_LINEWIDTH 4 /* log2(D line size in bytes) */
124
125#define XCHAL_ICACHE_SIZE 32768 /* I-cache size in bytes or 0 */
126#define XCHAL_DCACHE_SIZE 32768 /* D-cache size in bytes or 0 */
127
128#define XCHAL_DCACHE_IS_WRITEBACK 1 /* writeback feature */
129
130
131
132
133/****************************************************************************
134 Parameters Useful for PRIVILEGED (Supervisory or Non-Virtualized) Code
135 ****************************************************************************/
136
137
138#ifndef XTENSA_HAL_NON_PRIVILEGED_ONLY
139
140/*----------------------------------------------------------------------
141 CACHE
142 ----------------------------------------------------------------------*/
143
144#define XCHAL_HAVE_PIF 1 /* any outbound PIF present */
145
146/* If present, cache size in bytes == (ways * 2^(linewidth + setwidth)). */
147
148/* Number of cache sets in log2(lines per way): */
149#define XCHAL_ICACHE_SETWIDTH 9
150#define XCHAL_DCACHE_SETWIDTH 10
151
152/* Cache set associativity (number of ways): */
153#define XCHAL_ICACHE_WAYS 4
154#define XCHAL_DCACHE_WAYS 2
155
156/* Cache features: */
157#define XCHAL_ICACHE_LINE_LOCKABLE 1
158#define XCHAL_DCACHE_LINE_LOCKABLE 0
159#define XCHAL_ICACHE_ECC_PARITY 0
160#define XCHAL_DCACHE_ECC_PARITY 0
161
162/* Number of encoded cache attr bits (see <xtensa/hal.h> for decoded bits): */
163#define XCHAL_CA_BITS 4
164
165
166/*----------------------------------------------------------------------
167 INTERNAL I/D RAM/ROMs and XLMI
168 ----------------------------------------------------------------------*/
169
170#define XCHAL_NUM_INSTROM 0 /* number of core instr. ROMs */
171#define XCHAL_NUM_INSTRAM 0 /* number of core instr. RAMs */
172#define XCHAL_NUM_DATAROM 0 /* number of core data ROMs */
173#define XCHAL_NUM_DATARAM 1 /* number of core data RAMs */
174#define XCHAL_NUM_URAM 0 /* number of core unified RAMs*/
175#define XCHAL_NUM_XLMI 1 /* number of core XLMI ports */
176
177/* Data RAM 0: */
178#define XCHAL_DATARAM0_VADDR 0x3FFF0000
179#define XCHAL_DATARAM0_PADDR 0x3FFF0000
180#define XCHAL_DATARAM0_SIZE 65536
181#define XCHAL_DATARAM0_ECC_PARITY 0
182
183/* XLMI Port 0: */
184#define XCHAL_XLMI0_VADDR 0x37F80000
185#define XCHAL_XLMI0_PADDR 0x37F80000
186#define XCHAL_XLMI0_SIZE 262144
187#define XCHAL_XLMI0_ECC_PARITY 0
188
189
190/*----------------------------------------------------------------------
191 INTERRUPTS and TIMERS
192 ----------------------------------------------------------------------*/
193
194#define XCHAL_HAVE_INTERRUPTS 1 /* interrupt option */
195#define XCHAL_HAVE_HIGHPRI_INTERRUPTS 1 /* med/high-pri. interrupts */
196#define XCHAL_HAVE_NMI 1 /* non-maskable interrupt */
197#define XCHAL_HAVE_CCOUNT 1 /* CCOUNT reg. (timer option) */
198#define XCHAL_NUM_TIMERS 3 /* number of CCOMPAREn regs */
199#define XCHAL_NUM_INTERRUPTS 27 /* number of interrupts */
200#define XCHAL_NUM_INTERRUPTS_LOG2 5 /* ceil(log2(NUM_INTERRUPTS)) */
201#define XCHAL_NUM_EXTINTERRUPTS 20 /* num of external interrupts */
202#define XCHAL_NUM_INTLEVELS 4 /* number of interrupt levels
203 (not including level zero) */
204#define XCHAL_EXCM_LEVEL 1 /* level masked by PS.EXCM */
205 /* (always 1 in XEA1; levels 2 .. EXCM_LEVEL are "medium priority") */
206
207/* Masks of interrupts at each interrupt level: */
208#define XCHAL_INTLEVEL1_MASK 0x01F07FFF
209#define XCHAL_INTLEVEL2_MASK 0x02018000
210#define XCHAL_INTLEVEL3_MASK 0x04060000
211#define XCHAL_INTLEVEL4_MASK 0x00000000
212#define XCHAL_INTLEVEL5_MASK 0x00080000
213#define XCHAL_INTLEVEL6_MASK 0x00000000
214#define XCHAL_INTLEVEL7_MASK 0x00000000
215
216/* Masks of interrupts at each range 1..n of interrupt levels: */
217#define XCHAL_INTLEVEL1_ANDBELOW_MASK 0x01F07FFF
218#define XCHAL_INTLEVEL2_ANDBELOW_MASK 0x03F1FFFF
219#define XCHAL_INTLEVEL3_ANDBELOW_MASK 0x07F7FFFF
220#define XCHAL_INTLEVEL4_ANDBELOW_MASK 0x07F7FFFF
221#define XCHAL_INTLEVEL5_ANDBELOW_MASK 0x07FFFFFF
222#define XCHAL_INTLEVEL6_ANDBELOW_MASK 0x07FFFFFF
223#define XCHAL_INTLEVEL7_ANDBELOW_MASK 0x07FFFFFF
224
225/* Level of each interrupt: */
226#define XCHAL_INT0_LEVEL 1
227#define XCHAL_INT1_LEVEL 1
228#define XCHAL_INT2_LEVEL 1
229#define XCHAL_INT3_LEVEL 1
230#define XCHAL_INT4_LEVEL 1
231#define XCHAL_INT5_LEVEL 1
232#define XCHAL_INT6_LEVEL 1
233#define XCHAL_INT7_LEVEL 1
234#define XCHAL_INT8_LEVEL 1
235#define XCHAL_INT9_LEVEL 1
236#define XCHAL_INT10_LEVEL 1
237#define XCHAL_INT11_LEVEL 1
238#define XCHAL_INT12_LEVEL 1
239#define XCHAL_INT13_LEVEL 1
240#define XCHAL_INT14_LEVEL 1
241#define XCHAL_INT15_LEVEL 2
242#define XCHAL_INT16_LEVEL 2
243#define XCHAL_INT17_LEVEL 3
244#define XCHAL_INT18_LEVEL 3
245#define XCHAL_INT19_LEVEL 5
246#define XCHAL_INT20_LEVEL 1
247#define XCHAL_INT21_LEVEL 1
248#define XCHAL_INT22_LEVEL 1
249#define XCHAL_INT23_LEVEL 1
250#define XCHAL_INT24_LEVEL 1
251#define XCHAL_INT25_LEVEL 2
252#define XCHAL_INT26_LEVEL 3
253#define XCHAL_DEBUGLEVEL 4 /* debug interrupt level */
254#define XCHAL_HAVE_DEBUG_EXTERN_INT 1 /* OCD external db interrupt */
255#define XCHAL_NMILEVEL 5 /* NMI "level" (for use with
256 EXCSAVE/EPS/EPC_n, RFI n) */
257
258/* Type of each interrupt: */
259#define XCHAL_INT0_TYPE XTHAL_INTTYPE_EXTERN_LEVEL
260#define XCHAL_INT1_TYPE XTHAL_INTTYPE_EXTERN_LEVEL
261#define XCHAL_INT2_TYPE XTHAL_INTTYPE_EXTERN_LEVEL
262#define XCHAL_INT3_TYPE XTHAL_INTTYPE_EXTERN_LEVEL
263#define XCHAL_INT4_TYPE XTHAL_INTTYPE_EXTERN_LEVEL
264#define XCHAL_INT5_TYPE XTHAL_INTTYPE_EXTERN_LEVEL
265#define XCHAL_INT6_TYPE XTHAL_INTTYPE_EXTERN_LEVEL
266#define XCHAL_INT7_TYPE XTHAL_INTTYPE_EXTERN_LEVEL
267#define XCHAL_INT8_TYPE XTHAL_INTTYPE_EXTERN_LEVEL
268#define XCHAL_INT9_TYPE XTHAL_INTTYPE_EXTERN_LEVEL
269#define XCHAL_INT10_TYPE XTHAL_INTTYPE_EXTERN_LEVEL
270#define XCHAL_INT11_TYPE XTHAL_INTTYPE_EXTERN_LEVEL
271#define XCHAL_INT12_TYPE XTHAL_INTTYPE_EXTERN_LEVEL
272#define XCHAL_INT13_TYPE XTHAL_INTTYPE_EXTERN_LEVEL
273#define XCHAL_INT14_TYPE XTHAL_INTTYPE_EXTERN_LEVEL
274#define XCHAL_INT15_TYPE XTHAL_INTTYPE_EXTERN_LEVEL
275#define XCHAL_INT16_TYPE XTHAL_INTTYPE_EXTERN_LEVEL
276#define XCHAL_INT17_TYPE XTHAL_INTTYPE_EXTERN_LEVEL
277#define XCHAL_INT18_TYPE XTHAL_INTTYPE_EXTERN_LEVEL
278#define XCHAL_INT19_TYPE XTHAL_INTTYPE_NMI
279#define XCHAL_INT20_TYPE XTHAL_INTTYPE_SOFTWARE
280#define XCHAL_INT21_TYPE XTHAL_INTTYPE_SOFTWARE
281#define XCHAL_INT22_TYPE XTHAL_INTTYPE_SOFTWARE
282#define XCHAL_INT23_TYPE XTHAL_INTTYPE_SOFTWARE
283#define XCHAL_INT24_TYPE XTHAL_INTTYPE_TIMER
284#define XCHAL_INT25_TYPE XTHAL_INTTYPE_TIMER
285#define XCHAL_INT26_TYPE XTHAL_INTTYPE_TIMER
286
287/* Masks of interrupts for each type of interrupt: */
288#define XCHAL_INTTYPE_MASK_UNCONFIGURED 0xF8000000
289#define XCHAL_INTTYPE_MASK_SOFTWARE 0x00F00000
290#define XCHAL_INTTYPE_MASK_EXTERN_EDGE 0x00000000
291#define XCHAL_INTTYPE_MASK_EXTERN_LEVEL 0x0007FFFF
292#define XCHAL_INTTYPE_MASK_TIMER 0x07000000
293#define XCHAL_INTTYPE_MASK_NMI 0x00080000
294#define XCHAL_INTTYPE_MASK_WRITE_ERROR 0x00000000
295
296/* Interrupt numbers assigned to specific interrupt sources: */
297#define XCHAL_TIMER0_INTERRUPT 24 /* CCOMPARE0 */
298#define XCHAL_TIMER1_INTERRUPT 25 /* CCOMPARE1 */
299#define XCHAL_TIMER2_INTERRUPT 26 /* CCOMPARE2 */
300#define XCHAL_TIMER3_INTERRUPT XTHAL_TIMER_UNCONFIGURED
301#define XCHAL_NMI_INTERRUPT 19 /* non-maskable interrupt */
302
303/* Interrupt numbers for levels at which only one interrupt is configured: */
304#define XCHAL_INTLEVEL5_NUM 19
305/* (There are many interrupts each at level(s) 1, 2, 3.) */
306
307
308/*
309 * External interrupt vectors/levels.
310 * These macros describe how Xtensa processor interrupt numbers
311 * (as numbered internally, eg. in INTERRUPT and INTENABLE registers)
312 * map to external BInterrupt<n> pins, for those interrupts
313 * configured as external (level-triggered, edge-triggered, or NMI).
314 * See the Xtensa processor databook for more details.
315 */
316
317/* Core interrupt numbers mapped to each EXTERNAL interrupt number: */
318#define XCHAL_EXTINT0_NUM 0 /* (intlevel 1) */
319#define XCHAL_EXTINT1_NUM 1 /* (intlevel 1) */
320#define XCHAL_EXTINT2_NUM 2 /* (intlevel 1) */
321#define XCHAL_EXTINT3_NUM 3 /* (intlevel 1) */
322#define XCHAL_EXTINT4_NUM 4 /* (intlevel 1) */
323#define XCHAL_EXTINT5_NUM 5 /* (intlevel 1) */
324#define XCHAL_EXTINT6_NUM 6 /* (intlevel 1) */
325#define XCHAL_EXTINT7_NUM 7 /* (intlevel 1) */
326#define XCHAL_EXTINT8_NUM 8 /* (intlevel 1) */
327#define XCHAL_EXTINT9_NUM 9 /* (intlevel 1) */
328#define XCHAL_EXTINT10_NUM 10 /* (intlevel 1) */
329#define XCHAL_EXTINT11_NUM 11 /* (intlevel 1) */
330#define XCHAL_EXTINT12_NUM 12 /* (intlevel 1) */
331#define XCHAL_EXTINT13_NUM 13 /* (intlevel 1) */
332#define XCHAL_EXTINT14_NUM 14 /* (intlevel 1) */
333#define XCHAL_EXTINT15_NUM 15 /* (intlevel 2) */
334#define XCHAL_EXTINT16_NUM 16 /* (intlevel 2) */
335#define XCHAL_EXTINT17_NUM 17 /* (intlevel 3) */
336#define XCHAL_EXTINT18_NUM 18 /* (intlevel 3) */
337#define XCHAL_EXTINT19_NUM 19 /* (intlevel 5) */
338
339
340/*----------------------------------------------------------------------
341 EXCEPTIONS and VECTORS
342 ----------------------------------------------------------------------*/
343
344#define XCHAL_XEA_VERSION 2 /* Xtensa Exception Architecture
345 number: 1 == XEA1 (old)
346 2 == XEA2 (new)
347 0 == XEAX (extern) */
348#define XCHAL_HAVE_XEA1 0 /* Exception Architecture 1 */
349#define XCHAL_HAVE_XEA2 1 /* Exception Architecture 2 */
350#define XCHAL_HAVE_XEAX 0 /* External Exception Arch. */
351#define XCHAL_HAVE_EXCEPTIONS 1 /* exception option */
352#define XCHAL_HAVE_MEM_ECC_PARITY 0 /* local memory ECC/parity */
353#define XCHAL_HAVE_VECTOR_SELECT 0 /* relocatable vectors */
354#define XCHAL_HAVE_VECBASE 0 /* relocatable vectors */
355
356#define XCHAL_RESET_VECOFS 0x00000000
357#define XCHAL_RESET_VECTOR_VADDR 0x3FFE03D0
358#define XCHAL_RESET_VECTOR_PADDR 0x3FFE03D0
359#define XCHAL_USER_VECOFS 0x00000000
360#define XCHAL_USER_VECTOR_VADDR 0x40000220
361#define XCHAL_USER_VECTOR_PADDR 0x40000220
362#define XCHAL_KERNEL_VECOFS 0x00000000
363#define XCHAL_KERNEL_VECTOR_VADDR 0x40000200
364#define XCHAL_KERNEL_VECTOR_PADDR 0x40000200
365#define XCHAL_DOUBLEEXC_VECOFS 0x00000000
366#define XCHAL_DOUBLEEXC_VECTOR_VADDR 0x400002A0
367#define XCHAL_DOUBLEEXC_VECTOR_PADDR 0x400002A0
368#define XCHAL_WINDOW_OF4_VECOFS 0x00000000
369#define XCHAL_WINDOW_UF4_VECOFS 0x00000040
370#define XCHAL_WINDOW_OF8_VECOFS 0x00000080
371#define XCHAL_WINDOW_UF8_VECOFS 0x000000C0
372#define XCHAL_WINDOW_OF12_VECOFS 0x00000100
373#define XCHAL_WINDOW_UF12_VECOFS 0x00000140
374#define XCHAL_WINDOW_VECTORS_VADDR 0x40000000
375#define XCHAL_WINDOW_VECTORS_PADDR 0x40000000
376#define XCHAL_INTLEVEL2_VECOFS 0x00000000
377#define XCHAL_INTLEVEL2_VECTOR_VADDR 0x40000240
378#define XCHAL_INTLEVEL2_VECTOR_PADDR 0x40000240
379#define XCHAL_INTLEVEL3_VECOFS 0x00000000
380#define XCHAL_INTLEVEL3_VECTOR_VADDR 0x40000260
381#define XCHAL_INTLEVEL3_VECTOR_PADDR 0x40000260
382#define XCHAL_INTLEVEL4_VECOFS 0x00000000
383#define XCHAL_INTLEVEL4_VECTOR_VADDR 0x40000390
384#define XCHAL_INTLEVEL4_VECTOR_PADDR 0x40000390
385#define XCHAL_DEBUG_VECOFS XCHAL_INTLEVEL4_VECOFS
386#define XCHAL_DEBUG_VECTOR_VADDR XCHAL_INTLEVEL4_VECTOR_VADDR
387#define XCHAL_DEBUG_VECTOR_PADDR XCHAL_INTLEVEL4_VECTOR_PADDR
388#define XCHAL_NMI_VECOFS 0x00000000
389#define XCHAL_NMI_VECTOR_VADDR 0x400003B0
390#define XCHAL_NMI_VECTOR_PADDR 0x400003B0
391#define XCHAL_INTLEVEL5_VECOFS XCHAL_NMI_VECOFS
392#define XCHAL_INTLEVEL5_VECTOR_VADDR XCHAL_NMI_VECTOR_VADDR
393#define XCHAL_INTLEVEL5_VECTOR_PADDR XCHAL_NMI_VECTOR_PADDR
394
395
396/*----------------------------------------------------------------------
397 DEBUG
398 ----------------------------------------------------------------------*/
399
400#define XCHAL_HAVE_OCD 1 /* OnChipDebug option */
401#define XCHAL_NUM_IBREAK 2 /* number of IBREAKn regs */
402#define XCHAL_NUM_DBREAK 2 /* number of DBREAKn regs */
403#define XCHAL_HAVE_OCD_DIR_ARRAY 1 /* faster OCD option */
404
405
406/*----------------------------------------------------------------------
407 MMU
408 ----------------------------------------------------------------------*/
409
410/* See core-matmap.h header file for more details. */
411
412#define XCHAL_HAVE_TLBS 1 /* inverse of HAVE_CACHEATTR */
413#define XCHAL_HAVE_SPANNING_WAY 1 /* one way maps I+D 4GB vaddr */
414#define XCHAL_HAVE_IDENTITY_MAP 1 /* vaddr == paddr always */
415#define XCHAL_HAVE_CACHEATTR 0 /* CACHEATTR register present */
416#define XCHAL_HAVE_MIMIC_CACHEATTR 1 /* region protection */
417#define XCHAL_HAVE_XLT_CACHEATTR 0 /* region prot. w/translation */
418#define XCHAL_HAVE_PTP_MMU 0 /* full MMU (with page table
419 [autorefill] and protection)
420 usable for an MMU-based OS */
421/* If none of the above last 4 are set, it's a custom TLB configuration. */
422
423#define XCHAL_MMU_ASID_BITS 0 /* number of bits in ASIDs */
424#define XCHAL_MMU_RINGS 1 /* number of rings (1..4) */
425#define XCHAL_MMU_RING_BITS 0 /* num of bits in RING field */
426
427#endif /* !XTENSA_HAL_NON_PRIVILEGED_ONLY */
428
429
430#endif /* _XTENSA_CORE_CONFIGURATION_H */
431
diff --git a/arch/xtensa/variants/s6000/include/variant/hardware.h b/arch/xtensa/variants/s6000/include/variant/hardware.h
new file mode 100644
index 000000000000..5d9ba098d84a
--- /dev/null
+++ b/arch/xtensa/variants/s6000/include/variant/hardware.h
@@ -0,0 +1,259 @@
1#ifndef __XTENSA_S6000_HARDWARE_H
2#define __XTENSA_S6000_HARDWARE_H
3
4#define S6_SCLK 1843200
5
6#define S6_MEM_REG 0x20000000
7#define S6_MEM_EFI 0x33F00000
8#define S6_MEM_PCIE_DATARAM1 0x34000000
9#define S6_MEM_XLMI 0x37F80000
10#define S6_MEM_PIF_DATARAM1 0x37FFC000
11#define S6_MEM_GMAC 0x38000000
12#define S6_MEM_I2S 0x3A000000
13#define S6_MEM_EGIB 0x3C000000
14#define S6_MEM_PCIE_CFG 0x3E000000
15#define S6_MEM_PIF_DATARAM 0x3FFE0000
16#define S6_MEM_XLMI_DATARAM 0x3FFF0000
17#define S6_MEM_DDR 0x40000000
18#define S6_MEM_PCIE_APER 0xC0000000
19#define S6_MEM_AUX 0xF0000000
20
21/* Device addresses */
22
23#define S6_REG_SCB S6_MEM_REG
24#define S6_REG_NB (S6_REG_SCB + 0x10000)
25#define S6_REG_LMSDMA (S6_REG_SCB + 0x20000)
26#define S6_REG_NI (S6_REG_SCB + 0x30000)
27#define S6_REG_NIDMA (S6_REG_SCB + 0x40000)
28#define S6_REG_NS (S6_REG_SCB + 0x50000)
29#define S6_REG_DDR (S6_REG_SCB + 0x60000)
30#define S6_REG_GREG1 (S6_REG_SCB + 0x70000)
31#define S6_REG_DP (S6_REG_SCB + 0x80000)
32#define S6_REG_DPDMA (S6_REG_SCB + 0x90000)
33#define S6_REG_EGIB (S6_REG_SCB + 0xA0000)
34#define S6_REG_PCIE (S6_REG_SCB + 0xB0000)
35#define S6_REG_I2S (S6_REG_SCB + 0xC0000)
36#define S6_REG_GMAC (S6_REG_SCB + 0xD0000)
37#define S6_REG_HIFDMA (S6_REG_SCB + 0xE0000)
38#define S6_REG_GREG2 (S6_REG_SCB + 0xF0000)
39
40#define S6_REG_APB S6_REG_SCB
41#define S6_REG_UART (S6_REG_APB + 0x0000)
42#define S6_REG_INTC (S6_REG_APB + 0x2000)
43#define S6_REG_SPI (S6_REG_APB + 0x3000)
44#define S6_REG_I2C (S6_REG_APB + 0x4000)
45#define S6_REG_GPIO (S6_REG_APB + 0x8000)
46
47/* Global register block */
48
49#define S6_GREG1_PLL_LOCKCLEAR 0x000
50#define S6_GREG1_PLL_LOCK_SYS 0
51#define S6_GREG1_PLL_LOCK_IO 1
52#define S6_GREG1_PLL_LOCK_AIM 2
53#define S6_GREG1_PLL_LOCK_DP0 3
54#define S6_GREG1_PLL_LOCK_DP2 4
55#define S6_GREG1_PLL_LOCK_DDR 5
56#define S6_GREG1_PLL_LOCKSTAT 0x004
57#define S6_GREG1_PLL_LOCKSTAT_CURLOCK 0
58#define S6_GREG1_PLL_LOCKSTAT_EVERUNLCK 8
59#define S6_GREG1_PLLSEL 0x010
60#define S6_GREG1_PLLSEL_AIM 0
61#define S6_GREG1_PLLSEL_AIM_DDR2 0
62#define S6_GREG1_PLLSEL_AIM_300MHZ 1
63#define S6_GREG1_PLLSEL_AIM_240MHZ 2
64#define S6_GREG1_PLLSEL_AIM_200MHZ 3
65#define S6_GREG1_PLLSEL_AIM_150MHZ 4
66#define S6_GREG1_PLLSEL_AIM_120MHZ 5
67#define S6_GREG1_PLLSEL_AIM_40MHZ 6
68#define S6_GREG1_PLLSEL_AIM_PLLAIMREF 7
69#define S6_GREG1_PLLSEL_AIM_MASK 7
70#define S6_GREG1_PLLSEL_DDR 8
71#define S6_GREG1_PLLSEL_DDR_HS 0
72#define S6_GREG1_PLLSEL_DDR_333MHZ 1
73#define S6_GREG1_PLLSEL_DDR_250MHZ 2
74#define S6_GREG1_PLLSEL_DDR_200MHZ 3
75#define S6_GREG1_PLLSEL_DDR_167MHZ 4
76#define S6_GREG1_PLLSEL_DDR_100MHZ 5
77#define S6_GREG1_PLLSEL_DDR_33MHZ 6
78#define S6_GREG1_PLLSEL_DDR_PLLIOREF 7
79#define S6_GREG1_PLLSEL_DDR_MASK 7
80#define S6_GREG1_PLLSEL_GMAC 16
81#define S6_GREG1_PLLSEL_GMAC_125MHZ 0
82#define S6_GREG1_PLLSEL_GMAC_25MHZ 1
83#define S6_GREG1_PLLSEL_GMAC_2500KHZ 2
84#define S6_GREG1_PLLSEL_GMAC_EXTERN 3
85#define S6_GREG1_PLLSEL_GMAC_MASK 3
86#define S6_GREG1_PLLSEL_GMII 18
87#define S6_GREG1_PLLSEL_GMII_111MHZ 0
88#define S6_GREG1_PLLSEL_GMII_IOREF 1
89#define S6_GREG1_PLLSEL_GMII_NONE 2
90#define S6_GREG1_PLLSEL_GMII_125MHZ 3
91#define S6_GREG1_PLLSEL_GMII_MASK 3
92#define S6_GREG1_SYSUNLOCKCNT 0x020
93#define S6_GREG1_IOUNLOCKCNT 0x024
94#define S6_GREG1_AIMUNLOCKCNT 0x028
95#define S6_GREG1_DP0UNLOCKCNT 0x02C
96#define S6_GREG1_DP2UNLOCKCNT 0x030
97#define S6_GREG1_DDRUNLOCKCNT 0x034
98#define S6_GREG1_CLKBAL0 0x040
99#define S6_GREG1_CLKBAL0_LSGB 0
100#define S6_GREG1_CLKBAL0_LSPX 8
101#define S6_GREG1_CLKBAL0_MEMDO 16
102#define S6_GREG1_CLKBAL0_HSXT1 24
103#define S6_GREG1_CLKBAL1 0x044
104#define S6_GREG1_CLKBAL1_HSISEF 0
105#define S6_GREG1_CLKBAL1_HSNI 8
106#define S6_GREG1_CLKBAL1_HSNS 16
107#define S6_GREG1_CLKBAL1_HSISEFCFG 24
108#define S6_GREG1_CLKBAL2 0x048
109#define S6_GREG1_CLKBAL2_LSNB 0
110#define S6_GREG1_CLKBAL2_LSSB 8
111#define S6_GREG1_CLKBAL2_LSREST 24
112#define S6_GREG1_CLKBAL3 0x04C
113#define S6_GREG1_CLKBAL3_ISEFXAD 0
114#define S6_GREG1_CLKBAL3_ISEFLMS 8
115#define S6_GREG1_CLKBAL3_ISEFISEF 16
116#define S6_GREG1_CLKBAL3_DDRDD 24
117#define S6_GREG1_CLKBAL4 0x050
118#define S6_GREG1_CLKBAL4_DDRDP 0
119#define S6_GREG1_CLKBAL4_DDRDO 8
120#define S6_GREG1_CLKBAL4_DDRNB 16
121#define S6_GREG1_CLKBAL4_DDRLMS 24
122#define S6_GREG1_BLOCKENA 0x100
123#define S6_GREG1_BLOCK_DDR 0
124#define S6_GREG1_BLOCK_DP 1
125#define S6_GREG1_BLOCK_NSNI 2
126#define S6_GREG1_BLOCK_PCIE 3
127#define S6_GREG1_BLOCK_GMAC 4
128#define S6_GREG1_BLOCK_I2S 5
129#define S6_GREG1_BLOCK_EGIB 6
130#define S6_GREG1_BLOCK_SB 7
131#define S6_GREG1_BLOCK_XT1 8
132#define S6_GREG1_CLKGATE 0x104
133#define S6_GREG1_BGATE_AIMNORTH 9
134#define S6_GREG1_BGATE_AIMEAST 10
135#define S6_GREG1_BGATE_AIMWEST 11
136#define S6_GREG1_BGATE_AIMSOUTH 12
137#define S6_GREG1_CHIPRES 0x108
138#define S6_GREG1_CHIPRES_SOFTRES 0
139#define S6_GREG1_CHIPRES_LOSTLOCK 1
140#define S6_GREG1_RESETCAUSE 0x10C
141#define S6_GREG1_RESETCAUSE_RESETN 0
142#define S6_GREG1_RESETCAUSE_GLOBAL 1
143#define S6_GREG1_RESETCAUSE_WDOGTIMER 2
144#define S6_GREG1_RESETCAUSE_SWCHIP 3
145#define S6_GREG1_RESETCAUSE_PLLSYSLOSS 4
146#define S6_GREG1_RESETCAUSE_PCIE 5
147#define S6_GREG1_RESETCAUSE_CREATEDGLOB 6
148#define S6_GREG1_REFCLOCKCNT 0x110
149#define S6_GREG1_RESETTIMER 0x114
150#define S6_GREG1_NMITIMER 0x118
151#define S6_GREG1_GLOBAL_TIMER 0x11C
152#define S6_GREG1_TIMER0 0x180
153#define S6_GREG1_TIMER1 0x184
154#define S6_GREG1_UARTCLOCKSEL 0x204
155#define S6_GREG1_CHIPVERSPACKG 0x208
156#define S6_GREG1_CHIPVERSPACKG_CHIPVID 0
157#define S6_GREG1_CHIPVERSPACKG_PACKSEL 8
158#define S6_GREG1_ONDIETERMCTRL 0x20C
159#define S6_GREG1_ONDIETERMCTRL_WEST 0
160#define S6_GREG1_ONDIETERMCTRL_NORTH 2
161#define S6_GREG1_ONDIETERMCTRL_EAST 4
162#define S6_GREG1_ONDIETERMCTRL_SOUTH 6
163#define S6_GREG1_ONDIETERMCTRL_NONE 0
164#define S6_GREG1_ONDIETERMCTRL_75OHM 2
165#define S6_GREG1_ONDIETERMCTRL_MASK 3
166#define S6_GREG1_BOOT_CFG0 0x210
167#define S6_GREG1_BOOT_CFG0_AIMSTRONG 1
168#define S6_GREG1_BOOT_CFG0_MINIBOOTDL 2
169#define S6_GREG1_BOOT_CFG0_OCDGPIO8SET 5
170#define S6_GREG1_BOOT_CFG0_OCDGPIOENA 6
171#define S6_GREG1_BOOT_CFG0_DOWNSTREAM 7
172#define S6_GREG1_BOOT_CFG0_PLLSYSDIV 8
173#define S6_GREG1_BOOT_CFG0_PLLSYSDIV_300MHZ 1
174#define S6_GREG1_BOOT_CFG0_PLLSYSDIV_240MHZ 2
175#define S6_GREG1_BOOT_CFG0_PLLSYSDIV_200MHZ 3
176#define S6_GREG1_BOOT_CFG0_PLLSYSDIV_150MHZ 4
177#define S6_GREG1_BOOT_CFG0_PLLSYSDIV_120MHZ 5
178#define S6_GREG1_BOOT_CFG0_PLLSYSDIV_40MHZ 6
179#define S6_GREG1_BOOT_CFG0_PLLSYSDIV_MASK 7
180#define S6_GREG1_BOOT_CFG0_BALHSLMS 12
181#define S6_GREG1_BOOT_CFG0_BALHSNB 18
182#define S6_GREG1_BOOT_CFG0_BALHSXAD 24
183#define S6_GREG1_BOOT_CFG1 0x214
184#define S6_GREG1_BOOT_CFG1_PCIE1LANE 1
185#define S6_GREG1_BOOT_CFG1_MPLLPRESCALE 2
186#define S6_GREG1_BOOT_CFG1_MPLLNCY 4
187#define S6_GREG1_BOOT_CFG1_MPLLNCY5 9
188#define S6_GREG1_BOOT_CFG1_BALHSREST 14
189#define S6_GREG1_BOOT_CFG1_BALHSPSMEMS 20
190#define S6_GREG1_BOOT_CFG1_BALLSGI 26
191#define S6_GREG1_BOOT_CFG2 0x218
192#define S6_GREG1_BOOT_CFG2_PEID 0
193#define S6_GREG1_BOOT_CFG3 0x21C
194#define S6_GREG1_DRAMBUSYHOLDOF 0x220
195#define S6_GREG1_DRAMBUSYHOLDOF_XT0 0
196#define S6_GREG1_DRAMBUSYHOLDOF_XT1 4
197#define S6_GREG1_DRAMBUSYHOLDOF_XT_MASK 7
198#define S6_GREG1_PCIEBAR1SIZE 0x224
199#define S6_GREG1_PCIEBAR2SIZE 0x228
200#define S6_GREG1_PCIEVENDOR 0x22C
201#define S6_GREG1_PCIEDEVICE 0x230
202#define S6_GREG1_PCIEREV 0x234
203#define S6_GREG1_PCIECLASS 0x238
204#define S6_GREG1_XT1DCACHEMISS 0x240
205#define S6_GREG1_XT1ICACHEMISS 0x244
206#define S6_GREG1_HWSEMAPHORE(n) (0x400 + 4 * (n))
207#define S6_GREG1_HWSEMAPHORE_NB 16
208
209/* peripheral interrupt numbers */
210
211#define S6_INTC_GPIO(n) (n) /* 0..3 */
212#define S6_INTC_I2C 4
213#define S6_INTC_SPI 5
214#define S6_INTC_NB_ERR 6
215#define S6_INTC_DMA_LMSERR 7
216#define S6_INTC_DMA_LMSLOWWMRK(n) (8 + (n)) /* 0..11 */
217#define S6_INTC_DMA_LMSPENDCNT(n) (20 + (n)) /* 0..11 */
218#define S6_INTC_DMA HOSTLOWWMRK(n) (32 + (n)) /* 0..6 */
219#define S6_INTC_DMA_HOSTPENDCNT(n) (39 + (n)) /* 0..6 */
220#define S6_INTC_DMA_HOSTERR 46
221#define S6_INTC_UART(n) (47 + (n)) /* 0..1 */
222#define S6_INTC_XAD 49
223#define S6_INTC_NI_ERR 50
224#define S6_INTC_NI_INFIFOFULL 51
225#define S6_INTC_DMA_NIERR 52
226#define S6_INTC_DMA_NILOWWMRK(n) (53 + (n)) /* 0..3 */
227#define S6_INTC_DMA_NIPENDCNT(n) (57 + (n)) /* 0..3 */
228#define S6_INTC_DDR 61
229#define S6_INTC_NS_ERR 62
230#define S6_INTC_EFI_CFGERR 63
231#define S6_INTC_EFI_ISEFTEST 64
232#define S6_INTC_EFI_WRITEERR 65
233#define S6_INTC_NMI_TIMER 66
234#define S6_INTC_PLLLOCK_SYS 67
235#define S6_INTC_PLLLOCK_IO 68
236#define S6_INTC_PLLLOCK_AIM 69
237#define S6_INTC_PLLLOCK_DP0 70
238#define S6_INTC_PLLLOCK_DP2 71
239#define S6_INTC_I2S_ERR 72
240#define S6_INTC_GMAC_STAT 73
241#define S6_INTC_GMAC_ERR 74
242#define S6_INTC_GIB_ERR 75
243#define S6_INTC_PCIE_ERR 76
244#define S6_INTC_PCIE_MSI(n) (77 + (n)) /* 0..3 */
245#define S6_INTC_PCIE_INTA 81
246#define S6_INTC_PCIE_INTB 82
247#define S6_INTC_PCIE_INTC 83
248#define S6_INTC_PCIE_INTD 84
249#define S6_INTC_SW(n) (85 + (n)) /* 0..9 */
250#define S6_INTC_SW_ENABLE(n) (85 + 256 + (n))
251#define S6_INTC_DMA_DP_ERR 95
252#define S6_INTC_DMA_DPLOWWMRK(n) (96 + (n)) /* 0..3 */
253#define S6_INTC_DMA_DPPENDCNT(n) (100 + (n)) /* 0..3 */
254#define S6_INTC_DMA_DPTERMCNT(n) (104 + (n)) /* 0..3 */
255#define S6_INTC_TIMER0 108
256#define S6_INTC_TIMER1 109
257#define S6_INTC_DMA_HOSTTERMCNT(n) (110 + (n)) /* 0..6 */
258
259#endif /* __XTENSA_S6000_HARDWARE_H */
diff --git a/arch/xtensa/variants/s6000/include/variant/irq.h b/arch/xtensa/variants/s6000/include/variant/irq.h
new file mode 100644
index 000000000000..fa031cb0acc4
--- /dev/null
+++ b/arch/xtensa/variants/s6000/include/variant/irq.h
@@ -0,0 +1,9 @@
1#ifndef __XTENSA_S6000_IRQ_H
2#define __XTENSA_S6000_IRQ_H
3
4#define NO_IRQ (-1)
5
6extern void variant_irq_enable(unsigned int irq);
7extern void variant_irq_disable(unsigned int irq);
8
9#endif /* __XTENSA_S6000_IRQ_H */
diff --git a/arch/xtensa/variants/s6000/include/variant/tie-asm.h b/arch/xtensa/variants/s6000/include/variant/tie-asm.h
new file mode 100644
index 000000000000..f02d0a3a2e20
--- /dev/null
+++ b/arch/xtensa/variants/s6000/include/variant/tie-asm.h
@@ -0,0 +1,304 @@
1/*
2 * This header file contains assembly-language definitions (assembly
3 * macros, etc.) for this specific Xtensa processor's TIE extensions
4 * and options. It is customized to this Xtensa processor configuration.
5 *
6 * This file is subject to the terms and conditions of the GNU General Public
7 * License. See the file "COPYING" in the main directory of this archive
8 * for more details.
9 *
10 * Copyright (C) 1999-2008 Tensilica Inc.
11 */
12
13#ifndef _XTENSA_CORE_TIE_ASM_H
14#define _XTENSA_CORE_TIE_ASM_H
15
16/* Selection parameter values for save-area save/restore macros: */
17/* Option vs. TIE: */
18#define XTHAL_SAS_TIE 0x0001 /* custom extension or coprocessor */
19#define XTHAL_SAS_OPT 0x0002 /* optional (and not a coprocessor) */
20/* Whether used automatically by compiler: */
21#define XTHAL_SAS_NOCC 0x0004 /* not used by compiler w/o special opts/code */
22#define XTHAL_SAS_CC 0x0008 /* used by compiler without special opts/code */
23/* ABI handling across function calls: */
24#define XTHAL_SAS_CALR 0x0010 /* caller-saved */
25#define XTHAL_SAS_CALE 0x0020 /* callee-saved */
26#define XTHAL_SAS_GLOB 0x0040 /* global across function calls (in thread) */
27/* Misc */
28#define XTHAL_SAS_ALL 0xFFFF /* include all default NCP contents */
29
30
31
32/* Macro to save all non-coprocessor (extra) custom TIE and optional state
33 * (not including zero-overhead loop registers).
34 * Save area ptr (clobbered): ptr (16 byte aligned)
35 * Scratch regs (clobbered): at1..at4 (only first XCHAL_NCP_NUM_ATMPS needed)
36 */
37 .macro xchal_ncp_store ptr at1 at2 at3 at4 continue=0 ofs=-1 select=XTHAL_SAS_ALL
38 xchal_sa_start \continue, \ofs
39 .ifeq (XTHAL_SAS_OPT | XTHAL_SAS_NOCC | XTHAL_SAS_CALR) & ~\select
40 xchal_sa_align \ptr, 0, 1024-4, 4, 4
41 rsr \at1, BR // boolean option
42 s32i \at1, \ptr, .Lxchal_ofs_ + 0
43 .set .Lxchal_ofs_, .Lxchal_ofs_ + 4
44 .endif
45 .endm // xchal_ncp_store
46
47/* Macro to save all non-coprocessor (extra) custom TIE and optional state
48 * (not including zero-overhead loop registers).
49 * Save area ptr (clobbered): ptr (16 byte aligned)
50 * Scratch regs (clobbered): at1..at4 (only first XCHAL_NCP_NUM_ATMPS needed)
51 */
52 .macro xchal_ncp_load ptr at1 at2 at3 at4 continue=0 ofs=-1 select=XTHAL_SAS_ALL
53 xchal_sa_start \continue, \ofs
54 .ifeq (XTHAL_SAS_OPT | XTHAL_SAS_NOCC | XTHAL_SAS_CALR) & ~\select
55 xchal_sa_align \ptr, 0, 1024-4, 4, 4
56 l32i \at1, \ptr, .Lxchal_ofs_ + 0
57 wsr \at1, BR // boolean option
58 .set .Lxchal_ofs_, .Lxchal_ofs_ + 4
59 .endif
60 .endm // xchal_ncp_load
61
62
63
64#define XCHAL_NCP_NUM_ATMPS 1
65
66
67
68/* Macro to save the state of TIE coprocessor FPU.
69 * Save area ptr (clobbered): ptr (16 byte aligned)
70 * Scratch regs (clobbered): at1..at4 (only first XCHAL_CP0_NUM_ATMPS needed)
71 */
72#define xchal_cp_FPU_store xchal_cp0_store
73/* #define xchal_cp_FPU_store_a2 xchal_cp0_store a2 a3 a4 a5 a6 */
74 .macro xchal_cp0_store ptr at1 at2 at3 at4 continue=0 ofs=-1 select=XTHAL_SAS_ALL
75 xchal_sa_start \continue, \ofs
76 .ifeq (XTHAL_SAS_TIE | XTHAL_SAS_NOCC | XTHAL_SAS_CALR) & ~\select
77 xchal_sa_align \ptr, 0, 0, 1, 16
78 rur232 \at1 // FCR
79 s32i \at1, \ptr, 0
80 rur233 \at1 // FSR
81 s32i \at1, \ptr, 4
82 SSI f0, \ptr, 8
83 SSI f1, \ptr, 12
84 SSI f2, \ptr, 16
85 SSI f3, \ptr, 20
86 SSI f4, \ptr, 24
87 SSI f5, \ptr, 28
88 SSI f6, \ptr, 32
89 SSI f7, \ptr, 36
90 SSI f8, \ptr, 40
91 SSI f9, \ptr, 44
92 SSI f10, \ptr, 48
93 SSI f11, \ptr, 52
94 SSI f12, \ptr, 56
95 SSI f13, \ptr, 60
96 SSI f14, \ptr, 64
97 SSI f15, \ptr, 68
98 .set .Lxchal_ofs_, .Lxchal_ofs_ + 72
99 .endif
100 .endm // xchal_cp0_store
101
102/* Macro to restore the state of TIE coprocessor FPU.
103 * Save area ptr (clobbered): ptr (16 byte aligned)
104 * Scratch regs (clobbered): at1..at4 (only first XCHAL_CP0_NUM_ATMPS needed)
105 */
106#define xchal_cp_FPU_load xchal_cp0_load
107/* #define xchal_cp_FPU_load_a2 xchal_cp0_load a2 a3 a4 a5 a6 */
108 .macro xchal_cp0_load ptr at1 at2 at3 at4 continue=0 ofs=-1 select=XTHAL_SAS_ALL
109 xchal_sa_start \continue, \ofs
110 .ifeq (XTHAL_SAS_TIE | XTHAL_SAS_NOCC | XTHAL_SAS_CALR) & ~\select
111 xchal_sa_align \ptr, 0, 0, 1, 16
112 l32i \at1, \ptr, 0
113 wur232 \at1 // FCR
114 l32i \at1, \ptr, 4
115 wur233 \at1 // FSR
116 LSI f0, \ptr, 8
117 LSI f1, \ptr, 12
118 LSI f2, \ptr, 16
119 LSI f3, \ptr, 20
120 LSI f4, \ptr, 24
121 LSI f5, \ptr, 28
122 LSI f6, \ptr, 32
123 LSI f7, \ptr, 36
124 LSI f8, \ptr, 40
125 LSI f9, \ptr, 44
126 LSI f10, \ptr, 48
127 LSI f11, \ptr, 52
128 LSI f12, \ptr, 56
129 LSI f13, \ptr, 60
130 LSI f14, \ptr, 64
131 LSI f15, \ptr, 68
132 .set .Lxchal_ofs_, .Lxchal_ofs_ + 72
133 .endif
134 .endm // xchal_cp0_load
135
136#define XCHAL_CP0_NUM_ATMPS 1
137
138/* Macro to save the state of TIE coprocessor XAD.
139 * Save area ptr (clobbered): ptr (16 byte aligned)
140 * Scratch regs (clobbered): at1..at4 (only first XCHAL_CP6_NUM_ATMPS needed)
141 */
142#define xchal_cp_XAD_store xchal_cp6_store
143/* #define xchal_cp_XAD_store_a2 xchal_cp6_store a2 a3 a4 a5 a6 */
144 .macro xchal_cp6_store ptr at1 at2 at3 at4 continue=0 ofs=-1 select=XTHAL_SAS_ALL
145 xchal_sa_start \continue, \ofs
146 .ifeq (XTHAL_SAS_TIE | XTHAL_SAS_NOCC | XTHAL_SAS_CALR) & ~\select
147 xchal_sa_align \ptr, 0, 0, 1, 16
148 rur0 \at1 // LDCBHI
149 s32i \at1, \ptr, 0
150 rur1 \at1 // LDCBLO
151 s32i \at1, \ptr, 4
152 rur2 \at1 // STCBHI
153 s32i \at1, \ptr, 8
154 rur3 \at1 // STCBLO
155 s32i \at1, \ptr, 12
156 rur8 \at1 // LDBRBASE
157 s32i \at1, \ptr, 16
158 rur9 \at1 // LDBROFF
159 s32i \at1, \ptr, 20
160 rur10 \at1 // LDBRINC
161 s32i \at1, \ptr, 24
162 rur11 \at1 // STBRBASE
163 s32i \at1, \ptr, 28
164 rur12 \at1 // STBROFF
165 s32i \at1, \ptr, 32
166 rur13 \at1 // STBRINC
167 s32i \at1, \ptr, 36
168 rur24 \at1 // SCRATCH0
169 s32i \at1, \ptr, 40
170 rur25 \at1 // SCRATCH1
171 s32i \at1, \ptr, 44
172 rur26 \at1 // SCRATCH2
173 s32i \at1, \ptr, 48
174 rur27 \at1 // SCRATCH3
175 s32i \at1, \ptr, 52
176 WRAS128I wra0, \ptr, 64
177 WRAS128I wra1, \ptr, 80
178 WRAS128I wra2, \ptr, 96
179 WRAS128I wra3, \ptr, 112
180 WRAS128I wra4, \ptr, 128
181 WRAS128I wra5, \ptr, 144
182 WRAS128I wra6, \ptr, 160
183 WRAS128I wra7, \ptr, 176
184 WRAS128I wra8, \ptr, 192
185 WRAS128I wra9, \ptr, 208
186 WRAS128I wra10, \ptr, 224
187 WRAS128I wra11, \ptr, 240
188 WRAS128I wra12, \ptr, 256
189 WRAS128I wra13, \ptr, 272
190 WRAS128I wra14, \ptr, 288
191 WRAS128I wra15, \ptr, 304
192 WRBS128I wrb0, \ptr, 320
193 WRBS128I wrb1, \ptr, 336
194 WRBS128I wrb2, \ptr, 352
195 WRBS128I wrb3, \ptr, 368
196 WRBS128I wrb4, \ptr, 384
197 WRBS128I wrb5, \ptr, 400
198 WRBS128I wrb6, \ptr, 416
199 WRBS128I wrb7, \ptr, 432
200 WRBS128I wrb8, \ptr, 448
201 WRBS128I wrb9, \ptr, 464
202 WRBS128I wrb10, \ptr, 480
203 WRBS128I wrb11, \ptr, 496
204 WRBS128I wrb12, \ptr, 512
205 WRBS128I wrb13, \ptr, 528
206 WRBS128I wrb14, \ptr, 544
207 WRBS128I wrb15, \ptr, 560
208 .set .Lxchal_ofs_, .Lxchal_ofs_ + 576
209 .endif
210 .endm // xchal_cp6_store
211
212/* Macro to restore the state of TIE coprocessor XAD.
213 * Save area ptr (clobbered): ptr (16 byte aligned)
214 * Scratch regs (clobbered): at1..at4 (only first XCHAL_CP6_NUM_ATMPS needed)
215 */
216#define xchal_cp_XAD_load xchal_cp6_load
217/* #define xchal_cp_XAD_load_a2 xchal_cp6_load a2 a3 a4 a5 a6 */
218 .macro xchal_cp6_load ptr at1 at2 at3 at4 continue=0 ofs=-1 select=XTHAL_SAS_ALL
219 xchal_sa_start \continue, \ofs
220 .ifeq (XTHAL_SAS_TIE | XTHAL_SAS_NOCC | XTHAL_SAS_CALR) & ~\select
221 xchal_sa_align \ptr, 0, 0, 1, 16
222 l32i \at1, \ptr, 0
223 wur0 \at1 // LDCBHI
224 l32i \at1, \ptr, 4
225 wur1 \at1 // LDCBLO
226 l32i \at1, \ptr, 8
227 wur2 \at1 // STCBHI
228 l32i \at1, \ptr, 12
229 wur3 \at1 // STCBLO
230 l32i \at1, \ptr, 16
231 wur8 \at1 // LDBRBASE
232 l32i \at1, \ptr, 20
233 wur9 \at1 // LDBROFF
234 l32i \at1, \ptr, 24
235 wur10 \at1 // LDBRINC
236 l32i \at1, \ptr, 28
237 wur11 \at1 // STBRBASE
238 l32i \at1, \ptr, 32
239 wur12 \at1 // STBROFF
240 l32i \at1, \ptr, 36
241 wur13 \at1 // STBRINC
242 l32i \at1, \ptr, 40
243 wur24 \at1 // SCRATCH0
244 l32i \at1, \ptr, 44
245 wur25 \at1 // SCRATCH1
246 l32i \at1, \ptr, 48
247 wur26 \at1 // SCRATCH2
248 l32i \at1, \ptr, 52
249 wur27 \at1 // SCRATCH3
250 WRBL128I wrb0, \ptr, 320
251 WRBL128I wrb1, \ptr, 336
252 WRBL128I wrb2, \ptr, 352
253 WRBL128I wrb3, \ptr, 368
254 WRBL128I wrb4, \ptr, 384
255 WRBL128I wrb5, \ptr, 400
256 WRBL128I wrb6, \ptr, 416
257 WRBL128I wrb7, \ptr, 432
258 WRBL128I wrb8, \ptr, 448
259 WRBL128I wrb9, \ptr, 464
260 WRBL128I wrb10, \ptr, 480
261 WRBL128I wrb11, \ptr, 496
262 WRBL128I wrb12, \ptr, 512
263 WRBL128I wrb13, \ptr, 528
264 WRBL128I wrb14, \ptr, 544
265 WRBL128I wrb15, \ptr, 560
266 WRAL128I wra0, \ptr, 64
267 WRAL128I wra1, \ptr, 80
268 WRAL128I wra2, \ptr, 96
269 WRAL128I wra3, \ptr, 112
270 WRAL128I wra4, \ptr, 128
271 WRAL128I wra5, \ptr, 144
272 WRAL128I wra6, \ptr, 160
273 WRAL128I wra7, \ptr, 176
274 WRAL128I wra8, \ptr, 192
275 WRAL128I wra9, \ptr, 208
276 WRAL128I wra10, \ptr, 224
277 WRAL128I wra11, \ptr, 240
278 WRAL128I wra12, \ptr, 256
279 WRAL128I wra13, \ptr, 272
280 WRAL128I wra14, \ptr, 288
281 WRAL128I wra15, \ptr, 304
282 .set .Lxchal_ofs_, .Lxchal_ofs_ + 576
283 .endif
284 .endm // xchal_cp6_load
285
286#define XCHAL_CP6_NUM_ATMPS 1
287#define XCHAL_SA_NUM_ATMPS 1
288
289 /* Empty macros for unconfigured coprocessors: */
290 .macro xchal_cp1_store p a b c d continue=0 ofs=-1 select=-1 ; .endm
291 .macro xchal_cp1_load p a b c d continue=0 ofs=-1 select=-1 ; .endm
292 .macro xchal_cp2_store p a b c d continue=0 ofs=-1 select=-1 ; .endm
293 .macro xchal_cp2_load p a b c d continue=0 ofs=-1 select=-1 ; .endm
294 .macro xchal_cp3_store p a b c d continue=0 ofs=-1 select=-1 ; .endm
295 .macro xchal_cp3_load p a b c d continue=0 ofs=-1 select=-1 ; .endm
296 .macro xchal_cp4_store p a b c d continue=0 ofs=-1 select=-1 ; .endm
297 .macro xchal_cp4_load p a b c d continue=0 ofs=-1 select=-1 ; .endm
298 .macro xchal_cp5_store p a b c d continue=0 ofs=-1 select=-1 ; .endm
299 .macro xchal_cp5_load p a b c d continue=0 ofs=-1 select=-1 ; .endm
300 .macro xchal_cp7_store p a b c d continue=0 ofs=-1 select=-1 ; .endm
301 .macro xchal_cp7_load p a b c d continue=0 ofs=-1 select=-1 ; .endm
302
303#endif /*_XTENSA_CORE_TIE_ASM_H*/
304
diff --git a/arch/xtensa/variants/s6000/include/variant/tie.h b/arch/xtensa/variants/s6000/include/variant/tie.h
new file mode 100644
index 000000000000..be7ea843d5df
--- /dev/null
+++ b/arch/xtensa/variants/s6000/include/variant/tie.h
@@ -0,0 +1,191 @@
1/*
2 * This header file describes this specific Xtensa processor's TIE extensions
3 * that extend basic Xtensa core functionality. It is customized to this
4 * Xtensa processor configuration.
5 *
6 * This file is subject to the terms and conditions of the GNU General Public
7 * License. See the file "COPYING" in the main directory of this archive
8 * for more details.
9 *
10 * Copyright (C) 1999-2008 Tensilica Inc.
11 */
12
13#ifndef _XTENSA_CORE_TIE_H
14#define _XTENSA_CORE_TIE_H
15
16#define XCHAL_CP_NUM 2 /* number of coprocessors */
17#define XCHAL_CP_MAX 7 /* max CP ID + 1 (0 if none) */
18#define XCHAL_CP_MASK 0x41 /* bitmask of all CPs by ID */
19#define XCHAL_CP_PORT_MASK 0x00 /* bitmask of only port CPs */
20
21/* Basic parameters of each coprocessor: */
22#define XCHAL_CP0_NAME "FPU"
23#define XCHAL_CP0_IDENT FPU
24#define XCHAL_CP0_SA_SIZE 72 /* size of state save area */
25#define XCHAL_CP0_SA_ALIGN 4 /* min alignment of save area */
26#define XCHAL_CP_ID_FPU 0 /* coprocessor ID (0..7) */
27#define XCHAL_CP6_NAME "XAD"
28#define XCHAL_CP6_IDENT XAD
29#define XCHAL_CP6_SA_SIZE 576 /* size of state save area */
30#define XCHAL_CP6_SA_ALIGN 16 /* min alignment of save area */
31#define XCHAL_CP_ID_XAD 6 /* coprocessor ID (0..7) */
32
33/* Filler info for unassigned coprocessors, to simplify arrays etc: */
34#define XCHAL_CP1_SA_SIZE 0
35#define XCHAL_CP1_SA_ALIGN 1
36#define XCHAL_CP2_SA_SIZE 0
37#define XCHAL_CP2_SA_ALIGN 1
38#define XCHAL_CP3_SA_SIZE 0
39#define XCHAL_CP3_SA_ALIGN 1
40#define XCHAL_CP4_SA_SIZE 0
41#define XCHAL_CP4_SA_ALIGN 1
42#define XCHAL_CP5_SA_SIZE 0
43#define XCHAL_CP5_SA_ALIGN 1
44#define XCHAL_CP7_SA_SIZE 0
45#define XCHAL_CP7_SA_ALIGN 1
46
47/* Save area for non-coprocessor optional and custom (TIE) state: */
48#define XCHAL_NCP_SA_SIZE 4
49#define XCHAL_NCP_SA_ALIGN 4
50
51/* Total save area for optional and custom state (NCP + CPn): */
52#define XCHAL_TOTAL_SA_SIZE 672 /* with 16-byte align padding */
53#define XCHAL_TOTAL_SA_ALIGN 16 /* actual minimum alignment */
54
55/*
56 * Detailed contents of save areas.
57 * NOTE: caller must define the XCHAL_SA_REG macro (not defined here)
58 * before expanding the XCHAL_xxx_SA_LIST() macros.
59 *
60 * XCHAL_SA_REG(s,ccused,abikind,kind,opt,name,galign,align,asize,
61 * dbnum,base,regnum,bitsz,gapsz,reset,x...)
62 *
63 * s = passed from XCHAL_*_LIST(s), eg. to select how to expand
64 * ccused = set if used by compiler without special options or code
65 * abikind = 0 (caller-saved), 1 (callee-saved), or 2 (thread-global)
66 * kind = 0 (special reg), 1 (TIE user reg), or 2 (TIE regfile reg)
67 * opt = 0 (custom TIE extension or coprocessor), or 1 (optional reg)
68 * name = lowercase reg name (no quotes)
69 * galign = group byte alignment (power of 2) (galign >= align)
70 * align = register byte alignment (power of 2)
71 * asize = allocated size in bytes (asize*8 == bitsz + gapsz + padsz)
72 * (not including any pad bytes required to galign this or next reg)
73 * dbnum = unique target number f/debug (see <xtensa-libdb-macros.h>)
74 * base = reg shortname w/o index (or sr=special, ur=TIE user reg)
75 * regnum = reg index in regfile, or special/TIE-user reg number
76 * bitsz = number of significant bits (regfile width, or ur/sr mask bits)
77 * gapsz = intervening bits, if bitsz bits not stored contiguously
78 * (padsz = pad bits at end [TIE regfile] or at msbits [ur,sr] of asize)
79 * reset = register reset value (or 0 if undefined at reset)
80 * x = reserved for future use (0 until then)
81 *
82 * To filter out certain registers, e.g. to expand only the non-global
83 * registers used by the compiler, you can do something like this:
84 *
85 * #define XCHAL_SA_REG(s,ccused,p...) SELCC##ccused(p)
86 * #define SELCC0(p...)
87 * #define SELCC1(abikind,p...) SELAK##abikind(p)
88 * #define SELAK0(p...) REG(p)
89 * #define SELAK1(p...) REG(p)
90 * #define SELAK2(p...)
91 * #define REG(kind,tie,name,galn,aln,asz,csz,dbnum,base,rnum,bsz,rst,x...) \
92 * ...what you want to expand...
93 */
94
95#define XCHAL_NCP_SA_NUM 1
96#define XCHAL_NCP_SA_LIST(s) \
97 XCHAL_SA_REG(s,0,0,0,1, br, 4, 4, 4,0x0204, sr,4 , 16,0,0,0)
98
99#define XCHAL_CP0_SA_NUM 18
100#define XCHAL_CP0_SA_LIST(s) \
101 XCHAL_SA_REG(s,0,0,1,0, fcr, 4, 4, 4,0x03E8, ur,232, 32,0,0,0) \
102 XCHAL_SA_REG(s,0,0,1,0, fsr, 4, 4, 4,0x03E9, ur,233, 32,0,0,0) \
103 XCHAL_SA_REG(s,0,0,2,0, f0, 4, 4, 4,0x0030, f,0 , 32,0,0,0) \
104 XCHAL_SA_REG(s,0,0,2,0, f1, 4, 4, 4,0x0031, f,1 , 32,0,0,0) \
105 XCHAL_SA_REG(s,0,0,2,0, f2, 4, 4, 4,0x0032, f,2 , 32,0,0,0) \
106 XCHAL_SA_REG(s,0,0,2,0, f3, 4, 4, 4,0x0033, f,3 , 32,0,0,0) \
107 XCHAL_SA_REG(s,0,0,2,0, f4, 4, 4, 4,0x0034, f,4 , 32,0,0,0) \
108 XCHAL_SA_REG(s,0,0,2,0, f5, 4, 4, 4,0x0035, f,5 , 32,0,0,0) \
109 XCHAL_SA_REG(s,0,0,2,0, f6, 4, 4, 4,0x0036, f,6 , 32,0,0,0) \
110 XCHAL_SA_REG(s,0,0,2,0, f7, 4, 4, 4,0x0037, f,7 , 32,0,0,0) \
111 XCHAL_SA_REG(s,0,0,2,0, f8, 4, 4, 4,0x0038, f,8 , 32,0,0,0) \
112 XCHAL_SA_REG(s,0,0,2,0, f9, 4, 4, 4,0x0039, f,9 , 32,0,0,0) \
113 XCHAL_SA_REG(s,0,0,2,0, f10, 4, 4, 4,0x003A, f,10 , 32,0,0,0) \
114 XCHAL_SA_REG(s,0,0,2,0, f11, 4, 4, 4,0x003B, f,11 , 32,0,0,0) \
115 XCHAL_SA_REG(s,0,0,2,0, f12, 4, 4, 4,0x003C, f,12 , 32,0,0,0) \
116 XCHAL_SA_REG(s,0,0,2,0, f13, 4, 4, 4,0x003D, f,13 , 32,0,0,0) \
117 XCHAL_SA_REG(s,0,0,2,0, f14, 4, 4, 4,0x003E, f,14 , 32,0,0,0) \
118 XCHAL_SA_REG(s,0,0,2,0, f15, 4, 4, 4,0x003F, f,15 , 32,0,0,0)
119
120#define XCHAL_CP1_SA_NUM 0
121#define XCHAL_CP1_SA_LIST(s) /* empty */
122
123#define XCHAL_CP2_SA_NUM 0
124#define XCHAL_CP2_SA_LIST(s) /* empty */
125
126#define XCHAL_CP3_SA_NUM 0
127#define XCHAL_CP3_SA_LIST(s) /* empty */
128
129#define XCHAL_CP4_SA_NUM 0
130#define XCHAL_CP4_SA_LIST(s) /* empty */
131
132#define XCHAL_CP5_SA_NUM 0
133#define XCHAL_CP5_SA_LIST(s) /* empty */
134
135#define XCHAL_CP6_SA_NUM 46
136#define XCHAL_CP6_SA_LIST(s) \
137 XCHAL_SA_REG(s,0,0,1,0, ldcbhi,16, 4, 4,0x0300, ur,0 , 32,0,0,0) \
138 XCHAL_SA_REG(s,0,0,1,0, ldcblo, 4, 4, 4,0x0301, ur,1 , 32,0,0,0) \
139 XCHAL_SA_REG(s,0,0,1,0, stcbhi, 4, 4, 4,0x0302, ur,2 , 32,0,0,0) \
140 XCHAL_SA_REG(s,0,0,1,0, stcblo, 4, 4, 4,0x0303, ur,3 , 32,0,0,0) \
141 XCHAL_SA_REG(s,0,0,1,0, ldbrbase, 4, 4, 4,0x0308, ur,8 , 32,0,0,0) \
142 XCHAL_SA_REG(s,0,0,1,0, ldbroff, 4, 4, 4,0x0309, ur,9 , 32,0,0,0) \
143 XCHAL_SA_REG(s,0,0,1,0, ldbrinc, 4, 4, 4,0x030A, ur,10 , 32,0,0,0) \
144 XCHAL_SA_REG(s,0,0,1,0, stbrbase, 4, 4, 4,0x030B, ur,11 , 32,0,0,0) \
145 XCHAL_SA_REG(s,0,0,1,0, stbroff, 4, 4, 4,0x030C, ur,12 , 32,0,0,0) \
146 XCHAL_SA_REG(s,0,0,1,0, stbrinc, 4, 4, 4,0x030D, ur,13 , 32,0,0,0) \
147 XCHAL_SA_REG(s,0,0,1,0, scratch0, 4, 4, 4,0x0318, ur,24 , 32,0,0,0) \
148 XCHAL_SA_REG(s,0,0,1,0, scratch1, 4, 4, 4,0x0319, ur,25 , 32,0,0,0) \
149 XCHAL_SA_REG(s,0,0,1,0, scratch2, 4, 4, 4,0x031A, ur,26 , 32,0,0,0) \
150 XCHAL_SA_REG(s,0,0,1,0, scratch3, 4, 4, 4,0x031B, ur,27 , 32,0,0,0) \
151 XCHAL_SA_REG(s,0,0,2,0, wra0,16,16,16,0x1010, wra,0 ,128,0,0,0) \
152 XCHAL_SA_REG(s,0,0,2,0, wra1,16,16,16,0x1011, wra,1 ,128,0,0,0) \
153 XCHAL_SA_REG(s,0,0,2,0, wra2,16,16,16,0x1012, wra,2 ,128,0,0,0) \
154 XCHAL_SA_REG(s,0,0,2,0, wra3,16,16,16,0x1013, wra,3 ,128,0,0,0) \
155 XCHAL_SA_REG(s,0,0,2,0, wra4,16,16,16,0x1014, wra,4 ,128,0,0,0) \
156 XCHAL_SA_REG(s,0,0,2,0, wra5,16,16,16,0x1015, wra,5 ,128,0,0,0) \
157 XCHAL_SA_REG(s,0,0,2,0, wra6,16,16,16,0x1016, wra,6 ,128,0,0,0) \
158 XCHAL_SA_REG(s,0,0,2,0, wra7,16,16,16,0x1017, wra,7 ,128,0,0,0) \
159 XCHAL_SA_REG(s,0,0,2,0, wra8,16,16,16,0x1018, wra,8 ,128,0,0,0) \
160 XCHAL_SA_REG(s,0,0,2,0, wra9,16,16,16,0x1019, wra,9 ,128,0,0,0) \
161 XCHAL_SA_REG(s,0,0,2,0, wra10,16,16,16,0x101A, wra,10 ,128,0,0,0) \
162 XCHAL_SA_REG(s,0,0,2,0, wra11,16,16,16,0x101B, wra,11 ,128,0,0,0) \
163 XCHAL_SA_REG(s,0,0,2,0, wra12,16,16,16,0x101C, wra,12 ,128,0,0,0) \
164 XCHAL_SA_REG(s,0,0,2,0, wra13,16,16,16,0x101D, wra,13 ,128,0,0,0) \
165 XCHAL_SA_REG(s,0,0,2,0, wra14,16,16,16,0x101E, wra,14 ,128,0,0,0) \
166 XCHAL_SA_REG(s,0,0,2,0, wra15,16,16,16,0x101F, wra,15 ,128,0,0,0) \
167 XCHAL_SA_REG(s,0,0,2,0, wrb0,16,16,16,0x1020, wrb,0 ,128,0,0,0) \
168 XCHAL_SA_REG(s,0,0,2,0, wrb1,16,16,16,0x1021, wrb,1 ,128,0,0,0) \
169 XCHAL_SA_REG(s,0,0,2,0, wrb2,16,16,16,0x1022, wrb,2 ,128,0,0,0) \
170 XCHAL_SA_REG(s,0,0,2,0, wrb3,16,16,16,0x1023, wrb,3 ,128,0,0,0) \
171 XCHAL_SA_REG(s,0,0,2,0, wrb4,16,16,16,0x1024, wrb,4 ,128,0,0,0) \
172 XCHAL_SA_REG(s,0,0,2,0, wrb5,16,16,16,0x1025, wrb,5 ,128,0,0,0) \
173 XCHAL_SA_REG(s,0,0,2,0, wrb6,16,16,16,0x1026, wrb,6 ,128,0,0,0) \
174 XCHAL_SA_REG(s,0,0,2,0, wrb7,16,16,16,0x1027, wrb,7 ,128,0,0,0) \
175 XCHAL_SA_REG(s,0,0,2,0, wrb8,16,16,16,0x1028, wrb,8 ,128,0,0,0) \
176 XCHAL_SA_REG(s,0,0,2,0, wrb9,16,16,16,0x1029, wrb,9 ,128,0,0,0) \
177 XCHAL_SA_REG(s,0,0,2,0, wrb10,16,16,16,0x102A, wrb,10 ,128,0,0,0) \
178 XCHAL_SA_REG(s,0,0,2,0, wrb11,16,16,16,0x102B, wrb,11 ,128,0,0,0) \
179 XCHAL_SA_REG(s,0,0,2,0, wrb12,16,16,16,0x102C, wrb,12 ,128,0,0,0) \
180 XCHAL_SA_REG(s,0,0,2,0, wrb13,16,16,16,0x102D, wrb,13 ,128,0,0,0) \
181 XCHAL_SA_REG(s,0,0,2,0, wrb14,16,16,16,0x102E, wrb,14 ,128,0,0,0) \
182 XCHAL_SA_REG(s,0,0,2,0, wrb15,16,16,16,0x102F, wrb,15 ,128,0,0,0)
183
184#define XCHAL_CP7_SA_NUM 0
185#define XCHAL_CP7_SA_LIST(s) /* empty */
186
187/* Byte length of instruction from its first nibble (op0 field), per FLIX. */
188#define XCHAL_OP0_FORMAT_LENGTHS 3,3,3,3,3,3,3,3,2,2,2,2,2,2,8,8
189
190#endif /*_XTENSA_CORE_TIE_H*/
191
diff --git a/arch/xtensa/variants/s6000/irq.c b/arch/xtensa/variants/s6000/irq.c
new file mode 100644
index 000000000000..6651e3285fcf
--- /dev/null
+++ b/arch/xtensa/variants/s6000/irq.c
@@ -0,0 +1,74 @@
1/*
2 * s6000 irq crossbar
3 *
4 * Copyright (c) 2009 emlix GmbH
5 * Authors: Johannes Weiner <jw@emlix.com>
6 * Oskar Schirmer <os@emlix.com>
7 */
8#include <linux/io.h>
9#include <asm/irq.h>
10#include <variant/hardware.h>
11
12/* S6_REG_INTC */
13#define INTC_STATUS 0x000
14#define INTC_RAW 0x010
15#define INTC_STATUS_AG 0x100
16#define INTC_CFG(n) (0x200 + 4 * (n))
17
18/*
19 * The s6000 has a crossbar that multiplexes interrupt output lines
20 * from the peripherals to input lines on the xtensa core.
21 *
22 * We leave the mapping decisions to the platform as it depends on the
23 * actually connected peripherals which distribution makes sense.
24 */
25extern const signed char *platform_irq_mappings[NR_IRQS];
26
27static unsigned long scp_to_intc_enable[] = {
28#define TO_INTC_ENABLE(n) (((n) << 1) + 1)
29 TO_INTC_ENABLE(0),
30 TO_INTC_ENABLE(1),
31 TO_INTC_ENABLE(2),
32 TO_INTC_ENABLE(3),
33 TO_INTC_ENABLE(4),
34 TO_INTC_ENABLE(5),
35 TO_INTC_ENABLE(6),
36 TO_INTC_ENABLE(7),
37 TO_INTC_ENABLE(8),
38 TO_INTC_ENABLE(9),
39 TO_INTC_ENABLE(10),
40 TO_INTC_ENABLE(11),
41 TO_INTC_ENABLE(12),
42 -1,
43 -1,
44 TO_INTC_ENABLE(13),
45 -1,
46 TO_INTC_ENABLE(14),
47 -1,
48 TO_INTC_ENABLE(15),
49#undef TO_INTC_ENABLE
50};
51
52static void irq_set(unsigned int irq, int enable)
53{
54 unsigned long en;
55 const signed char *m = platform_irq_mappings[irq];
56
57 if (!m)
58 return;
59 en = enable ? scp_to_intc_enable[irq] : 0;
60 while (*m >= 0) {
61 writel(en, S6_REG_INTC + INTC_CFG(*m));
62 m++;
63 }
64}
65
66void variant_irq_enable(unsigned int irq)
67{
68 irq_set(irq, 1);
69}
70
71void variant_irq_disable(unsigned int irq)
72{
73 irq_set(irq, 0);
74}