Merge git://git.kernel.org/pub/scm/linux/kernel/git/dhowells/linux-2.6-mn10300
Linus Torvalds [Thu, 28 Oct 2010 01:53:26 +0000 (18:53 -0700)]
* git://git.kernel.org/pub/scm/linux/kernel/git/dhowells/linux-2.6-mn10300: (44 commits)
  MN10300: Save frame pointer in thread_info struct rather than global var
  MN10300: Change "Matsushita" to "Panasonic".
  MN10300: Create a defconfig for the ASB2364 board
  MN10300: Update the ASB2303 defconfig
  MN10300: ASB2364: Add support for SMSC911X and SMC911X
  MN10300: ASB2364: Handle the IRQ multiplexer in the FPGA
  MN10300: Generic time support
  MN10300: Specify an ELF HWCAP flag for MN10300 Atomic Operations Unit support
  MN10300: Map userspace atomic op regs as a vmalloc page
  MN10300: And Panasonic AM34 subarch and implement SMP
  MN10300: Delete idle_timestamp from irq_cpustat_t
  MN10300: Make various interrupt priority settings configurable
  MN10300: Optimise do_csum()
  MN10300: Implement atomic ops using atomic ops unit
  MN10300: Make the FPU operate in non-lazy mode under SMP
  MN10300: SMP TLB flushing
  MN10300: Use the [ID]PTEL2 registers rather than [ID]PTEL for TLB control
  MN10300: Make the use of PIDR to mark TLB entries controllable
  MN10300: Rename __flush_tlb*() to local_flush_tlb*()
  MN10300: AM34 erratum requires MMUCTR read and write on exception entry
  ...

393 files changed:
Documentation/accounting/getdelays.c
Documentation/cgroups/cgroups.txt
Documentation/feature-removal-schedule.txt
Documentation/filesystems/proc.txt
Documentation/networking/phy.txt
Documentation/sysctl/vm.txt
arch/alpha/kernel/pci_iommu.c
arch/alpha/kernel/ptrace.c
arch/arm/kernel/ptrace.c
arch/arm/mach-tegra/timer.c
arch/arm/mm/highmem.c
arch/arm/plat-nomadik/include/plat/ste_dma40.h
arch/avr32/kernel/ptrace.c
arch/blackfin/kernel/ptrace.c
arch/cris/arch-v10/kernel/ptrace.c
arch/cris/arch-v32/kernel/ptrace.c
arch/frv/kernel/ptrace.c
arch/frv/mm/highmem.c
arch/h8300/kernel/ptrace.c
arch/ia64/include/asm/cputime.h
arch/ia64/kernel/ptrace.c
arch/m32r/kernel/ptrace.c
arch/m68k/kernel/ptrace.c
arch/m68knommu/kernel/ptrace.c
arch/microblaze/kernel/ptrace.c
arch/mips/include/asm/pci/bridge.h
arch/mips/kernel/ptrace.c
arch/mips/mm/highmem.c
arch/mn10300/include/asm/highmem.h
arch/mn10300/kernel/ptrace.c
arch/parisc/kernel/ptrace.c
arch/powerpc/include/asm/cputime.h
arch/powerpc/kernel/ptrace.c
arch/powerpc/mm/highmem.c
arch/powerpc/sysdev/fsl_rio.c
arch/s390/include/asm/cputime.h
arch/s390/kernel/ptrace.c
arch/score/kernel/ptrace.c
arch/sh/kernel/ptrace_32.c
arch/sh/kernel/ptrace_64.c
arch/sparc/include/asm/io_32.h
arch/sparc/include/asm/io_64.h
arch/sparc/include/asm/pci_64.h
arch/sparc/kernel/ptrace_32.c
arch/sparc/kernel/ptrace_64.c
arch/sparc/mm/highmem.c
arch/tile/Kconfig
arch/tile/kernel/ptrace.c
arch/tile/kernel/setup.c
arch/tile/mm/highmem.c
arch/um/kernel/ptrace.c
arch/um/sys-i386/ptrace.c
arch/um/sys-x86_64/ptrace.c
arch/x86/Kconfig
arch/x86/include/asm/irq.h
arch/x86/include/asm/msr-index.h
arch/x86/include/asm/perf_event.h
arch/x86/include/asm/smp.h
arch/x86/kernel/cpu/perf_event.c
arch/x86/kernel/cpu/perf_event_intel_ds.c
arch/x86/kernel/dumpstack_32.c
arch/x86/kernel/dumpstack_64.c
arch/x86/kernel/irq_32.c
arch/x86/kernel/ptrace.c
arch/x86/kernel/reboot.c
arch/x86/kernel/smp.c
arch/x86/kernel/smpboot.c
arch/x86/mm/highmem_32.c
arch/x86/mm/init_64.c
arch/x86/mm/iomap_32.c
arch/x86/oprofile/nmi_int.c
arch/x86/oprofile/op_model_amd.c
arch/x86/xen/enlighten.c
arch/x86/xen/smp.c
arch/xtensa/kernel/ptrace.c
drivers/atm/eni.c
drivers/char/applicom.c
drivers/char/hvc_console.c
drivers/char/ip2/Makefile
drivers/char/ipmi/Makefile
drivers/char/ipmi/ipmi_devintf.c
drivers/char/ipmi/ipmi_msghandler.c
drivers/char/ipmi/ipmi_si_intf.c
drivers/char/mmtimer.c
drivers/char/mwave/Makefile
drivers/char/mxser.c
drivers/char/pcmcia/ipwireless/Makefile
drivers/char/ppdev.c
drivers/char/ramoops.c
drivers/char/rio/Makefile
drivers/char/rocket.c
drivers/char/synclink_gt.c
drivers/char/vt_ioctl.c
drivers/connector/cn_queue.c
drivers/connector/connector.c
drivers/dma/pch_dma.c
drivers/firmware/dmi_scan.c
drivers/gpio/74x164.c [new file with mode: 0644]
drivers/gpio/Kconfig
drivers/gpio/Makefile
drivers/gpio/adp5588-gpio.c
drivers/gpio/basic_mmio_gpio.c [new file with mode: 0644]
drivers/gpio/langwell_gpio.c
drivers/gpio/pch_gpio.c [new file with mode: 0644]
drivers/gpio/timbgpio.c
drivers/i2c/busses/scx200_acb.c
drivers/isdn/hardware/mISDN/mISDNinfineon.c
drivers/isdn/hisax/l3_1tr6.c
drivers/media/IR/lirc_dev.c
drivers/net/atl1c/atl1c.h
drivers/net/atl1c/atl1c_main.c
drivers/net/atlx/atl1.c
drivers/net/atlx/atl1.h
drivers/net/atlx/atlx.c
drivers/net/benet/be_cmds.c
drivers/net/benet/be_cmds.h
drivers/net/benet/be_main.c
drivers/net/bnx2x/bnx2x.h
drivers/net/bnx2x/bnx2x_cmn.c
drivers/net/bnx2x/bnx2x_cmn.h
drivers/net/bnx2x/bnx2x_init_ops.h
drivers/net/bnx2x/bnx2x_link.c
drivers/net/bnx2x/bnx2x_link.h
drivers/net/bnx2x/bnx2x_main.c
drivers/net/bonding/bond_main.c
drivers/net/caif/Kconfig
drivers/net/caif/Makefile
drivers/net/caif/caif_shm_u5500.c [new file with mode: 0644]
drivers/net/caif/caif_shmcore.c [new file with mode: 0644]
drivers/net/can/Kconfig
drivers/net/can/Makefile
drivers/net/can/at91_can.c
drivers/net/can/flexcan.c
drivers/net/can/mcp251x.c
drivers/net/can/pch_can.c [new file with mode: 0644]
drivers/net/can/sja1000/Kconfig
drivers/net/can/sja1000/Makefile
drivers/net/can/sja1000/tscan1.c [new file with mode: 0644]
drivers/net/cxgb3/cxgb3_main.c
drivers/net/cxgb4/cxgb4.h
drivers/net/cxgb4/cxgb4_main.c
drivers/net/cxgb4/sge.c
drivers/net/e1000/e1000_main.c
drivers/net/ehea/ehea.h
drivers/net/ehea/ehea_main.c
drivers/net/gianfar.c
drivers/net/jme.c
drivers/net/macb.c
drivers/net/mlx4/icm.c
drivers/net/mlx4/icm.h
drivers/net/mlx4/port.c
drivers/net/phy/phy.c
drivers/net/phy/phy_device.c
drivers/net/qlcnic/qlcnic.h
drivers/net/qlcnic/qlcnic_ethtool.c
drivers/net/qlcnic/qlcnic_main.c
drivers/net/qlge/qlge.h
drivers/net/qlge/qlge_main.c
drivers/net/qlge/qlge_mpi.c
drivers/net/sb1000.c
drivers/net/sgiseeq.c
drivers/net/slhc.c
drivers/net/tg3.c
drivers/net/tokenring/tms380tr.c
drivers/net/typhoon.c
drivers/net/vmxnet3/upt1_defs.h
drivers/net/vmxnet3/vmxnet3_defs.h
drivers/net/vmxnet3/vmxnet3_drv.c
drivers/net/vmxnet3/vmxnet3_ethtool.c
drivers/net/vmxnet3/vmxnet3_int.h
drivers/net/vxge/vxge-config.c
drivers/net/vxge/vxge-config.h
drivers/net/vxge/vxge-ethtool.c
drivers/net/vxge/vxge-main.c
drivers/net/vxge/vxge-main.h
drivers/net/vxge/vxge-traffic.c
drivers/net/vxge/vxge-traffic.h
drivers/net/wireless/ath/ath5k/base.c
drivers/net/wireless/ath/ath9k/ar9003_2p2_initvals.h
drivers/net/wireless/ath/ath9k/ar9003_paprd.c
drivers/net/wireless/ath/ath9k/beacon.c
drivers/net/wireless/ath/ath9k/init.c
drivers/net/wireless/ath/ath9k/main.c
drivers/net/wireless/ath/ath9k/xmit.c
drivers/net/wireless/ath/carl9170/cmd.h
drivers/net/wireless/ath/carl9170/main.c
drivers/net/wireless/ath/carl9170/usb.c
drivers/net/wireless/b43/phy_n.c
drivers/net/wireless/iwlwifi/iwl-agn-tx.c
drivers/net/wireless/wl1251/Makefile
drivers/pci/proc.c
drivers/platform/x86/intel_pmic_gpio.c
drivers/rapidio/rio-driver.c
drivers/rapidio/rio-scan.c
drivers/rapidio/rio-sysfs.c
drivers/rapidio/rio.c
drivers/rapidio/rio.h
drivers/rapidio/switches/Kconfig
drivers/rapidio/switches/Makefile
drivers/rapidio/switches/idt_gen2.c [new file with mode: 0644]
drivers/rapidio/switches/idtcps.c
drivers/rapidio/switches/tsi568.c
drivers/rapidio/switches/tsi57x.c
drivers/rtc/Kconfig
drivers/rtc/Makefile
drivers/rtc/class.c
drivers/rtc/rtc-bfin.c
drivers/rtc/rtc-ds3232.c
drivers/rtc/rtc-jz4740.c
drivers/rtc/rtc-lpc32xx.c [new file with mode: 0644]
drivers/rtc/rtc-omap.c
drivers/rtc/rtc-s3c.c
drivers/video/fbmem.c
drivers/video/gbefb.c
drivers/video/matrox/matroxfb_DAC1064.c
drivers/video/matrox/matroxfb_maven.c
drivers/video/omap/blizzard.c
drivers/video/savage/savagefb-i2c.c
drivers/w1/w1.c
fs/Kconfig
fs/Kconfig.binfmt
fs/eventpoll.c
fs/exec.c
fs/fcntl.c
fs/fuse/dev.c
fs/isofs/inode.c
fs/lockd/svc.c
fs/lockd/svclock.c
fs/lockd/svcsubs.c
fs/locks.c
fs/nfs/Kconfig
fs/nfsd/Kconfig
fs/nfsd/nfs4state.c
fs/proc/base.c
fs/proc/softirqs.c
fs/proc/stat.c
fs/proc/task_mmu.c
fs/select.c
include/asm-generic/cputime.h
include/asm-generic/gpio.h
include/linux/basic_mmio_gpio.h [new file with mode: 0644]
include/linux/cgroup.h
include/linux/connector.h
include/linux/fb.h
include/linux/fs.h
include/linux/highmem.h
include/linux/i2c/adp5588.h
include/linux/init_task.h
include/linux/interrupt.h
include/linux/kernel_stat.h
include/linux/kfifo.h
include/linux/netdevice.h
include/linux/percpu-defs.h
include/linux/phy.h
include/linux/poll.h
include/linux/ptrace.h
include/linux/ramoops.h [new file with mode: 0644]
include/linux/ring_buffer.h
include/linux/rio.h
include/linux/rio_ids.h
include/linux/rio_regs.h
include/linux/sched.h
include/linux/spi/74x164.h [new file with mode: 0644]
include/linux/synclink.h
include/linux/syscalls.h
include/linux/tracehook.h
include/linux/virtio_9p.h
include/net/caif/caif_shm.h [new file with mode: 0644]
include/net/dst.h
include/net/fib_rules.h
include/net/garp.h
include/net/inetpeer.h
include/net/ip.h
include/net/ip6_tunnel.h
include/net/ipip.h
include/net/net_namespace.h
include/net/protocol.h
include/net/sock.h
include/net/xfrm.h
include/trace/events/irq.h
init/Kconfig
ipc/compat.c
ipc/compat_mq.c
ipc/shm.c
kernel/cgroup.c
kernel/cgroup_freezer.c
kernel/cred.c
kernel/exit.c
kernel/fork.c
kernel/irq/irqdesc.c
kernel/kprobes.c
kernel/module.c
kernel/ns_cgroup.c
kernel/perf_event.c
kernel/ptrace.c
kernel/resource.c
kernel/signal.c
kernel/softirq.c
kernel/taskstats.c
kernel/trace/ring_buffer.c
kernel/trace/trace.c
kernel/trace/trace_kprobe.c
kernel/tsacct.c
mm/highmem.c
mm/memcontrol.c
mm/swap.c
net/802/garp.c
net/802/stp.c
net/8021q/vlan.c
net/core/dev.c
net/core/fib_rules.c
net/core/filter.c
net/core/net-sysfs.c
net/core/net_namespace.c
net/core/pktgen.c
net/core/sock.c
net/core/sysctl_net_core.c
net/ipv4/fib_hash.c
net/ipv4/gre.c
net/ipv4/inetpeer.c
net/ipv4/ip_gre.c
net/ipv4/ip_sockglue.c
net/ipv4/ipip.c
net/ipv4/protocol.c
net/ipv4/route.c
net/ipv4/tunnel4.c
net/ipv4/udp.c
net/ipv6/addrconf.c
net/ipv6/ip6_tunnel.c
net/ipv6/ipv6_sockglue.c
net/ipv6/netfilter/Kconfig
net/ipv6/netfilter/Makefile
net/ipv6/netfilter/nf_conntrack_reasm.c
net/ipv6/protocol.c
net/ipv6/raw.c
net/ipv6/sit.c
net/ipv6/tunnel6.c
net/ipv6/udp.c
net/l2tp/l2tp_core.c
net/l2tp/l2tp_core.h
net/l2tp/l2tp_ip.c
net/mac80211/ibss.c
net/mac80211/main.c
net/mac80211/rate.c
net/netfilter/Kconfig
net/netfilter/xt_TPROXY.c
net/netfilter/xt_socket.c
net/netlink/af_netlink.c
net/wireless/reg.c
sound/oss/sb_ess.c
sound/pci/hda/patch_sigmatel.c
sound/soc/codecs/ad73311.c
sound/soc/codecs/max98088.c
sound/soc/codecs/wm9090.c
sound/soc/fsl/pcm030-audio-fabric.c
sound/usb/card.h
sound/usb/pcm.c
sound/usb/proc.c
sound/usb/urb.c
tools/perf/Documentation/perf-list.txt
tools/perf/Documentation/perf-probe.txt
tools/perf/Documentation/perf-record.txt
tools/perf/builtin-probe.c
tools/perf/builtin-record.c
tools/perf/builtin-trace.c
tools/perf/scripts/perl/bin/failed-syscalls-report
tools/perf/scripts/perl/bin/rw-by-file-report
tools/perf/scripts/perl/bin/rw-by-pid-report
tools/perf/scripts/perl/bin/rwtop-report
tools/perf/scripts/perl/bin/wakeup-latency-report
tools/perf/scripts/perl/bin/workqueue-stats-report
tools/perf/scripts/python/Perf-Trace-Util/lib/Perf/Trace/Util.py
tools/perf/scripts/python/bin/failed-syscalls-by-pid-report
tools/perf/scripts/python/bin/futex-contention-record [new file with mode: 0644]
tools/perf/scripts/python/bin/futex-contention-report [new file with mode: 0644]
tools/perf/scripts/python/bin/netdev-times-report
tools/perf/scripts/python/bin/sched-migration-report
tools/perf/scripts/python/bin/sctop-report
tools/perf/scripts/python/bin/syscall-counts-by-pid-report
tools/perf/scripts/python/bin/syscall-counts-report
tools/perf/scripts/python/failed-syscalls-by-pid.py
tools/perf/scripts/python/futex-contention.py [new file with mode: 0644]
tools/perf/scripts/python/sctop.py
tools/perf/scripts/python/syscall-counts-by-pid.py
tools/perf/scripts/python/syscall-counts.py
tools/perf/util/debug.c
tools/perf/util/debug.h
tools/perf/util/map.h
tools/perf/util/probe-event.c
tools/perf/util/probe-event.h
tools/perf/util/probe-finder.c
tools/perf/util/probe-finder.h
tools/perf/util/ui/browser.c

index 6e25c26..a2976a6 100644 (file)
@@ -21,6 +21,7 @@
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <sys/socket.h>
+#include <sys/wait.h>
 #include <signal.h>
 
 #include <linux/genetlink.h>
@@ -266,11 +267,13 @@ int main(int argc, char *argv[])
        int containerset = 0;
        char containerpath[1024];
        int cfd = 0;
+       int forking = 0;
+       sigset_t sigset;
 
        struct msgtemplate msg;
 
-       while (1) {
-               c = getopt(argc, argv, "qdiw:r:m:t:p:vlC:");
+       while (!forking) {
+               c = getopt(argc, argv, "qdiw:r:m:t:p:vlC:c:");
                if (c < 0)
                        break;
 
@@ -319,6 +322,28 @@ int main(int argc, char *argv[])
                                err(1, "Invalid pid\n");
                        cmd_type = TASKSTATS_CMD_ATTR_PID;
                        break;
+               case 'c':
+
+                       /* Block SIGCHLD for sigwait() later */
+                       if (sigemptyset(&sigset) == -1)
+                               err(1, "Failed to empty sigset");
+                       if (sigaddset(&sigset, SIGCHLD))
+                               err(1, "Failed to set sigchld in sigset");
+                       sigprocmask(SIG_BLOCK, &sigset, NULL);
+
+                       /* fork/exec a child */
+                       tid = fork();
+                       if (tid < 0)
+                               err(1, "Fork failed\n");
+                       if (tid == 0)
+                               if (execvp(argv[optind - 1],
+                                   &argv[optind - 1]) < 0)
+                                       exit(-1);
+
+                       /* Set the command type and avoid further processing */
+                       cmd_type = TASKSTATS_CMD_ATTR_PID;
+                       forking = 1;
+                       break;
                case 'v':
                        printf("debug on\n");
                        dbg = 1;
@@ -370,6 +395,15 @@ int main(int argc, char *argv[])
                goto err;
        }
 
+       /*
+        * If we forked a child, wait for it to exit. Cannot use waitpid()
+        * as all the delicious data would be reaped as part of the wait
+        */
+       if (tid && forking) {
+               int sig_received;
+               sigwait(&sigset, &sig_received);
+       }
+
        if (tid) {
                rc = send_cmd(nl_sd, id, mypid, TASKSTATS_CMD_GET,
                              cmd_type, &tid, sizeof(__u32));
index b34823f..190018b 100644 (file)
@@ -18,7 +18,8 @@ CONTENTS:
   1.2 Why are cgroups needed ?
   1.3 How are cgroups implemented ?
   1.4 What does notify_on_release do ?
-  1.5 How do I use cgroups ?
+  1.5 What does clone_children do ?
+  1.6 How do I use cgroups ?
 2. Usage Examples and Syntax
   2.1 Basic Usage
   2.2 Attaching processes
@@ -293,7 +294,16 @@ notify_on_release in the root cgroup at system boot is disabled
 value of their parents notify_on_release setting. The default value of
 a cgroup hierarchy's release_agent path is empty.
 
-1.5 How do I use cgroups ?
+1.5 What does clone_children do ?
+---------------------------------
+
+If the clone_children flag is enabled (1) in a cgroup, then all
+cgroups created beneath will call the post_clone callbacks for each
+subsystem of the newly created cgroup. Usually when this callback is
+implemented for a subsystem, it copies the values of the parent
+subsystem, this is the case for the cpuset.
+
+1.6 How do I use cgroups ?
 --------------------------
 
 To start a new job that is to be contained within a cgroup, using
index d2af87b..f3da8c0 100644 (file)
@@ -526,6 +526,23 @@ Who:       FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
 
 ----------------------------
 
+What:   namespace cgroup (ns_cgroup)
+When:   2.6.38
+Why:    The ns_cgroup leads to some problems:
+       * cgroup creation is out-of-control
+       * cgroup name can conflict when pids are looping
+       * it is not possible to have a single process handling
+       a lot of namespaces without falling in a exponential creation time
+       * we may want to create a namespace without creating a cgroup
+
+       The ns_cgroup is replaced by a compatibility flag 'clone_children',
+       where a newly created cgroup will copy the parent cgroup values.
+       The userspace has to manually create a cgroup and add a task to
+       the 'tasks' file.
+Who:    Daniel Lezcano <daniel.lezcano@free.fr>
+
+----------------------------
+
 What:  iwlwifi disable_hw_scan module parameters
 When:  2.6.40
 Why:   Hareware scan is the prefer method for iwlwifi devices for
index a563b74..e73df27 100644 (file)
@@ -136,6 +136,7 @@ Table 1-1: Process specific entries in /proc
  statm         Process memory status information
  status                Process status in human readable form
  wchan         If CONFIG_KALLSYMS is set, a pre-decoded wchan
+ pagemap       Page table
  stack         Report full stack trace, enable via CONFIG_STACKTRACE
  smaps         a extension based on maps, showing the memory consumption of
                each mapping
@@ -370,6 +371,7 @@ Shared_Dirty:          0 kB
 Private_Clean:         0 kB
 Private_Dirty:         0 kB
 Referenced:          892 kB
+Anonymous:             0 kB
 Swap:                  0 kB
 KernelPageSize:        4 kB
 MMUPageSize:           4 kB
@@ -378,9 +380,15 @@ The first of these lines shows the same information as is displayed for the
 mapping in /proc/PID/maps.  The remaining lines show the size of the mapping
 (size), the amount of the mapping that is currently resident in RAM (RSS), the
 process' proportional share of this mapping (PSS), the number of clean and
-dirty shared pages in the mapping, and the number of clean and dirty private
-pages in the mapping.  The "Referenced" indicates the amount of memory
-currently marked as referenced or accessed.
+dirty private pages in the mapping.  Note that even a page which is part of a
+MAP_SHARED mapping, but has only a single pte mapped, i.e.  is currently used
+by only one process, is accounted as private and not as shared.  "Referenced"
+indicates the amount of memory currently marked as referenced or accessed.
+"Anonymous" shows the amount of memory that does not belong to any file.  Even
+a mapping associated with a file may contain anonymous pages: when MAP_PRIVATE
+and a page is modified, the file page is replaced by a private anonymous copy.
+"Swap" shows how much would-be-anonymous memory is also used, but out on
+swap.
 
 This file is only present if the CONFIG_MMU kernel configuration option is
 enabled.
@@ -397,6 +405,9 @@ To clear the bits for the file mapped pages associated with the process
     > echo 3 > /proc/PID/clear_refs
 Any other value written to /proc/PID/clear_refs will have no effect.
 
+The /proc/pid/pagemap gives the PFN, which can be used to find the pageflags
+using /proc/kpageflags and number of times a page is mapped using
+/proc/kpagecount. For detailed explanation, see Documentation/vm/pagemap.txt.
 
 1.2 Kernel data
 ---------------
index 88bb71b..9eb1ba5 100644 (file)
@@ -177,18 +177,6 @@ Doing it all yourself
  
    A convenience function to print out the PHY status neatly.
 
- int phy_clear_interrupt(struct phy_device *phydev);
- int phy_config_interrupt(struct phy_device *phydev, u32 interrupts);
-   
-   Clear the PHY's interrupt, and configure which ones are allowed,
-   respectively.  Currently only supports all on, or all off.
- int phy_enable_interrupts(struct phy_device *phydev);
- int phy_disable_interrupts(struct phy_device *phydev);
-
-   Functions which enable/disable PHY interrupts, clearing them
-   before and after, respectively.
-
  int phy_start_interrupts(struct phy_device *phydev);
  int phy_stop_interrupts(struct phy_device *phydev);
 
@@ -213,12 +201,6 @@ Doing it all yourself
    Fills the phydev structure with up-to-date information about the current
    settings in the PHY.
 
- void phy_sanitize_settings(struct phy_device *phydev)
-   
-   Resolves differences between currently desired settings, and
-   supported settings for the given PHY device.  Does not make
-   the changes in the hardware, though.
-
  int phy_ethtool_sset(struct phy_device *phydev, struct ethtool_cmd *cmd);
  int phy_ethtool_gset(struct phy_device *phydev, struct ethtool_cmd *cmd);
 
index b606c2c..30289fa 100644 (file)
@@ -80,8 +80,10 @@ dirty_background_bytes
 Contains the amount of dirty memory at which the pdflush background writeback
 daemon will start writeback.
 
-If dirty_background_bytes is written, dirty_background_ratio becomes a function
-of its value (dirty_background_bytes / the amount of dirtyable system memory).
+Note: dirty_background_bytes is the counterpart of dirty_background_ratio. Only
+one of them may be specified at a time. When one sysctl is written it is
+immediately taken into account to evaluate the dirty memory limits and the
+other appears as 0 when read.
 
 ==============================================================
 
@@ -97,8 +99,10 @@ dirty_bytes
 Contains the amount of dirty memory at which a process generating disk writes
 will itself start writeback.
 
-If dirty_bytes is written, dirty_ratio becomes a function of its value
-(dirty_bytes / the amount of dirtyable system memory).
+Note: dirty_bytes is the counterpart of dirty_ratio. Only one of them may be
+specified at a time. When one sysctl is written it is immediately taken into
+account to evaluate the dirty memory limits and the other appears as 0 when
+read.
 
 Note: the minimum value allowed for dirty_bytes is two pages (in bytes); any
 value lower than this limit will be ignored and the old configuration will be
index d1dbd9a..022c274 100644 (file)
@@ -223,7 +223,7 @@ iommu_arena_free(struct pci_iommu_arena *arena, long ofs, long n)
  */
 static int pci_dac_dma_supported(struct pci_dev *dev, u64 mask)
 {
-       dma64_addr_t dac_offset = alpha_mv.pci_dac_offset;
+       dma_addr_t dac_offset = alpha_mv.pci_dac_offset;
        int ok = 1;
 
        /* If this is not set, the machine doesn't support DAC at all.  */
@@ -756,7 +756,7 @@ static void alpha_pci_unmap_sg(struct device *dev, struct scatterlist *sg,
        spin_lock_irqsave(&arena->lock, flags);
 
        for (end = sg + nents; sg < end; ++sg) {
-               dma64_addr_t addr;
+               dma_addr_t addr;
                size_t size;
                long npages, ofs;
                dma_addr_t tend;
index baa9036..e2af5eb 100644 (file)
@@ -269,7 +269,8 @@ void ptrace_disable(struct task_struct *child)
        user_disable_single_step(child);
 }
 
-long arch_ptrace(struct task_struct *child, long request, long addr, long data)
+long arch_ptrace(struct task_struct *child, long request,
+                unsigned long addr, unsigned long data)
 {
        unsigned long tmp;
        size_t copied;
@@ -292,7 +293,7 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
        case PTRACE_PEEKUSR:
                force_successful_syscall_return();
                ret = get_reg(child, addr);
-               DBG(DBG_MEM, ("peek $%ld->%#lx\n", addr, ret));
+               DBG(DBG_MEM, ("peek $%lu->%#lx\n", addr, ret));
                break;
 
        /* When I and D space are separate, this will have to be fixed.  */
@@ -302,7 +303,7 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
                break;
 
        case PTRACE_POKEUSR: /* write the specified register */
-               DBG(DBG_MEM, ("poke $%ld<-%#lx\n", addr, data));
+               DBG(DBG_MEM, ("poke $%lu<-%#lx\n", addr, data));
                ret = put_reg(child, addr, data);
                break;
        default:
index e0cb637..3e97483 100644 (file)
@@ -1075,13 +1075,15 @@ out:
 }
 #endif
 
-long arch_ptrace(struct task_struct *child, long request, long addr, long data)
+long arch_ptrace(struct task_struct *child, long request,
+                unsigned long addr, unsigned long data)
 {
        int ret;
+       unsigned long __user *datap = (unsigned long __user *) data;
 
        switch (request) {
                case PTRACE_PEEKUSR:
-                       ret = ptrace_read_user(child, addr, (unsigned long __user *)data);
+                       ret = ptrace_read_user(child, addr, datap);
                        break;
 
                case PTRACE_POKEUSR:
@@ -1089,34 +1091,34 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
                        break;
 
                case PTRACE_GETREGS:
-                       ret = ptrace_getregs(child, (void __user *)data);
+                       ret = ptrace_getregs(child, datap);
                        break;
 
                case PTRACE_SETREGS:
-                       ret = ptrace_setregs(child, (void __user *)data);
+                       ret = ptrace_setregs(child, datap);
                        break;
 
                case PTRACE_GETFPREGS:
-                       ret = ptrace_getfpregs(child, (void __user *)data);
+                       ret = ptrace_getfpregs(child, datap);
                        break;
                
                case PTRACE_SETFPREGS:
-                       ret = ptrace_setfpregs(child, (void __user *)data);
+                       ret = ptrace_setfpregs(child, datap);
                        break;
 
 #ifdef CONFIG_IWMMXT
                case PTRACE_GETWMMXREGS:
-                       ret = ptrace_getwmmxregs(child, (void __user *)data);
+                       ret = ptrace_getwmmxregs(child, datap);
                        break;
 
                case PTRACE_SETWMMXREGS:
-                       ret = ptrace_setwmmxregs(child, (void __user *)data);
+                       ret = ptrace_setwmmxregs(child, datap);
                        break;
 #endif
 
                case PTRACE_GET_THREAD_AREA:
                        ret = put_user(task_thread_info(child)->tp_value,
-                                      (unsigned long __user *) data);
+                                      datap);
                        break;
 
                case PTRACE_SET_SYSCALL:
@@ -1126,21 +1128,21 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
 
 #ifdef CONFIG_CRUNCH
                case PTRACE_GETCRUNCHREGS:
-                       ret = ptrace_getcrunchregs(child, (void __user *)data);
+                       ret = ptrace_getcrunchregs(child, datap);
                        break;
 
                case PTRACE_SETCRUNCHREGS:
-                       ret = ptrace_setcrunchregs(child, (void __user *)data);
+                       ret = ptrace_setcrunchregs(child, datap);
                        break;
 #endif
 
 #ifdef CONFIG_VFP
                case PTRACE_GETVFPREGS:
-                       ret = ptrace_getvfpregs(child, (void __user *)data);
+                       ret = ptrace_getvfpregs(child, datap);
                        break;
 
                case PTRACE_SETVFPREGS:
-                       ret = ptrace_setvfpregs(child, (void __user *)data);
+                       ret = ptrace_setvfpregs(child, datap);
                        break;
 #endif
 
index 2f42021..9057d6f 100644 (file)
@@ -28,7 +28,6 @@
 #include <linux/cnt32_to_63.h>
 
 #include <asm/mach/time.h>
-#include <asm/mach/time.h>
 #include <asm/localtimer.h>
 
 #include <mach/iomap.h>
index c00f119..c435fd9 100644 (file)
@@ -89,7 +89,7 @@ void __kunmap_atomic(void *kvaddr)
        int idx, type;
 
        if (kvaddr >= (void *)FIXADDR_START) {
-               type = kmap_atomic_idx_pop();
+               type = kmap_atomic_idx();
                idx = type + KM_TYPE_NR * smp_processor_id();
 
                if (cache_is_vivt())
@@ -101,6 +101,7 @@ void __kunmap_atomic(void *kvaddr)
 #else
                (void) idx;  /* to kill a warning */
 #endif
+               kmap_atomic_idx_pop();
        } else if (vaddr >= PKMAP_ADDR(0) && vaddr < PKMAP_ADDR(LAST_PKMAP)) {
                /* this address was obtained through kmap_high_get() */
                kunmap_high(pte_page(pkmap_page_table[PKMAP_NR(vaddr)]));
index 5fbde4b..93a8126 100644 (file)
@@ -14,7 +14,6 @@
 #include <linux/dmaengine.h>
 #include <linux/workqueue.h>
 #include <linux/interrupt.h>
-#include <linux/dmaengine.h>
 
 /* dev types for memcpy */
 #define STEDMA40_DEV_DST_MEMORY (-1)
index 5e73c25..4aedcab 100644 (file)
@@ -146,9 +146,11 @@ static int ptrace_setregs(struct task_struct *tsk, const void __user *uregs)
        return ret;
 }
 
-long arch_ptrace(struct task_struct *child, long request, long addr, long data)
+long arch_ptrace(struct task_struct *child, long request,
+                unsigned long addr, unsigned long data)
 {
        int ret;
+       void __user *datap = (void __user *) data;
 
        switch (request) {
        /* Read the word at location addr in the child process */
@@ -158,8 +160,7 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
                break;
 
        case PTRACE_PEEKUSR:
-               ret = ptrace_read_user(child, addr,
-                                      (unsigned long __user *)data);
+               ret = ptrace_read_user(child, addr, datap);
                break;
 
        /* Write the word in data at location addr */
@@ -173,11 +174,11 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
                break;
 
        case PTRACE_GETREGS:
-               ret = ptrace_getregs(child, (void __user *)data);
+               ret = ptrace_getregs(child, datap);
                break;
 
        case PTRACE_SETREGS:
-               ret = ptrace_setregs(child, (const void __user *)data);
+               ret = ptrace_setregs(child, datap);
                break;
 
        default:
index b358393..75089f8 100644 (file)
  * Get contents of register REGNO in task TASK.
  */
 static inline long
-get_reg(struct task_struct *task, long regno, unsigned long __user *datap)
+get_reg(struct task_struct *task, unsigned long regno,
+       unsigned long __user *datap)
 {
        long tmp;
        struct pt_regs *regs = task_pt_regs(task);
 
-       if (regno & 3 || regno > PT_LAST_PSEUDO || regno < 0)
+       if (regno & 3 || regno > PT_LAST_PSEUDO)
                return -EIO;
 
        switch (regno) {
@@ -74,11 +75,11 @@ get_reg(struct task_struct *task, long regno, unsigned long __user *datap)
  * Write contents of register REGNO in task TASK.
  */
 static inline int
-put_reg(struct task_struct *task, long regno, unsigned long data)
+put_reg(struct task_struct *task, unsigned long regno, unsigned long data)
 {
        struct pt_regs *regs = task_pt_regs(task);
 
-       if (regno & 3 || regno > PT_LAST_PSEUDO || regno < 0)
+       if (regno & 3 || regno > PT_LAST_PSEUDO)
                return -EIO;
 
        switch (regno) {
@@ -240,7 +241,8 @@ void user_disable_single_step(struct task_struct *child)
        clear_tsk_thread_flag(child, TIF_SINGLESTEP);
 }
 
-long arch_ptrace(struct task_struct *child, long request, long addr, long data)
+long arch_ptrace(struct task_struct *child, long request,
+                unsigned long addr, unsigned long data)
 {
        int ret;
        unsigned long __user *datap = (unsigned long __user *)data;
@@ -368,14 +370,14 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
                return copy_regset_to_user(child, &user_bfin_native_view,
                                           REGSET_GENERAL,
                                           0, sizeof(struct pt_regs),
-                                          (void __user *)data);
+                                          datap);
 
        case PTRACE_SETREGS:
                pr_debug("ptrace: PTRACE_SETREGS\n");
                return copy_regset_from_user(child, &user_bfin_native_view,
                                             REGSET_GENERAL,
                                             0, sizeof(struct pt_regs),
-                                            (const void __user *)data);
+                                            datap);
 
        case_default:
        default:
index e70c804..320065f 100644 (file)
@@ -76,9 +76,11 @@ ptrace_disable(struct task_struct *child)
  * (in user space) where the result of the ptrace call is written (instead of
  * being returned).
  */
-long arch_ptrace(struct task_struct *child, long request, long addr, long data)
+long arch_ptrace(struct task_struct *child, long request,
+                unsigned long addr, unsigned long data)
 {
        int ret;
+       unsigned int regno = addr >> 2;
        unsigned long __user *datap = (unsigned long __user *)data;
 
        switch (request) {
@@ -93,10 +95,10 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
                        unsigned long tmp;
 
                        ret = -EIO;
-                       if ((addr & 3) || addr < 0 || addr > PT_MAX << 2)
+                       if ((addr & 3) || regno > PT_MAX)
                                break;
 
-                       tmp = get_reg(child, addr >> 2);
+                       tmp = get_reg(child, regno);
                        ret = put_user(tmp, datap);
                        break;
                }
@@ -110,19 +112,17 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
                /* Write the word at location address in the USER area. */
                case PTRACE_POKEUSR:
                        ret = -EIO;
-                       if ((addr & 3) || addr < 0 || addr > PT_MAX << 2)
+                       if ((addr & 3) || regno > PT_MAX)
                                break;
 
-                       addr >>= 2;
-
-                       if (addr == PT_DCCR) {
+                       if (regno == PT_DCCR) {
                                /* don't allow the tracing process to change stuff like
                                 * interrupt enable, kernel/user bit, dma enables etc.
                                 */
                                data &= DCCR_MASK;
                                data |= get_reg(child, PT_DCCR) & ~DCCR_MASK;
                        }
-                       if (put_reg(child, addr, data))
+                       if (put_reg(child, regno, data))
                                break;
                        ret = 0;
                        break;
@@ -141,7 +141,7 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
                                        break;
                                }
                                
-                               data += sizeof(long);
+                               datap++;
                        }
 
                        break;
@@ -165,7 +165,7 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
                                }
                                
                                put_reg(child, i, tmp);
-                               data += sizeof(long);
+                               datap++;
                        }
                        
                        break;
index f4ebd1e..511ece9 100644 (file)
@@ -126,9 +126,11 @@ ptrace_disable(struct task_struct *child)
 }
 
 
-long arch_ptrace(struct task_struct *child, long request, long addr, long data)
+long arch_ptrace(struct task_struct *child, long request,
+                unsigned long addr, unsigned long data)
 {
        int ret;
+       unsigned int regno = addr >> 2;
        unsigned long __user *datap = (unsigned long __user *)data;
 
        switch (request) {
@@ -163,10 +165,10 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
                        unsigned long tmp;
 
                        ret = -EIO;
-                       if ((addr & 3) || addr < 0 || addr > PT_MAX << 2)
+                       if ((addr & 3) || regno > PT_MAX)
                                break;
 
-                       tmp = get_reg(child, addr >> 2);
+                       tmp = get_reg(child, regno);
                        ret = put_user(tmp, datap);
                        break;
                }
@@ -180,19 +182,17 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
                /* Write the word at location address in the USER area. */
                case PTRACE_POKEUSR:
                        ret = -EIO;
-                       if ((addr & 3) || addr < 0 || addr > PT_MAX << 2)
+                       if ((addr & 3) || regno > PT_MAX)
                                break;
 
-                       addr >>= 2;
-
-                       if (addr == PT_CCS) {
+                       if (regno == PT_CCS) {
                                /* don't allow the tracing process to change stuff like
                                 * interrupt enable, kernel/user bit, dma enables etc.
                                 */
                                data &= CCS_MASK;
                                data |= get_reg(child, PT_CCS) & ~CCS_MASK;
                        }
-                       if (put_reg(child, addr, data))
+                       if (put_reg(child, regno, data))
                                break;
                        ret = 0;
                        break;
index fac0289..9d68f7f 100644 (file)
@@ -254,23 +254,26 @@ void ptrace_disable(struct task_struct *child)
        user_disable_single_step(child);
 }
 
-long arch_ptrace(struct task_struct *child, long request, long addr, long data)
+long arch_ptrace(struct task_struct *child, long request,
+                unsigned long addr, unsigned long data)
 {
        unsigned long tmp;
        int ret;
+       int regno = addr >> 2;
+       unsigned long __user *datap = (unsigned long __user *) data;
 
        switch (request) {
                /* read the word at location addr in the USER area. */
        case PTRACE_PEEKUSR: {
                tmp = 0;
                ret = -EIO;
-               if ((addr & 3) || addr < 0)
+               if (addr & 3)
                        break;
 
                ret = 0;
-               switch (addr >> 2) {
+               switch (regno) {
                case 0 ... PT__END - 1:
-                       tmp = get_reg(child, addr >> 2);
+                       tmp = get_reg(child, regno);
                        break;
 
                case PT__END + 0:
@@ -299,23 +302,18 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
                }
 
                if (ret == 0)
-                       ret = put_user(tmp, (unsigned long *) data);
+                       ret = put_user(tmp, datap);
                break;
        }
 
        case PTRACE_POKEUSR: /* write the word at location addr in the USER area */
                ret = -EIO;
-               if ((addr & 3) || addr < 0)
+               if (addr & 3)
                        break;
 
-               ret = 0;
-               switch (addr >> 2) {
+               switch (regno) {
                case 0 ... PT__END - 1:
-                       ret = put_reg(child, addr >> 2, data);
-                       break;
-
-               default:
-                       ret = -EIO;
+                       ret = put_reg(child, regno, data);
                        break;
                }
                break;
@@ -324,25 +322,25 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
                return copy_regset_to_user(child, &user_frv_native_view,
                                           REGSET_GENERAL,
                                           0, sizeof(child->thread.user->i),
-                                          (void __user *)data);
+                                          datap);
 
        case PTRACE_SETREGS:    /* Set all integer regs in the child. */
                return copy_regset_from_user(child, &user_frv_native_view,
                                             REGSET_GENERAL,
                                             0, sizeof(child->thread.user->i),
-                                            (const void __user *)data);
+                                            datap);
 
        case PTRACE_GETFPREGS:  /* Get the child FP/Media state. */
                return copy_regset_to_user(child, &user_frv_native_view,
                                           REGSET_FPMEDIA,
                                           0, sizeof(child->thread.user->f),
-                                          (void __user *)data);
+                                          datap);
 
        case PTRACE_SETFPREGS:  /* Set the child FP/Media state. */
                return copy_regset_from_user(child, &user_frv_native_view,
                                             REGSET_FPMEDIA,
                                             0, sizeof(child->thread.user->f),
-                                            (const void __user *)data);
+                                            datap);
 
        default:
                ret = ptrace_request(child, request, addr, data);
index 61088dc..fd7fcd4 100644 (file)
@@ -68,7 +68,7 @@ EXPORT_SYMBOL(__kmap_atomic);
 
 void __kunmap_atomic(void *kvaddr)
 {
-       int type = kmap_atomic_idx_pop();
+       int type = kmap_atomic_idx();
        switch (type) {
        case 0:         __kunmap_atomic_primary(4, 6);  break;
        case 1:         __kunmap_atomic_primary(5, 7);  break;
@@ -83,6 +83,7 @@ void __kunmap_atomic(void *kvaddr)
        default:
                BUG();
        }
+       kmap_atomic_idx_pop();
        pagefault_enable();
 }
 EXPORT_SYMBOL(__kunmap_atomic);
index df11412..497fa89 100644 (file)
@@ -50,27 +50,29 @@ void ptrace_disable(struct task_struct *child)
        user_disable_single_step(child);
 }
 
-long arch_ptrace(struct task_struct *child, long request, long addr, long data)
+long arch_ptrace(struct task_struct *child, long request,
+                unsigned long addr, unsigned long data)
 {
        int ret;
+       int regno = addr >> 2;
+       unsigned long __user *datap = (unsigned long __user *) data;
 
        switch (request) {
        /* read the word at location addr in the USER area. */
                case PTRACE_PEEKUSR: {
                        unsigned long tmp = 0;
                        
-                       if ((addr & 3) || addr < 0 || addr >= sizeof(struct user)) {
+                       if ((addr & 3) || addr >= sizeof(struct user)) {
                                ret = -EIO;
                                break ;
                        }
                        
                        ret = 0;  /* Default return condition */
-                       addr = addr >> 2; /* temporary hack. */
 
-                       if (addr < H8300_REGS_NO)
-                               tmp = h8300_get_reg(child, addr);
+                       if (regno < H8300_REGS_NO)
+                               tmp = h8300_get_reg(child, regno);
                        else {
-                               switch(addr) {
+                               switch (regno) {
                                case 49:
                                        tmp = child->mm->start_code;
                                        break ;
@@ -88,24 +90,23 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
                                }
                        }
                        if (!ret)
-                               ret = put_user(tmp,(unsigned long *) data);
+                               ret = put_user(tmp, datap);
                        break ;
                }
 
       /* when I and D space are separate, this will have to be fixed. */
                case PTRACE_POKEUSR: /* write the word at location addr in the USER area */
-                       if ((addr & 3) || addr < 0 || addr >= sizeof(struct user)) {
+                       if ((addr & 3) || addr >= sizeof(struct user)) {
                                ret = -EIO;
                                break ;
                        }
-                       addr = addr >> 2; /* temporary hack. */
                            
-                       if (addr == PT_ORIG_ER0) {
+                       if (regno == PT_ORIG_ER0) {
                                ret = -EIO;
                                break ;
                        }
-                       if (addr < H8300_REGS_NO) {
-                               ret = h8300_put_reg(child, addr, data);
+                       if (regno < H8300_REGS_NO) {
+                               ret = h8300_put_reg(child, regno, data);
                                break ;
                        }
                        ret = -EIO;
@@ -116,11 +117,11 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
                        unsigned long tmp;
                        for (i = 0; i < H8300_REGS_NO; i++) {
                            tmp = h8300_get_reg(child, i);
-                           if (put_user(tmp, (unsigned long *) data)) {
+                           if (put_user(tmp, datap)) {
                                ret = -EFAULT;
                                break;
                            }
-                           data += sizeof(long);
+                           datap++;
                        }
                        ret = 0;
                        break;
@@ -130,12 +131,12 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
                        int i;
                        unsigned long tmp;
                        for (i = 0; i < H8300_REGS_NO; i++) {
-                           if (get_user(tmp, (unsigned long *) data)) {
+                           if (get_user(tmp, datap)) {
                                ret = -EFAULT;
                                break;
                            }
                            h8300_put_reg(child, i, tmp);
-                           data += sizeof(long);
+                           datap++;
                        }
                        ret = 0;
                        break;
index 7fa8a85..6073b18 100644 (file)
@@ -56,10 +56,10 @@ typedef u64 cputime64_t;
 #define jiffies64_to_cputime64(__jif)  ((__jif) * (NSEC_PER_SEC / HZ))
 
 /*
- * Convert cputime <-> milliseconds
+ * Convert cputime <-> microseconds
  */
-#define cputime_to_msecs(__ct)         ((__ct) / NSEC_PER_MSEC)
-#define msecs_to_cputime(__msecs)      ((__msecs) * NSEC_PER_MSEC)
+#define cputime_to_usecs(__ct)         ((__ct) / NSEC_PER_USEC)
+#define usecs_to_cputime(__usecs)      ((__usecs) * NSEC_PER_USEC)
 
 /*
  * Convert cputime <-> seconds
index 7c7909f..8848f43 100644 (file)
@@ -1177,7 +1177,8 @@ ptrace_disable (struct task_struct *child)
 }
 
 long
-arch_ptrace (struct task_struct *child, long request, long addr, long data)
+arch_ptrace (struct task_struct *child, long request,
+            unsigned long addr, unsigned long data)
 {
        switch (request) {
        case PTRACE_PEEKTEXT:
index 0021ade..2074375 100644 (file)
@@ -622,9 +622,11 @@ void ptrace_disable(struct task_struct *child)
 }
 
 long
-arch_ptrace(struct task_struct *child, long request, long addr, long data)
+arch_ptrace(struct task_struct *child, long request,
+           unsigned long addr, unsigned long data)
 {
        int ret;
+       unsigned long __user *datap = (unsigned long __user *) data;
 
        switch (request) {
        /*
@@ -639,8 +641,7 @@ arch_ptrace(struct task_struct *child, long request, long addr, long data)
         * read the word at location addr in the USER area.
         */
        case PTRACE_PEEKUSR:
-               ret = ptrace_read_user(child, addr,
-                                      (unsigned long __user *)data);
+               ret = ptrace_read_user(child, addr, datap);
                break;
 
        /*
@@ -661,11 +662,11 @@ arch_ptrace(struct task_struct *child, long request, long addr, long data)
                break;
 
        case PTRACE_GETREGS:
-               ret = ptrace_getregs(child, (void __user *)data);
+               ret = ptrace_getregs(child, datap);
                break;
 
        case PTRACE_SETREGS:
-               ret = ptrace_setregs(child, (void __user *)data);
+               ret = ptrace_setregs(child, datap);
                break;
 
        default:
index 616e597..0b25268 100644 (file)
@@ -156,55 +156,57 @@ void user_disable_single_step(struct task_struct *child)
        singlestep_disable(child);
 }
 
-long arch_ptrace(struct task_struct *child, long request, long addr, long data)
+long arch_ptrace(struct task_struct *child, long request,
+                unsigned long addr, unsigned long data)
 {
        unsigned long tmp;
        int i, ret = 0;
+       int regno = addr >> 2; /* temporary hack. */
+       unsigned long __user *datap = (unsigned long __user *) data;
 
        switch (request) {
        /* read the word at location addr in the USER area. */
        case PTRACE_PEEKUSR:
                if (addr & 3)
                        goto out_eio;
-               addr >>= 2;     /* temporary hack. */
 
-               if (addr >= 0 && addr < 19) {
-                       tmp = get_reg(child, addr);
-               } else if (addr >= 21 && addr < 49) {
-                       tmp = child->thread.fp[addr - 21];
+               if (regno >= 0 && regno < 19) {
+                       tmp = get_reg(child, regno);
+               } else if (regno >= 21 && regno < 49) {
+                       tmp = child->thread.fp[regno - 21];
                        /* Convert internal fpu reg representation
                         * into long double format
                         */
-                       if (FPU_IS_EMU && (addr < 45) && !(addr % 3))
+                       if (FPU_IS_EMU && (regno < 45) && !(regno % 3))
                                tmp = ((tmp & 0xffff0000) << 15) |
                                      ((tmp & 0x0000ffff) << 16);
                } else
                        goto out_eio;
-               ret = put_user(tmp, (unsigned long *)data);
+               ret = put_user(tmp, datap);
                break;
 
-       case PTRACE_POKEUSR:    /* write the word at location addr in the USER area */
+       case PTRACE_POKEUSR:
+       /* write the word at location addr in the USER area */
                if (addr & 3)
                        goto out_eio;
-               addr >>= 2;     /* temporary hack. */
 
-               if (addr == PT_SR) {
+               if (regno == PT_SR) {
                        data &= SR_MASK;
                        data |= get_reg(child, PT_SR) & ~SR_MASK;
                }
-               if (addr >= 0 && addr < 19) {
-                       if (put_reg(child, addr, data))
+               if (regno >= 0 && regno < 19) {
+                       if (put_reg(child, regno, data))
                                goto out_eio;
-               } else if (addr >= 21 && addr < 48) {
+               } else if (regno >= 21 && regno < 48) {
                        /* Convert long double format
                         * into internal fpu reg representation
                         */
-                       if (FPU_IS_EMU && (addr < 45) && !(addr % 3)) {
-                               data = (unsigned long)data << 15;
+                       if (FPU_IS_EMU && (regno < 45) && !(regno % 3)) {
+                               data <<= 15;
                                data = (data & 0xffff0000) |
                                       ((data & 0x0000ffff) >> 1);
                        }
-                       child->thread.fp[addr - 21] = data;
+                       child->thread.fp[regno - 21] = data;
                } else
                        goto out_eio;
                break;
@@ -212,16 +214,16 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
        case PTRACE_GETREGS:    /* Get all gp regs from the child. */
                for (i = 0; i < 19; i++) {
                        tmp = get_reg(child, i);
-                       ret = put_user(tmp, (unsigned long *)data);
+                       ret = put_user(tmp, datap);
                        if (ret)
                                break;
-                       data += sizeof(long);
+                       datap++;
                }
                break;
 
        case PTRACE_SETREGS:    /* Set all gp regs in the child. */
                for (i = 0; i < 19; i++) {
-                       ret = get_user(tmp, (unsigned long *)data);
+                       ret = get_user(tmp, datap);
                        if (ret)
                                break;
                        if (i == PT_SR) {
@@ -229,25 +231,24 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
                                tmp |= get_reg(child, PT_SR) & ~SR_MASK;
                        }
                        put_reg(child, i, tmp);
-                       data += sizeof(long);
+                       datap++;
                }
                break;
 
        case PTRACE_GETFPREGS:  /* Get the child FPU state. */
-               if (copy_to_user((void *)data, &child->thread.fp,
+               if (copy_to_user(datap, &child->thread.fp,
                                 sizeof(struct user_m68kfp_struct)))
                        ret = -EFAULT;
                break;
 
        case PTRACE_SETFPREGS:  /* Set the child FPU state. */
-               if (copy_from_user(&child->thread.fp, (void *)data,
+               if (copy_from_user(&child->thread.fp, datap,
                                   sizeof(struct user_m68kfp_struct)))
                        ret = -EFAULT;
                break;
 
        case PTRACE_GET_THREAD_AREA:
-               ret = put_user(task_thread_info(child)->tp_value,
-                              (unsigned long __user *)data);
+               ret = put_user(task_thread_info(child)->tp_value, datap);
                break;
 
        default:
index 6fe7c38..6709fb7 100644 (file)
@@ -112,9 +112,12 @@ void ptrace_disable(struct task_struct *child)
        user_disable_single_step(child);
 }
 
-long arch_ptrace(struct task_struct *child, long request, long addr, long data)
+long arch_ptrace(struct task_struct *child, long request,
+                unsigned long addr, unsigned long data)
 {
        int ret;
+       int regno = addr >> 2;
+       unsigned long __user *datap = (unsigned long __user *) data;
 
        switch (request) {
                /* read the word at location addr in the USER area. */
@@ -122,53 +125,48 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
                        unsigned long tmp;
                        
                        ret = -EIO;
-                       if ((addr & 3) || addr < 0 ||
-                           addr > sizeof(struct user) - 3)
+                       if ((addr & 3) || addr > sizeof(struct user) - 3)
                                break;
                        
                        tmp = 0;  /* Default return condition */
-                       addr = addr >> 2; /* temporary hack. */
                        ret = -EIO;
-                       if (addr < 19) {
-                               tmp = get_reg(child, addr);
-                               if (addr == PT_SR)
+                       if (regno < 19) {
+                               tmp = get_reg(child, regno);
+                               if (regno == PT_SR)
                                        tmp >>= 16;
-                       } else if (addr >= 21 && addr < 49) {
-                               tmp = child->thread.fp[addr - 21];
-                       } else if (addr == 49) {
+                       } else if (regno >= 21 && regno < 49) {
+                               tmp = child->thread.fp[regno - 21];
+                       } else if (regno == 49) {
                                tmp = child->mm->start_code;
-                       } else if (addr == 50) {
+                       } else if (regno == 50) {
                                tmp = child->mm->start_data;
-                       } else if (addr == 51) {
+                       } else if (regno == 51) {
                                tmp = child->mm->end_code;
                        } else
                                break;
-                       ret = put_user(tmp,(unsigned long *) data);
+                       ret = put_user(tmp, datap);
                        break;
                }
 
                case PTRACE_POKEUSR: /* write the word at location addr in the USER area */
                        ret = -EIO;
-                       if ((addr & 3) || addr < 0 ||
-                           addr > sizeof(struct user) - 3)
+                       if ((addr & 3) || addr > sizeof(struct user) - 3)
                                break;
 
-                       addr = addr >> 2; /* temporary hack. */
-                           
-                       if (addr == PT_SR) {
+                       if (regno == PT_SR) {
                                data &= SR_MASK;
                                data <<= 16;
                                data |= get_reg(child, PT_SR) & ~(SR_MASK << 16);
                        }
-                       if (addr < 19) {
-                               if (put_reg(child, addr, data))
+                       if (regno < 19) {
+                               if (put_reg(child, regno, data))
                                        break;
                                ret = 0;
                                break;
                        }
-                       if (addr >= 21 && addr < 48)
+                       if (regno >= 21 && regno < 48)
                        {
-                               child->thread.fp[addr - 21] = data;
+                               child->thread.fp[regno - 21] = data;
                                ret = 0;
                        }
                        break;
@@ -180,11 +178,11 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
                            tmp = get_reg(child, i);
                            if (i == PT_SR)
                                tmp >>= 16;
-                           if (put_user(tmp, (unsigned long *) data)) {
+                           if (put_user(tmp, datap)) {
                                ret = -EFAULT;
                                break;
                            }
-                           data += sizeof(long);
+                           datap++;
                        }
                        ret = 0;
                        break;
@@ -194,7 +192,7 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
                        int i;
                        unsigned long tmp;
                        for (i = 0; i < 19; i++) {
-                           if (get_user(tmp, (unsigned long *) data)) {
+                           if (get_user(tmp, datap)) {
                                ret = -EFAULT;
                                break;
                            }
@@ -204,7 +202,7 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
                                tmp |= get_reg(child, PT_SR) & ~(SR_MASK << 16);
                            }
                            put_reg(child, i, tmp);
-                           data += sizeof(long);
+                           datap++;
                        }
                        ret = 0;
                        break;
@@ -213,7 +211,7 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
 #ifdef PTRACE_GETFPREGS
                case PTRACE_GETFPREGS: { /* Get the child FPU state. */
                        ret = 0;
-                       if (copy_to_user((void *)data, &child->thread.fp,
+                       if (copy_to_user(datap, &child->thread.fp,
                                         sizeof(struct user_m68kfp_struct)))
                                ret = -EFAULT;
                        break;
@@ -223,7 +221,7 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
 #ifdef PTRACE_SETFPREGS
                case PTRACE_SETFPREGS: { /* Set the child FPU state. */
                        ret = 0;
-                       if (copy_from_user(&child->thread.fp, (void *)data,
+                       if (copy_from_user(&child->thread.fp, datap,
                                           sizeof(struct user_m68kfp_struct)))
                                ret = -EFAULT;
                        break;
@@ -231,8 +229,7 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
 #endif
 
        case PTRACE_GET_THREAD_AREA:
-               ret = put_user(task_thread_info(child)->tp_value,
-                              (unsigned long __user *)data);
+               ret = put_user(task_thread_info(child)->tp_value, datap);
                break;
 
                default:
index dc03ffc..05ac8cc 100644 (file)
@@ -73,7 +73,8 @@ static microblaze_reg_t *reg_save_addr(unsigned reg_offs,
        return (microblaze_reg_t *)((char *)regs + reg_offs);
 }
 
-long arch_ptrace(struct task_struct *child, long request, long addr, long data)
+long arch_ptrace(struct task_struct *child, long request,
+                unsigned long addr, unsigned long data)
 {
        int rval;
        unsigned long val = 0;
@@ -99,7 +100,7 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
                        } else {
                                rval = -EIO;
                        }
-               } else if (addr >= 0 && addr < PT_SIZE && (addr & 0x3) == 0) {
+               } else if (addr < PT_SIZE && (addr & 0x3) == 0) {
                        microblaze_reg_t *reg_addr = reg_save_addr(addr, child);
                        if (request == PTRACE_PEEKUSR)
                                val = *reg_addr;
index 5f4b9d4..f1f508e 100644 (file)
@@ -839,7 +839,7 @@ struct bridge_controller {
        nasid_t                 nasid;
        unsigned int            widget_id;
        unsigned int            irq_cpu;
-       dma64_addr_t            baddr;
+       u64                     baddr;
        unsigned int            pci_int[8];
 };
 
index c877733..d21c388 100644 (file)
@@ -255,9 +255,13 @@ int ptrace_set_watch_regs(struct task_struct *child,
        return 0;
 }
 
-long arch_ptrace(struct task_struct *child, long request, long addr, long data)
+long arch_ptrace(struct task_struct *child, long request,
+                unsigned long addr, unsigned long data)
 {
        int ret;
+       void __user *addrp = (void __user *) addr;
+       void __user *datavp = (void __user *) data;
+       unsigned long __user *datalp = (void __user *) data;
 
        switch (request) {
        /* when I and D space are separate, these will need to be fixed. */
@@ -386,7 +390,7 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
                        ret = -EIO;
                        goto out;
                }
-               ret = put_user(tmp, (unsigned long __user *) data);
+               ret = put_user(tmp, datalp);
                break;
        }
 
@@ -478,34 +482,31 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
                }
 
        case PTRACE_GETREGS:
-               ret = ptrace_getregs(child, (__s64 __user *) data);
+               ret = ptrace_getregs(child, datavp);
                break;
 
        case PTRACE_SETREGS:
-               ret = ptrace_setregs(child, (__s64 __user *) data);
+               ret = ptrace_setregs(child, datavp);
                break;
 
        case PTRACE_GETFPREGS:
-               ret = ptrace_getfpregs(child, (__u32 __user *) data);
+               ret = ptrace_getfpregs(child, datavp);
                break;
 
        case PTRACE_SETFPREGS:
-               ret = ptrace_setfpregs(child, (__u32 __user *) data);
+               ret = ptrace_setfpregs(child, datavp);
                break;
 
        case PTRACE_GET_THREAD_AREA:
-               ret = put_user(task_thread_info(child)->tp_value,
-                               (unsigned long __user *) data);
+               ret = put_user(task_thread_info(child)->tp_value, datalp);
                break;
 
        case PTRACE_GET_WATCH_REGS:
-               ret = ptrace_get_watch_regs(child,
-                                       (struct pt_watch_regs __user *) addr);
+               ret = ptrace_get_watch_regs(child, addrp);
                break;
 
        case PTRACE_SET_WATCH_REGS:
-               ret = ptrace_set_watch_regs(child,
-                                       (struct pt_watch_regs __user *) addr);
+               ret = ptrace_set_watch_regs(child, addrp);
                break;
 
        default:
index 1e69b1f..3634c7e 100644 (file)
@@ -74,7 +74,7 @@ void __kunmap_atomic(void *kvaddr)
                return;
        }
 
-       type = kmap_atomic_idx_pop();
+       type = kmap_atomic_idx();
 #ifdef CONFIG_DEBUG_HIGHMEM
        {
                int idx = type + KM_TYPE_NR * smp_processor_id();
@@ -89,6 +89,7 @@ void __kunmap_atomic(void *kvaddr)
                local_flush_tlb_one(vaddr);
        }
 #endif
+       kmap_atomic_idx_pop();
        pagefault_enable();
 }
 EXPORT_SYMBOL(__kunmap_atomic);
index 3817d9f..bfe2d88 100644 (file)
@@ -101,7 +101,7 @@ static inline void __kunmap_atomic(unsigned long vaddr)
                return;
        }
 
-       type = kmap_atomic_idx_pop();
+       type = kmap_atomic_idx();
 
 #if HIGHMEM_DEBUG
        {
@@ -119,6 +119,8 @@ static inline void __kunmap_atomic(unsigned long vaddr)
                local_flush_tlb_one(vaddr);
        }
 #endif
+
+       kmap_atomic_idx_pop();
        pagefault_enable();
 }
 #endif /* __KERNEL__ */
index cf847da..5c0b07e 100644 (file)
@@ -295,31 +295,31 @@ void ptrace_disable(struct task_struct *child)
 /*
  * handle the arch-specific side of process tracing
  */
-long arch_ptrace(struct task_struct *child, long request, long addr, long data)
+long arch_ptrace(struct task_struct *child, long request,
+                unsigned long addr, unsigned long data)
 {
        unsigned long tmp;
        int ret;
+       unsigned long __user *datap = (unsigned long __user *) data;
 
        switch (request) {
        /* read the word at location addr in the USER area. */
        case PTRACE_PEEKUSR:
                ret = -EIO;
-               if ((addr & 3) || addr < 0 ||
-                   addr > sizeof(struct user) - 3)
+               if ((addr & 3) || addr > sizeof(struct user) - 3)
                        break;
 
                tmp = 0;  /* Default return condition */
                if (addr < NR_PTREGS << 2)
                        tmp = get_stack_long(child,
                                             ptrace_regid_to_frame[addr]);
-               ret = put_user(tmp, (unsigned long *) data);
+               ret = put_user(tmp, datap);
                break;
 
                /* write the word at location addr in the USER area */
        case PTRACE_POKEUSR:
                ret = -EIO;
-               if ((addr & 3) || addr < 0 ||
-                   addr > sizeof(struct user) - 3)
+               if ((addr & 3) || addr > sizeof(struct user) - 3)
                        break;
 
                ret = 0;
@@ -332,25 +332,25 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
                return copy_regset_to_user(child, &user_mn10300_native_view,
                                           REGSET_GENERAL,
                                           0, NR_PTREGS * sizeof(long),
-                                          (void __user *)data);
+                                          datap);
 
        case PTRACE_SETREGS:    /* Set all integer regs in the child. */
                return copy_regset_from_user(child, &user_mn10300_native_view,
                                             REGSET_GENERAL,
                                             0, NR_PTREGS * sizeof(long),
-                                            (const void __user *)data);
+                                            datap);
 
        case PTRACE_GETFPREGS:  /* Get the child FPU state. */
                return copy_regset_to_user(child, &user_mn10300_native_view,
                                           REGSET_FPU,
                                           0, sizeof(struct fpu_state_struct),
-                                          (void __user *)data);
+                                          datap);
 
        case PTRACE_SETFPREGS:  /* Set the child FPU state. */
                return copy_regset_from_user(child, &user_mn10300_native_view,
                                             REGSET_FPU,
                                             0, sizeof(struct fpu_state_struct),
-                                            (const void __user *)data);
+                                            datap);
 
        default:
                ret = ptrace_request(child, request, addr, data);
index c4f49e4..2905b1f 100644 (file)
@@ -110,7 +110,8 @@ void user_enable_block_step(struct task_struct *task)
        pa_psw(task)->l = 0;
 }
 
-long arch_ptrace(struct task_struct *child, long request, long addr, long data)
+long arch_ptrace(struct task_struct *child, long request,
+                unsigned long addr, unsigned long data)
 {
        unsigned long tmp;
        long ret = -EIO;
@@ -120,11 +121,11 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
        /* Read the word at location addr in the USER area.  For ptraced
           processes, the kernel saves all regs on a syscall. */
        case PTRACE_PEEKUSR:
-               if ((addr & (sizeof(long)-1)) ||
-                   (unsigned long) addr >= sizeof(struct pt_regs))
+               if ((addr & (sizeof(unsigned long)-1)) ||
+                    addr >= sizeof(struct pt_regs))
                        break;
                tmp = *(unsigned long *) ((char *) task_regs(child) + addr);
-               ret = put_user(tmp, (unsigned long *) data);
+               ret = put_user(tmp, (unsigned long __user *) data);
                break;
 
        /* Write the word at location addr in the USER area.  This will need
@@ -151,8 +152,8 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
                        break;
                }
 
-               if ((addr & (sizeof(long)-1)) ||
-                   (unsigned long) addr >= sizeof(struct pt_regs))
+               if ((addr & (sizeof(unsigned long)-1)) ||
+                    addr >= sizeof(struct pt_regs))
                        break;
                if ((addr >= PT_GR1 && addr <= PT_GR31) ||
                                addr == PT_IAOQ0 || addr == PT_IAOQ1 ||
index 8bdc6a9..1cf20bd 100644 (file)
@@ -124,23 +124,23 @@ static inline u64 cputime64_to_jiffies64(const cputime_t ct)
 }
 
 /*
- * Convert cputime <-> milliseconds
+ * Convert cputime <-> microseconds
  */
 extern u64 __cputime_msec_factor;
 
-static inline unsigned long cputime_to_msecs(const cputime_t ct)
+static inline unsigned long cputime_to_usecs(const cputime_t ct)
 {
-       return mulhdu(ct, __cputime_msec_factor);
+       return mulhdu(ct, __cputime_msec_factor) * USEC_PER_MSEC;
 }
 
-static inline cputime_t msecs_to_cputime(const unsigned long ms)
+static inline cputime_t usecs_to_cputime(const unsigned long us)
 {
        cputime_t ct;
        unsigned long sec;
 
        /* have to be a little careful about overflow */
-       ct = ms % 1000;
-       sec = ms / 1000;
+       ct = us % 1000000;
+       sec = us / 1000000;
        if (ct) {
                ct *= tb_ticks_per_sec;
                do_div(ct, 1000);
index 286d978..a9b3296 100644 (file)
@@ -1406,37 +1406,42 @@ static long ppc_del_hwdebug(struct task_struct *child, long addr, long data)
  * Here are the old "legacy" powerpc specific getregs/setregs ptrace calls,
  * we mark them as obsolete now, they will be removed in a future version
  */
-static long arch_ptrace_old(struct task_struct *child, long request, long addr,
-                           long data)
+static long arch_ptrace_old(struct task_struct *child, long request,
+                           unsigned long addr, unsigned long data)
 {
+       void __user *datavp = (void __user *) data;
+
        switch (request) {
        case PPC_PTRACE_GETREGS:        /* Get GPRs 0 - 31. */
                return copy_regset_to_user(child, &user_ppc_native_view,
                                           REGSET_GPR, 0, 32 * sizeof(long),
-                                          (void __user *) data);
+                                          datavp);
 
        case PPC_PTRACE_SETREGS:        /* Set GPRs 0 - 31. */
                return copy_regset_from_user(child, &user_ppc_native_view,
                                             REGSET_GPR, 0, 32 * sizeof(long),
-                                            (const void __user *) data);
+                                            datavp);
 
        case PPC_PTRACE_GETFPREGS:      /* Get FPRs 0 - 31. */
                return copy_regset_to_user(child, &user_ppc_native_view,
                                           REGSET_FPR, 0, 32 * sizeof(double),
-                                          (void __user *) data);
+                                          datavp);
 
        case PPC_PTRACE_SETFPREGS:      /* Set FPRs 0 - 31. */
                return copy_regset_from_user(child, &user_ppc_native_view,
                                             REGSET_FPR, 0, 32 * sizeof(double),
-                                            (const void __user *) data);
+                                            datavp);
        }
 
        return -EPERM;
 }
 
-long arch_ptrace(struct task_struct *child, long request, long addr, long data)
+long arch_ptrace(struct task_struct *child, long request,
+                unsigned long addr, unsigned long data)
 {
        int ret = -EPERM;
+       void __user *datavp = (void __user *) data;
+       unsigned long __user *datalp = datavp;
 
        switch (request) {
        /* read the word at location addr in the USER area. */
@@ -1446,11 +1451,11 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
                ret = -EIO;
                /* convert to index and check */
 #ifdef CONFIG_PPC32
-               index = (unsigned long) addr >> 2;
+               index = addr >> 2;
                if ((addr & 3) || (index > PT_FPSCR)
                    || (child->thread.regs == NULL))
 #else
-               index = (unsigned long) addr >> 3;
+               index = addr >> 3;
                if ((addr & 7) || (index > PT_FPSCR))
 #endif
                        break;
@@ -1463,7 +1468,7 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
                        tmp = ((unsigned long *)child->thread.fpr)
                                [TS_FPRWIDTH * (index - PT_FPR0)];
                }
-               ret = put_user(tmp,(unsigned long __user *) data);
+               ret = put_user(tmp, datalp);
                break;
        }
 
@@ -1474,11 +1479,11 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
                ret = -EIO;
                /* convert to index and check */
 #ifdef CONFIG_PPC32
-               index = (unsigned long) addr >> 2;
+               index = addr >> 2;
                if ((addr & 3) || (index > PT_FPSCR)
                    || (child->thread.regs == NULL))
 #else
-               index = (unsigned long) addr >> 3;
+               index = addr >> 3;
                if ((addr & 7) || (index > PT_FPSCR))
 #endif
                        break;
@@ -1525,11 +1530,11 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
                dbginfo.features = 0;
 #endif /* CONFIG_PPC_ADV_DEBUG_REGS */
 
-               if (!access_ok(VERIFY_WRITE, data,
+               if (!access_ok(VERIFY_WRITE, datavp,
                               sizeof(struct ppc_debug_info)))
                        return -EFAULT;
-               ret = __copy_to_user((struct ppc_debug_info __user *)data,
-                                    &dbginfo, sizeof(struct ppc_debug_info)) ?
+               ret = __copy_to_user(datavp, &dbginfo,
+                                    sizeof(struct ppc_debug_info)) ?
                      -EFAULT : 0;
                break;
        }
@@ -1537,11 +1542,10 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
        case PPC_PTRACE_SETHWDEBUG: {
                struct ppc_hw_breakpoint bp_info;
 
-               if (!access_ok(VERIFY_READ, data,
+               if (!access_ok(VERIFY_READ, datavp,
                               sizeof(struct ppc_hw_breakpoint)))
                        return -EFAULT;
-               ret = __copy_from_user(&bp_info,
-                                      (struct ppc_hw_breakpoint __user *)data,
+               ret = __copy_from_user(&bp_info, datavp,
                                       sizeof(struct ppc_hw_breakpoint)) ?
                      -EFAULT : 0;
                if (!ret)
@@ -1560,11 +1564,9 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
                if (addr > 0)
                        break;
 #ifdef CONFIG_PPC_ADV_DEBUG_REGS
-               ret = put_user(child->thread.dac1,
-                              (unsigned long __user *)data);
+               ret = put_user(child->thread.dac1, datalp);
 #else
-               ret = put_user(child->thread.dabr,
-                              (unsigned long __user *)data);
+               ret = put_user(child->thread.dabr, datalp);
 #endif
                break;
        }
@@ -1580,7 +1582,7 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
                return copy_regset_to_user(child, &user_ppc_native_view,
                                           REGSET_GPR,
                                           0, sizeof(struct pt_regs),
-                                          (void __user *) data);
+                                          datavp);
 
 #ifdef CONFIG_PPC64
        case PTRACE_SETREGS64:
@@ -1589,19 +1591,19 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
                return copy_regset_from_user(child, &user_ppc_native_view,
                                             REGSET_GPR,
                                             0, sizeof(struct pt_regs),
-                                            (const void __user *) data);
+                                            datavp);
 
        case PTRACE_GETFPREGS: /* Get the child FPU state (FPR0...31 + FPSCR) */
                return copy_regset_to_user(child, &user_ppc_native_view,
                                           REGSET_FPR,
                                           0, sizeof(elf_fpregset_t),
-                                          (void __user *) data);
+                                          datavp);
 
        case PTRACE_SETFPREGS: /* Set the child FPU state (FPR0...31 + FPSCR) */
                return copy_regset_from_user(child, &user_ppc_native_view,
                                             REGSET_FPR,
                                             0, sizeof(elf_fpregset_t),
-                                            (const void __user *) data);
+                                            datavp);
 
 #ifdef CONFIG_ALTIVEC
        case PTRACE_GETVRREGS:
@@ -1609,40 +1611,40 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
                                           REGSET_VMX,
                                           0, (33 * sizeof(vector128) +
                                               sizeof(u32)),
-                                          (void __user *) data);
+                                          datavp);
 
        case PTRACE_SETVRREGS:
                return copy_regset_from_user(child, &user_ppc_native_view,
                                             REGSET_VMX,
                                             0, (33 * sizeof(vector128) +
                                                 sizeof(u32)),
-                                            (const void __user *) data);
+                                            datavp);
 #endif
 #ifdef CONFIG_VSX
        case PTRACE_GETVSRREGS:
                return copy_regset_to_user(child, &user_ppc_native_view,
                                           REGSET_VSX,
                                           0, 32 * sizeof(double),
-                                          (void __user *) data);
+                                          datavp);
 
        case PTRACE_SETVSRREGS:
                return copy_regset_from_user(child, &user_ppc_native_view,
                                             REGSET_VSX,
                                             0, 32 * sizeof(double),
-                                            (const void __user *) data);
+                                            datavp);
 #endif
 #ifdef CONFIG_SPE
        case PTRACE_GETEVRREGS:
                /* Get the child spe register state. */
                return copy_regset_to_user(child, &user_ppc_native_view,
                                           REGSET_SPE, 0, 35 * sizeof(u32),
-                                          (void __user *) data);
+                                          datavp);
 
        case PTRACE_SETEVRREGS:
                /* Set the child spe register state. */
                return copy_regset_from_user(child, &user_ppc_native_view,
                                             REGSET_SPE, 0, 35 * sizeof(u32),
-                                            (const void __user *) data);
+                                            datavp);
 #endif
 
        /* Old reverse args ptrace callss */
index b0848b4..e7450bd 100644 (file)
@@ -62,7 +62,7 @@ void __kunmap_atomic(void *kvaddr)
                return;
        }
 
-       type = kmap_atomic_idx_pop();
+       type = kmap_atomic_idx();
 
 #ifdef CONFIG_DEBUG_HIGHMEM
        {
@@ -79,6 +79,8 @@ void __kunmap_atomic(void *kvaddr)
                local_flush_tlb_page(NULL, vaddr);
        }
 #endif
+
+       kmap_atomic_idx_pop();
        pagefault_enable();
 }
 EXPORT_SYMBOL(__kunmap_atomic);
index 4127636..9725369 100644 (file)
@@ -50,6 +50,7 @@
 #define RIO_ATMU_REGS_OFFSET   0x10c00
 #define RIO_P_MSG_REGS_OFFSET  0x11000
 #define RIO_S_MSG_REGS_OFFSET  0x13000
+#define RIO_GCCSR              0x13c
 #define RIO_ESCSR              0x158
 #define RIO_CCSR               0x15c
 #define RIO_LTLEDCSR           0x0608
@@ -87,6 +88,9 @@
 #define RIO_IPWSR_PWD          0x00000008
 #define RIO_IPWSR_PWB          0x00000004
 
+#define RIO_EPWISR_PINT                0x80000000
+#define RIO_EPWISR_PW          0x00000001
+
 #define RIO_MSG_DESC_SIZE      32
 #define RIO_MSG_BUFFER_SIZE    4096
 #define RIO_MIN_TX_RING_SIZE   2
@@ -1082,18 +1086,12 @@ fsl_rio_port_write_handler(int irq, void *dev_instance)
        struct rio_priv *priv = port->priv;
        u32 epwisr, tmp;
 
-       ipwmr = in_be32(&priv->msg_regs->pwmr);
-       ipwsr = in_be32(&priv->msg_regs->pwsr);
-
        epwisr = in_be32(priv->regs_win + RIO_EPWISR);
-       if (epwisr & 0x80000000) {
-               tmp = in_be32(priv->regs_win + RIO_LTLEDCSR);
-               pr_info("RIO_LTLEDCSR = 0x%x\n", tmp);
-               out_be32(priv->regs_win + RIO_LTLEDCSR, 0);
-       }
+       if (!(epwisr & RIO_EPWISR_PW))
+               goto pw_done;
 
-       if (!(epwisr & 0x00000001))
-               return IRQ_HANDLED;
+       ipwmr = in_be32(&priv->msg_regs->pwmr);
+       ipwsr = in_be32(&priv->msg_regs->pwsr);
 
 #ifdef DEBUG_PW
        pr_debug("PW Int->IPWMR: 0x%08x IPWSR: 0x%08x (", ipwmr, ipwsr);
@@ -1109,20 +1107,6 @@ fsl_rio_port_write_handler(int irq, void *dev_instance)
                pr_debug(" PWB");
        pr_debug(" )\n");
 #endif
-       out_be32(&priv->msg_regs->pwsr,
-                ipwsr & (RIO_IPWSR_TE | RIO_IPWSR_QFI | RIO_IPWSR_PWD));
-
-       if ((ipwmr & RIO_IPWMR_EIE) && (ipwsr & RIO_IPWSR_TE)) {
-               priv->port_write_msg.err_count++;
-               pr_info("RIO: Port-Write Transaction Err (%d)\n",
-                        priv->port_write_msg.err_count);
-       }
-       if (ipwsr & RIO_IPWSR_PWD) {
-               priv->port_write_msg.discard_count++;
-               pr_info("RIO: Port Discarded Port-Write Msg(s) (%d)\n",
-                        priv->port_write_msg.discard_count);
-       }
-
        /* Schedule deferred processing if PW was received */
        if (ipwsr & RIO_IPWSR_QFI) {
                /* Save PW message (if there is room in FIFO),
@@ -1134,16 +1118,43 @@ fsl_rio_port_write_handler(int irq, void *dev_instance)
                                 RIO_PW_MSG_SIZE);
                } else {
                        priv->port_write_msg.discard_count++;
-                       pr_info("RIO: ISR Discarded Port-Write Msg(s) (%d)\n",
+                       pr_debug("RIO: ISR Discarded Port-Write Msg(s) (%d)\n",
                                 priv->port_write_msg.discard_count);
                }
+               /* Clear interrupt and issue Clear Queue command. This allows
+                * another port-write to be received.
+                */
+               out_be32(&priv->msg_regs->pwsr, RIO_IPWSR_QFI);
+               out_be32(&priv->msg_regs->pwmr, ipwmr | RIO_IPWMR_CQ);
+
                schedule_work(&priv->pw_work);
        }
 
-       /* Issue Clear Queue command. This allows another
-        * port-write to be received.
-        */
-       out_be32(&priv->msg_regs->pwmr, ipwmr | RIO_IPWMR_CQ);
+       if ((ipwmr & RIO_IPWMR_EIE) && (ipwsr & RIO_IPWSR_TE)) {
+               priv->port_write_msg.err_count++;
+               pr_debug("RIO: Port-Write Transaction Err (%d)\n",
+                        priv->port_write_msg.err_count);
+               /* Clear Transaction Error: port-write controller should be
+                * disabled when clearing this error
+                */
+               out_be32(&priv->msg_regs->pwmr, ipwmr & ~RIO_IPWMR_PWE);
+               out_be32(&priv->msg_regs->pwsr, RIO_IPWSR_TE);
+               out_be32(&priv->msg_regs->pwmr, ipwmr);
+       }
+
+       if (ipwsr & RIO_IPWSR_PWD) {
+               priv->port_write_msg.discard_count++;
+               pr_debug("RIO: Port Discarded Port-Write Msg(s) (%d)\n",
+                        priv->port_write_msg.discard_count);
+               out_be32(&priv->msg_regs->pwsr, RIO_IPWSR_PWD);
+       }
+
+pw_done:
+       if (epwisr & RIO_EPWISR_PINT) {
+               tmp = in_be32(priv->regs_win + RIO_LTLEDCSR);
+               pr_debug("RIO_LTLEDCSR = 0x%x\n", tmp);
+               out_be32(priv->regs_win + RIO_LTLEDCSR, 0);
+       }
 
        return IRQ_HANDLED;
 }
@@ -1461,6 +1472,7 @@ int fsl_rio_setup(struct platform_device *dev)
        port->host_deviceid = fsl_rio_get_hdid(port->id);
 
        port->priv = priv;
+       port->phys_efptr = 0x100;
        rio_register_mport(port);
 
        priv->regs_win = ioremap(regs.start, regs.end - regs.start + 1);
@@ -1508,6 +1520,12 @@ int fsl_rio_setup(struct platform_device *dev)
        dev_info(&dev->dev, "RapidIO Common Transport System size: %d\n",
                        port->sys_size ? 65536 : 256);
 
+       if (port->host_deviceid >= 0)
+               out_be32(priv->regs_win + RIO_GCCSR, RIO_PORT_GEN_HOST |
+                       RIO_PORT_GEN_MASTER | RIO_PORT_GEN_DISCOVERED);
+       else
+               out_be32(priv->regs_win + RIO_GCCSR, 0x00000000);
+
        priv->atmu_regs = (struct rio_atmu_regs *)(priv->regs_win
                                        + RIO_ATMU_REGS_OFFSET);
        priv->maint_atmu_regs = priv->atmu_regs + 1;
index 8b1a52a..40e2ab0 100644 (file)
@@ -73,18 +73,18 @@ cputime64_to_jiffies64(cputime64_t cputime)
 }
 
 /*
- * Convert cputime to milliseconds and back.
+ * Convert cputime to microseconds and back.
  */
 static inline unsigned int
-cputime_to_msecs(const cputime_t cputime)
+cputime_to_usecs(const cputime_t cputime)
 {
-       return cputime_div(cputime, 4096000);
+       return cputime_div(cputime, 4096);
 }
 
 static inline cputime_t
-msecs_to_cputime(const unsigned int m)
+usecs_to_cputime(const unsigned int m)
 {
-       return (cputime_t) m * 4096000;
+       return (cputime_t) m * 4096;
 }
 
 /*
index 83339d3..019bb71 100644 (file)
@@ -343,7 +343,8 @@ poke_user(struct task_struct *child, addr_t addr, addr_t data)
        return __poke_user(child, addr, data);
 }
 
-long arch_ptrace(struct task_struct *child, long request, long addr, long data)
+long arch_ptrace(struct task_struct *child, long request,
+                unsigned long addr, unsigned long data)
 {
        ptrace_area parea; 
        int copied, ret;
index 174c642..5583618 100644 (file)
@@ -325,7 +325,8 @@ void ptrace_disable(struct task_struct *child)
 }
 
 long
-arch_ptrace(struct task_struct *child, long request, long addr, long data)
+arch_ptrace(struct task_struct *child, long request,
+           unsigned long addr, unsigned long data)
 {
        int ret;
        unsigned long __user *datap = (void __user *)data;
@@ -335,14 +336,14 @@ arch_ptrace(struct task_struct *child, long request, long addr, long data)
                ret = copy_regset_to_user(child, &user_score_native_view,
                                                REGSET_GENERAL,
                                                0, sizeof(struct pt_regs),
-                                               (void __user *)datap);
+                                               datap);
                break;
 
        case PTRACE_SETREGS:
                ret = copy_regset_from_user(child, &user_score_native_view,
                                                REGSET_GENERAL,
                                                0, sizeof(struct pt_regs),
-                                               (const void __user *)datap);
+                                               datap);
                break;
 
        default:
index 2cd42b5..90a15d2 100644 (file)
@@ -365,9 +365,9 @@ const struct user_regset_view *task_user_regset_view(struct task_struct *task)
        return &user_sh_native_view;
 }
 
-long arch_ptrace(struct task_struct *child, long request, long addr, long data)
+long arch_ptrace(struct task_struct *child, long request,
+                unsigned long addr, unsigned long data)
 {
-       struct user * dummy = NULL;
        unsigned long __user *datap = (unsigned long __user *)data;
        int ret;
 
@@ -383,17 +383,20 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
 
                if (addr < sizeof(struct pt_regs))
                        tmp = get_stack_long(child, addr);
-               else if (addr >= (long) &dummy->fpu &&
-                        addr < (long) &dummy->u_fpvalid) {
+               else if (addr >= offsetof(struct user, fpu) &&
+                        addr < offsetof(struct user, u_fpvalid)) {
                        if (!tsk_used_math(child)) {
-                               if (addr == (long)&dummy->fpu.fpscr)
+                               if (addr == offsetof(struct user, fpu.fpscr))
                                        tmp = FPSCR_INIT;
                                else
                                        tmp = 0;
-                       } else
-                               tmp = ((long *)child->thread.xstate)
-                                       [(addr - (long)&dummy->fpu) >> 2];
-               } else if (addr == (long) &dummy->u_fpvalid)
+                       } else {
+                               unsigned long index;
+                               index = addr - offsetof(struct user, fpu);
+                               tmp = ((unsigned long *)child->thread.xstate)
+                                       [index >> 2];
+                       }
+               } else if (addr == offsetof(struct user, u_fpvalid))
                        tmp = !!tsk_used_math(child);
                else if (addr == PT_TEXT_ADDR)
                        tmp = child->mm->start_code;
@@ -417,13 +420,15 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
 
                if (addr < sizeof(struct pt_regs))
                        ret = put_stack_long(child, addr, data);
-               else if (addr >= (long) &dummy->fpu &&
-                        addr < (long) &dummy->u_fpvalid) {
+               else if (addr >= offsetof(struct user, fpu) &&
+                        addr < offsetof(struct user, u_fpvalid)) {
+                       unsigned long index;
+                       index = addr - offsetof(struct user, fpu);
                        set_stopped_child_used_math(child);
-                       ((long *)child->thread.xstate)
-                               [(addr - (long)&dummy->fpu) >> 2] = data;
+                       ((unsigned long *)child->thread.xstate)
+                               [index >> 2] = data;
                        ret = 0;
-               } else if (addr == (long) &dummy->u_fpvalid) {
+               } else if (addr == offsetof(struct user, u_fpvalid)) {
                        conditional_stopped_child_used_math(data, child);
                        ret = 0;
                }
@@ -433,35 +438,35 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
                return copy_regset_to_user(child, &user_sh_native_view,
                                           REGSET_GENERAL,
                                           0, sizeof(struct pt_regs),
-                                          (void __user *)data);
+                                          datap);
        case PTRACE_SETREGS:
                return copy_regset_from_user(child, &user_sh_native_view,
                                             REGSET_GENERAL,
                                             0, sizeof(struct pt_regs),
-                                            (const void __user *)data);
+                                            datap);
 #ifdef CONFIG_SH_FPU
        case PTRACE_GETFPREGS:
                return copy_regset_to_user(child, &user_sh_native_view,
                                           REGSET_FPU,
                                           0, sizeof(struct user_fpu_struct),
-                                          (void __user *)data);
+                                          datap);
        case PTRACE_SETFPREGS:
                return copy_regset_from_user(child, &user_sh_native_view,
                                             REGSET_FPU,
                                             0, sizeof(struct user_fpu_struct),
-                                            (const void __user *)data);
+                                            datap);
 #endif
 #ifdef CONFIG_SH_DSP
        case PTRACE_GETDSPREGS:
                return copy_regset_to_user(child, &user_sh_native_view,
                                           REGSET_DSP,
                                           0, sizeof(struct pt_dspregs),
-                                          (void __user *)data);
+                                          datap);
        case PTRACE_SETDSPREGS:
                return copy_regset_from_user(child, &user_sh_native_view,
                                             REGSET_DSP,
                                             0, sizeof(struct pt_dspregs),
-                                            (const void __user *)data);
+                                            datap);
 #endif
        default:
                ret = ptrace_request(child, request, addr, data);
index e0fb065..4436eac 100644 (file)
@@ -383,9 +383,11 @@ const struct user_regset_view *task_user_regset_view(struct task_struct *task)
        return &user_sh64_native_view;
 }
 
-long arch_ptrace(struct task_struct *child, long request, long addr, long data)
+long arch_ptrace(struct task_struct *child, long request,
+                unsigned long addr, unsigned long data)
 {
        int ret;
+       unsigned long __user *datap = (unsigned long __user *) data;
 
        switch (request) {
        /* read the word at location addr in the USER area. */
@@ -400,13 +402,15 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
                        tmp = get_stack_long(child, addr);
                else if ((addr >= offsetof(struct user, fpu)) &&
                         (addr <  offsetof(struct user, u_fpvalid))) {
-                       tmp = get_fpu_long(child, addr - offsetof(struct user, fpu));
+                       unsigned long index;
+                       index = addr - offsetof(struct user, fpu);
+                       tmp = get_fpu_long(child, index);
                } else if (addr == offsetof(struct user, u_fpvalid)) {
                        tmp = !!tsk_used_math(child);
                } else {
                        break;
                }
-               ret = put_user(tmp, (unsigned long *)data);
+               ret = put_user(tmp, datap);
                break;
        }
 
@@ -437,7 +441,9 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
                }
                else if ((addr >= offsetof(struct user, fpu)) &&
                         (addr <  offsetof(struct user, u_fpvalid))) {
-                       ret = put_fpu_long(child, addr - offsetof(struct user, fpu), data);
+                       unsigned long index;
+                       index = addr - offsetof(struct user, fpu);
+                       ret = put_fpu_long(child, index, data);
                }
                break;
 
@@ -445,23 +451,23 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
                return copy_regset_to_user(child, &user_sh64_native_view,
                                           REGSET_GENERAL,
                                           0, sizeof(struct pt_regs),
-                                          (void __user *)data);
+                                          datap);
        case PTRACE_SETREGS:
                return copy_regset_from_user(child, &user_sh64_native_view,
                                             REGSET_GENERAL,
                                             0, sizeof(struct pt_regs),
-                                            (const void __user *)data);
+                                            datap);
 #ifdef CONFIG_SH_FPU
        case PTRACE_GETFPREGS:
                return copy_regset_to_user(child, &user_sh64_native_view,
                                           REGSET_FPU,
                                           0, sizeof(struct user_fpu_struct),
-                                          (void __user *)data);
+                                          datap);
        case PTRACE_SETFPREGS:
                return copy_regset_from_user(child, &user_sh64_native_view,
                                             REGSET_FPU,
                                             0, sizeof(struct user_fpu_struct),
-                                            (const void __user *)data);
+                                            datap);
 #endif
        default:
                ret = ptrace_request(child, request, addr, data);
@@ -471,7 +477,8 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
        return ret;
 }
 
-asmlinkage int sh64_ptrace(long request, long pid, long addr, long data)
+asmlinkage int sh64_ptrace(long request, long pid,
+                          unsigned long addr, unsigned long data)
 {
 #define WPC_DBRMODE 0x0d104008
        static unsigned long first_call;
index 2889574..c2ced21 100644 (file)
@@ -208,6 +208,21 @@ _memset_io(volatile void __iomem *dst, int c, __kernel_size_t n)
 #define memset_io(d,c,sz)      _memset_io(d,c,sz)
 
 static inline void
+_sbus_memcpy_fromio(void *dst, const volatile void __iomem *src,
+                   __kernel_size_t n)
+{
+       char *d = dst;
+
+       while (n--) {
+               char tmp = sbus_readb(src);
+               *d++ = tmp;
+               src++;
+       }
+}
+
+#define sbus_memcpy_fromio(d, s, sz)   _sbus_memcpy_fromio(d, s, sz)
+
+static inline void
 _memcpy_fromio(void *dst, const volatile void __iomem *src, __kernel_size_t n)
 {
        char *d = dst;
@@ -222,6 +237,22 @@ _memcpy_fromio(void *dst, const volatile void __iomem *src, __kernel_size_t n)
 #define memcpy_fromio(d,s,sz)  _memcpy_fromio(d,s,sz)
 
 static inline void
+_sbus_memcpy_toio(volatile void __iomem *dst, const void *src,
+                 __kernel_size_t n)
+{
+       const char *s = src;
+       volatile void __iomem *d = dst;
+
+       while (n--) {
+               char tmp = *s++;
+               sbus_writeb(tmp, d);
+               d++;
+       }
+}
+
+#define sbus_memcpy_toio(d, s, sz)     _sbus_memcpy_toio(d, s, sz)
+
+static inline void
 _memcpy_toio(volatile void __iomem *dst, const void *src, __kernel_size_t n)
 {
        const char *s = src;
index 9517d06..9c89654 100644 (file)
@@ -419,6 +419,21 @@ _memset_io(volatile void __iomem *dst, int c, __kernel_size_t n)
 #define memset_io(d,c,sz)      _memset_io(d,c,sz)
 
 static inline void
+_sbus_memcpy_fromio(void *dst, const volatile void __iomem *src,
+                   __kernel_size_t n)
+{
+       char *d = dst;
+
+       while (n--) {
+               char tmp = sbus_readb(src);
+               *d++ = tmp;
+               src++;
+       }
+}
+
+#define sbus_memcpy_fromio(d, s, sz)   _sbus_memcpy_fromio(d, s, sz)
+
+static inline void
 _memcpy_fromio(void *dst, const volatile void __iomem *src, __kernel_size_t n)
 {
        char *d = dst;
@@ -433,6 +448,22 @@ _memcpy_fromio(void *dst, const volatile void __iomem *src, __kernel_size_t n)
 #define memcpy_fromio(d,s,sz)  _memcpy_fromio(d,s,sz)
 
 static inline void
+_sbus_memcpy_toio(volatile void __iomem *dst, const void *src,
+                 __kernel_size_t n)
+{
+       const char *s = src;
+       volatile void __iomem *d = dst;
+
+       while (n--) {
+               char tmp = *s++;
+               sbus_writeb(tmp, d);
+               d++;
+       }
+}
+
+#define sbus_memcpy_toio(d, s, sz)     _sbus_memcpy_toio(d, s, sz)
+
+static inline void
 _memcpy_toio(volatile void __iomem *dst, const void *src, __kernel_size_t n)
 {
        const char *s = src;
index 5312782..948b686 100644 (file)
@@ -38,7 +38,7 @@ static inline void pcibios_penalize_isa_irq(int irq, int active)
  * types on sparc64.  However, it requires that the device
  * can drive enough of the 64 bits.
  */
-#define PCI64_REQUIRED_MASK    (~(dma64_addr_t)0)
+#define PCI64_REQUIRED_MASK    (~(u64)0)
 #define PCI64_ADDR_BASE                0xfffc000000000000UL
 
 #ifdef CONFIG_PCI
index e608f39..27b9e93 100644 (file)
@@ -323,18 +323,35 @@ const struct user_regset_view *task_user_regset_view(struct task_struct *task)
        return &user_sparc32_view;
 }
 
-long arch_ptrace(struct task_struct *child, long request, long addr, long data)
+struct fps {
+       unsigned long regs[32];
+       unsigned long fsr;
+       unsigned long flags;
+       unsigned long extra;
+       unsigned long fpqd;
+       struct fq {
+               unsigned long *insnaddr;
+               unsigned long insn;
+       } fpq[16];
+};
+
+long arch_ptrace(struct task_struct *child, long request,
+                unsigned long addr, unsigned long data)
 {
        unsigned long addr2 = current->thread.kregs->u_regs[UREG_I4];
+       void __user *addr2p;
        const struct user_regset_view *view;
+       struct pt_regs __user *pregs;
+       struct fps __user *fps;
        int ret;
 
        view = task_user_regset_view(current);
+       addr2p = (void __user *) addr2;
+       pregs = (struct pt_regs __user *) addr;
+       fps = (struct fps __user *) addr;
 
        switch(request) {
        case PTRACE_GETREGS: {
-               struct pt_regs __user *pregs = (struct pt_regs __user *) addr;
-
                ret = copy_regset_to_user(child, view, REGSET_GENERAL,
                                          32 * sizeof(u32),
                                          4 * sizeof(u32),
@@ -348,8 +365,6 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
        }
 
        case PTRACE_SETREGS: {
-               struct pt_regs __user *pregs = (struct pt_regs __user *) addr;
-
                ret = copy_regset_from_user(child, view, REGSET_GENERAL,
                                            32 * sizeof(u32),
                                            4 * sizeof(u32),
@@ -363,19 +378,6 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
        }
 
        case PTRACE_GETFPREGS: {
-               struct fps {
-                       unsigned long regs[32];
-                       unsigned long fsr;
-                       unsigned long flags;
-                       unsigned long extra;
-                       unsigned long fpqd;
-                       struct fq {
-                               unsigned long *insnaddr;
-                               unsigned long insn;
-                       } fpq[16];
-               };
-               struct fps __user *fps = (struct fps __user *) addr;
-
                ret = copy_regset_to_user(child, view, REGSET_FP,
                                          0 * sizeof(u32),
                                          32 * sizeof(u32),
@@ -397,19 +399,6 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
        }
 
        case PTRACE_SETFPREGS: {
-               struct fps {
-                       unsigned long regs[32];
-                       unsigned long fsr;
-                       unsigned long flags;
-                       unsigned long extra;
-                       unsigned long fpqd;
-                       struct fq {
-                               unsigned long *insnaddr;
-                               unsigned long insn;
-                       } fpq[16];
-               };
-               struct fps __user *fps = (struct fps __user *) addr;
-
                ret = copy_regset_from_user(child, view, REGSET_FP,
                                            0 * sizeof(u32),
                                            32 * sizeof(u32),
@@ -424,8 +413,7 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
 
        case PTRACE_READTEXT:
        case PTRACE_READDATA:
-               ret = ptrace_readdata(child, addr,
-                                     (void __user *) addr2, data);
+               ret = ptrace_readdata(child, addr, addr2p, data);
 
                if (ret == data)
                        ret = 0;
@@ -435,8 +423,7 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
 
        case PTRACE_WRITETEXT:
        case PTRACE_WRITEDATA:
-               ret = ptrace_writedata(child, (void __user *) addr2,
-                                      addr, data);
+               ret = ptrace_writedata(child, addr2p, addr, data);
 
                if (ret == data)
                        ret = 0;
index aa90da0..9ccc812 100644 (file)
@@ -969,16 +969,19 @@ struct fps {
        unsigned long fsr;
 };
 
-long arch_ptrace(struct task_struct *child, long request, long addr, long data)
+long arch_ptrace(struct task_struct *child, long request,
+                unsigned long addr, unsigned long data)
 {
        const struct user_regset_view *view = task_user_regset_view(current);
        unsigned long addr2 = task_pt_regs(current)->u_regs[UREG_I4];
        struct pt_regs __user *pregs;
        struct fps __user *fps;
+       void __user *addr2p;
        int ret;
 
-       pregs = (struct pt_regs __user *) (unsigned long) addr;
-       fps = (struct fps __user *) (unsigned long) addr;
+       pregs = (struct pt_regs __user *) addr;
+       fps = (struct fps __user *) addr;
+       addr2p = (void __user *) addr2;
 
        switch (request) {
        case PTRACE_PEEKUSR:
@@ -1029,8 +1032,7 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
 
        case PTRACE_READTEXT:
        case PTRACE_READDATA:
-               ret = ptrace_readdata(child, addr,
-                                     (char __user *)addr2, data);
+               ret = ptrace_readdata(child, addr, addr2p, data);
                if (ret == data)
                        ret = 0;
                else if (ret >= 0)
@@ -1039,8 +1041,7 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
 
        case PTRACE_WRITETEXT:
        case PTRACE_WRITEDATA:
-               ret = ptrace_writedata(child, (char __user *) addr2,
-                                      addr, data);
+               ret = ptrace_writedata(child, addr2p, addr, data);
                if (ret == data)
                        ret = 0;
                else if (ret >= 0)
index 5e50c09..4730eac 100644 (file)
@@ -75,7 +75,7 @@ void __kunmap_atomic(void *kvaddr)
                return;
        }
 
-       type = kmap_atomic_idx_pop();
+       type = kmap_atomic_idx();
 
 #ifdef CONFIG_DEBUG_HIGHMEM
        {
@@ -104,6 +104,8 @@ void __kunmap_atomic(void *kvaddr)
 #endif
        }
 #endif
+
+       kmap_atomic_idx_pop();
        pagefault_enable();
 }
 EXPORT_SYMBOL(__kunmap_atomic);
index 89cfee0..7e8c284 100644 (file)
@@ -58,6 +58,9 @@ config ARCH_SUPPORTS_OPTIMIZED_INLINING
 config ARCH_PHYS_ADDR_T_64BIT
        def_bool y
 
+config ARCH_DMA_ADDR_T_64BIT
+       def_bool y
+
 config LOCKDEP_SUPPORT
        def_bool y
 
index 5b20c28..9cd2988 100644 (file)
@@ -45,7 +45,8 @@ void ptrace_disable(struct task_struct *child)
        clear_tsk_thread_flag(child, TIF_SYSCALL_TRACE);
 }
 
-long arch_ptrace(struct task_struct *child, long request, long addr, long data)
+long arch_ptrace(struct task_struct *child, long request,
+                unsigned long addr, unsigned long data)
 {
        unsigned long __user *datap = (long __user __force *)data;
        unsigned long tmp;
@@ -57,7 +58,7 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
        switch (request) {
 
        case PTRACE_PEEKUSR:  /* Read register from pt_regs. */
-               if (addr < 0 || addr >= PTREGS_SIZE)
+               if (addr >= PTREGS_SIZE)
                        break;
                childreg = (char *)task_pt_regs(child) + addr;
 #ifdef CONFIG_COMPAT
@@ -76,7 +77,7 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
                break;
 
        case PTRACE_POKEUSR:  /* Write register in pt_regs. */
-               if (addr < 0 || addr >= PTREGS_SIZE)
+               if (addr >= PTREGS_SIZE)
                        break;
                childreg = (char *)task_pt_regs(child) + addr;
 #ifdef CONFIG_COMPAT
@@ -98,7 +99,8 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
                if (!access_ok(VERIFY_WRITE, datap, PTREGS_SIZE))
                        break;
                childregs = (long *)task_pt_regs(child);
-               for (i = 0; i < sizeof(struct pt_regs)/sizeof(long); ++i) {
+               for (i = 0; i < sizeof(struct pt_regs)/sizeof(unsigned long);
+                               ++i) {
                        ret = __put_user(childregs[i], &datap[i]);
                        if (ret != 0)
                                break;
@@ -109,7 +111,8 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
                if (!access_ok(VERIFY_READ, datap, PTREGS_SIZE))
                        break;
                childregs = (long *)task_pt_regs(child);
-               for (i = 0; i < sizeof(struct pt_regs)/sizeof(long); ++i) {
+               for (i = 0; i < sizeof(struct pt_regs)/sizeof(unsigned long);
+                               ++i) {
                        ret = __get_user(childregs[i], &datap[i]);
                        if (ret != 0)
                                break;
index f3a50e7..ae51cad 100644 (file)
@@ -30,8 +30,6 @@
 #include <linux/timex.h>
 #include <asm/setup.h>
 #include <asm/sections.h>
-#include <asm/sections.h>
-#include <asm/cacheflush.h>
 #include <asm/cacheflush.h>
 #include <asm/pgalloc.h>
 #include <asm/mmu_context.h>
index 8ef6595..abb5733 100644 (file)
@@ -241,7 +241,7 @@ void __kunmap_atomic(void *kvaddr)
                pte_t pteval = *pte;
                int idx, type;
 
-               type = kmap_atomic_idx_pop();
+               type = kmap_atomic_idx();
                idx = type + KM_TYPE_NR*smp_processor_id();
 
                /*
@@ -252,6 +252,7 @@ void __kunmap_atomic(void *kvaddr)
                BUG_ON(!pte_present(pteval) && !pte_migrating(pteval));
                kmap_atomic_unregister(pte_page(pteval), vaddr);
                kpte_clear_flush(pte, vaddr);
+               kmap_atomic_idx_pop();
        } else {
                /* Must be a lowmem page */
                BUG_ON(vaddr < PAGE_OFFSET);
index e051049..a5e33f2 100644 (file)
@@ -42,10 +42,12 @@ void ptrace_disable(struct task_struct *child)
 extern int peek_user(struct task_struct * child, long addr, long data);
 extern int poke_user(struct task_struct * child, long addr, long data);
 
-long arch_ptrace(struct task_struct *child, long request, long addr, long data)
+long arch_ptrace(struct task_struct *child, long request,
+                unsigned long addr, unsigned long data)
 {
        int i, ret;
-       unsigned long __user *p = (void __user *)(unsigned long)data;
+       unsigned long __user *p = (void __user *)data;
+       void __user *vp = p;
 
        switch (request) {
        /* read word at location addr. */
@@ -107,24 +109,20 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
 #endif
 #ifdef PTRACE_GETFPREGS
        case PTRACE_GETFPREGS: /* Get the child FPU state. */
-               ret = get_fpregs((struct user_i387_struct __user *) data,
-                                child);
+               ret = get_fpregs(vp, child);
                break;
 #endif
 #ifdef PTRACE_SETFPREGS
        case PTRACE_SETFPREGS: /* Set the child FPU state. */
-               ret = set_fpregs((struct user_i387_struct __user *) data,
-                                child);
+               ret = set_fpregs(vp, child);
                break;
 #endif
        case PTRACE_GET_THREAD_AREA:
-               ret = ptrace_get_thread_area(child, addr,
-                                            (struct user_desc __user *) data);
+               ret = ptrace_get_thread_area(child, addr, vp);
                break;
 
        case PTRACE_SET_THREAD_AREA:
-               ret = ptrace_set_thread_area(child, addr,
-                                            (struct user_desc __user *) data);
+               ret = ptrace_set_thread_area(child, addr, datavp);
                break;
 
        case PTRACE_FAULTINFO: {
@@ -134,7 +132,8 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
                 * On i386, ptrace_faultinfo is smaller!
                 */
                ret = copy_to_user(p, &child->thread.arch.faultinfo,
-                                  sizeof(struct ptrace_faultinfo));
+                                  sizeof(struct ptrace_faultinfo)) ?
+                       -EIO : 0;
                break;
        }
 
@@ -158,7 +157,7 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
 #ifdef PTRACE_ARCH_PRCTL
        case PTRACE_ARCH_PRCTL:
                /* XXX Calls ptrace on the host - needs some SMP thinking */
-               ret = arch_prctl(child, data, (void *) addr);
+               ret = arch_prctl(child, data, (void __user *) addr);
                break;
 #endif
        default:
index c9b1765..d23b2d3 100644 (file)
@@ -203,8 +203,8 @@ int set_fpxregs(struct user_fxsr_struct __user *buf, struct task_struct *child)
                                     (unsigned long *) &fpregs);
 }
 
-long subarch_ptrace(struct task_struct *child, long request, long addr,
-                   long data)
+long subarch_ptrace(struct task_struct *child, long request,
+                   unsigned long addr, unsigned long data)
 {
        return -EIO;
 }
index f3458d7..f436136 100644 (file)
@@ -175,19 +175,18 @@ int set_fpregs(struct user_i387_struct __user *buf, struct task_struct *child)
        return restore_fp_registers(userspace_pid[cpu], fpregs);
 }
 
-long subarch_ptrace(struct task_struct *child, long request, long addr,
-                   long data)
+long subarch_ptrace(struct task_struct *child, long request,
+                   unsigned long addr, unsigned long data)
 {
        int ret = -EIO;
+       void __user *datap = (void __user *) data;
 
        switch (request) {
        case PTRACE_GETFPXREGS: /* Get the child FPU state. */
-               ret = get_fpregs((struct user_i387_struct __user *) data,
-                                child);
+               ret = get_fpregs(datap, child);
                break;
        case PTRACE_SETFPXREGS: /* Set the child FPU state. */
-               ret = set_fpregs((struct user_i387_struct __user *) data,
-                                child);
+               ret = set_fpregs(datap, child);
                break;
        }
 
index dfabfef..299fbc8 100644 (file)
@@ -347,6 +347,7 @@ endif
 
 config X86_VSMP
        bool "ScaleMP vSMP"
+       select PARAVIRT_GUEST
        select PARAVIRT
        depends on X86_64 && PCI
        depends on X86_EXTENDED_PLATFORM
index 0bf5b00..13b0eba 100644 (file)
@@ -21,10 +21,8 @@ static inline int irq_canonicalize(int irq)
 
 #ifdef CONFIG_X86_32
 extern void irq_ctx_init(int cpu);
-extern void irq_ctx_exit(int cpu);
 #else
 # define irq_ctx_init(cpu) do { } while (0)
-# define irq_ctx_exit(cpu) do { } while (0)
 #endif
 
 #define __ARCH_HAS_DO_SOFTIRQ
index 83c4bb1..3ea3dc4 100644 (file)
 #define MSR_AMD64_IBSDCLINAD           0xc0011038
 #define MSR_AMD64_IBSDCPHYSAD          0xc0011039
 #define MSR_AMD64_IBSCTL               0xc001103a
+#define MSR_AMD64_IBSBRTARGET          0xc001103b
 
 /* Fam 10h MSRs */
 #define MSR_FAM10H_MMIO_CONF_BASE      0xc0010058
index 6e742cc..550e26b 100644 (file)
@@ -111,17 +111,18 @@ union cpuid10_edx {
 #define X86_PMC_IDX_FIXED_BTS                          (X86_PMC_IDX_FIXED + 16)
 
 /* IbsFetchCtl bits/masks */
-#define IBS_FETCH_RAND_EN              (1ULL<<57)
-#define IBS_FETCH_VAL                  (1ULL<<49)
-#define IBS_FETCH_ENABLE               (1ULL<<48)
-#define IBS_FETCH_CNT                  0xFFFF0000ULL
-#define IBS_FETCH_MAX_CNT              0x0000FFFFULL
+#define IBS_FETCH_RAND_EN      (1ULL<<57)
+#define IBS_FETCH_VAL          (1ULL<<49)
+#define IBS_FETCH_ENABLE       (1ULL<<48)
+#define IBS_FETCH_CNT          0xFFFF0000ULL
+#define IBS_FETCH_MAX_CNT      0x0000FFFFULL
 
 /* IbsOpCtl bits */
-#define IBS_OP_CNT_CTL                 (1ULL<<19)
-#define IBS_OP_VAL                     (1ULL<<18)
-#define IBS_OP_ENABLE                  (1ULL<<17)
-#define IBS_OP_MAX_CNT                 0x0000FFFFULL
+#define IBS_OP_CNT_CTL         (1ULL<<19)
+#define IBS_OP_VAL             (1ULL<<18)
+#define IBS_OP_ENABLE          (1ULL<<17)
+#define IBS_OP_MAX_CNT         0x0000FFFFULL
+#define IBS_OP_MAX_CNT_EXT     0x007FFFFFULL   /* not a register bit mask */
 
 #ifdef CONFIG_PERF_EVENTS
 extern void init_hw_perf_events(void);
index 4cfc908..4c2f63c 100644 (file)
@@ -50,7 +50,7 @@ struct smp_ops {
        void (*smp_prepare_cpus)(unsigned max_cpus);
        void (*smp_cpus_done)(unsigned max_cpus);
 
-       void (*smp_send_stop)(void);
+       void (*stop_other_cpus)(int wait);
        void (*smp_send_reschedule)(int cpu);
 
        int (*cpu_up)(unsigned cpu);
@@ -73,7 +73,12 @@ extern struct smp_ops smp_ops;
 
 static inline void smp_send_stop(void)
 {
-       smp_ops.smp_send_stop();
+       smp_ops.stop_other_cpus(0);
+}
+
+static inline void stop_other_cpus(void)
+{
+       smp_ops.stop_other_cpus(1);
 }
 
 static inline void smp_prepare_boot_cpu(void)
index c1e8c7a..ed63101 100644 (file)
@@ -237,6 +237,7 @@ struct x86_pmu {
         * Intel DebugStore bits
         */
        int             bts, pebs;
+       int             bts_active, pebs_active;
        int             pebs_record_size;
        void            (*drain_pebs)(struct pt_regs *regs);
        struct event_constraint *pebs_constraints;
@@ -380,7 +381,7 @@ static void release_pmc_hardware(void) {}
 
 #endif
 
-static int reserve_ds_buffers(void);
+static void reserve_ds_buffers(void);
 static void release_ds_buffers(void);
 
 static void hw_perf_event_destroy(struct perf_event *event)
@@ -477,7 +478,7 @@ static int x86_setup_perfctr(struct perf_event *event)
        if ((attr->config == PERF_COUNT_HW_BRANCH_INSTRUCTIONS) &&
            (hwc->sample_period == 1)) {
                /* BTS is not supported by this architecture. */
-               if (!x86_pmu.bts)
+               if (!x86_pmu.bts_active)
                        return -EOPNOTSUPP;
 
                /* BTS is currently only allowed for user-mode. */
@@ -496,12 +497,13 @@ static int x86_pmu_hw_config(struct perf_event *event)
                int precise = 0;
 
                /* Support for constant skid */
-               if (x86_pmu.pebs)
+               if (x86_pmu.pebs_active) {
                        precise++;
 
-               /* Support for IP fixup */
-               if (x86_pmu.lbr_nr)
-                       precise++;
+                       /* Support for IP fixup */
+                       if (x86_pmu.lbr_nr)
+                               precise++;
+               }
 
                if (event->attr.precise_ip > precise)
                        return -EOPNOTSUPP;
@@ -543,11 +545,8 @@ static int __x86_pmu_event_init(struct perf_event *event)
                if (atomic_read(&active_events) == 0) {
                        if (!reserve_pmc_hardware())
                                err = -EBUSY;
-                       else {
-                               err = reserve_ds_buffers();
-                               if (err)
-                                       release_pmc_hardware();
-                       }
+                       else
+                               reserve_ds_buffers();
                }
                if (!err)
                        atomic_inc(&active_events);
index 4977f9c..b7dcd9f 100644 (file)
@@ -74,6 +74,107 @@ static void fini_debug_store_on_cpu(int cpu)
        wrmsr_on_cpu(cpu, MSR_IA32_DS_AREA, 0, 0);
 }
 
+static int alloc_pebs_buffer(int cpu)
+{
+       struct debug_store *ds = per_cpu(cpu_hw_events, cpu).ds;
+       int node = cpu_to_node(cpu);
+       int max, thresh = 1; /* always use a single PEBS record */
+       void *buffer;
+
+       if (!x86_pmu.pebs)
+               return 0;
+
+       buffer = kmalloc_node(PEBS_BUFFER_SIZE, GFP_KERNEL | __GFP_ZERO, node);
+       if (unlikely(!buffer))
+               return -ENOMEM;
+
+       max = PEBS_BUFFER_SIZE / x86_pmu.pebs_record_size;
+
+       ds->pebs_buffer_base = (u64)(unsigned long)buffer;
+       ds->pebs_index = ds->pebs_buffer_base;
+       ds->pebs_absolute_maximum = ds->pebs_buffer_base +
+               max * x86_pmu.pebs_record_size;
+
+       ds->pebs_interrupt_threshold = ds->pebs_buffer_base +
+               thresh * x86_pmu.pebs_record_size;
+
+       return 0;
+}
+
+static void release_pebs_buffer(int cpu)
+{
+       struct debug_store *ds = per_cpu(cpu_hw_events, cpu).ds;
+
+       if (!ds || !x86_pmu.pebs)
+               return;
+
+       kfree((void *)(unsigned long)ds->pebs_buffer_base);
+       ds->pebs_buffer_base = 0;
+}
+
+static int alloc_bts_buffer(int cpu)
+{
+       struct debug_store *ds = per_cpu(cpu_hw_events, cpu).ds;
+       int node = cpu_to_node(cpu);
+       int max, thresh;
+       void *buffer;
+
+       if (!x86_pmu.bts)
+               return 0;
+
+       buffer = kmalloc_node(BTS_BUFFER_SIZE, GFP_KERNEL | __GFP_ZERO, node);
+       if (unlikely(!buffer))
+               return -ENOMEM;
+
+       max = BTS_BUFFER_SIZE / BTS_RECORD_SIZE;
+       thresh = max / 16;
+
+       ds->bts_buffer_base = (u64)(unsigned long)buffer;
+       ds->bts_index = ds->bts_buffer_base;
+       ds->bts_absolute_maximum = ds->bts_buffer_base +
+               max * BTS_RECORD_SIZE;
+       ds->bts_interrupt_threshold = ds->bts_absolute_maximum -
+               thresh * BTS_RECORD_SIZE;
+
+       return 0;
+}
+
+static void release_bts_buffer(int cpu)
+{
+       struct debug_store *ds = per_cpu(cpu_hw_events, cpu).ds;
+
+       if (!ds || !x86_pmu.bts)
+               return;
+
+       kfree((void *)(unsigned long)ds->bts_buffer_base);
+       ds->bts_buffer_base = 0;
+}
+
+static int alloc_ds_buffer(int cpu)
+{
+       int node = cpu_to_node(cpu);
+       struct debug_store *ds;
+
+       ds = kmalloc_node(sizeof(*ds), GFP_KERNEL | __GFP_ZERO, node);
+       if (unlikely(!ds))
+               return -ENOMEM;
+
+       per_cpu(cpu_hw_events, cpu).ds = ds;
+
+       return 0;
+}
+
+static void release_ds_buffer(int cpu)
+{
+       struct debug_store *ds = per_cpu(cpu_hw_events, cpu).ds;
+
+       if (!ds)
+               return;
+
+       per_cpu(cpu_hw_events, cpu).ds = NULL;
+       kfree(ds);
+}
+
 static void release_ds_buffers(void)
 {
        int cpu;
@@ -82,93 +183,77 @@ static void release_ds_buffers(void)
                return;
 
        get_online_cpus();
-
        for_each_online_cpu(cpu)
                fini_debug_store_on_cpu(cpu);
 
        for_each_possible_cpu(cpu) {
-               struct debug_store *ds = per_cpu(cpu_hw_events, cpu).ds;
-
-               if (!ds)
-                       continue;
-
-               per_cpu(cpu_hw_events, cpu).ds = NULL;
-
-               kfree((void *)(unsigned long)ds->pebs_buffer_base);
-               kfree((void *)(unsigned long)ds->bts_buffer_base);
-               kfree(ds);
+               release_pebs_buffer(cpu);
+               release_bts_buffer(cpu);
+               release_ds_buffer(cpu);
        }
-
        put_online_cpus();
 }
 
-static int reserve_ds_buffers(void)
+static void reserve_ds_buffers(void)
 {
-       int cpu, err = 0;
+       int bts_err = 0, pebs_err = 0;
+       int cpu;
+
+       x86_pmu.bts_active = 0;
+       x86_pmu.pebs_active = 0;
 
        if (!x86_pmu.bts && !x86_pmu.pebs)
-               return 0;
+               return;
+
+       if (!x86_pmu.bts)
+               bts_err = 1;
+
+       if (!x86_pmu.pebs)
+               pebs_err = 1;
 
        get_online_cpus();
 
        for_each_possible_cpu(cpu) {
-               struct debug_store *ds;
-               void *buffer;
-               int max, thresh;
+               if (alloc_ds_buffer(cpu)) {
+                       bts_err = 1;
+                       pebs_err = 1;
+               }
+
+               if (!bts_err && alloc_bts_buffer(cpu))
+                       bts_err = 1;
 
-               err = -ENOMEM;
-               ds = kzalloc(sizeof(*ds), GFP_KERNEL);
-               if (unlikely(!ds))
+               if (!pebs_err && alloc_pebs_buffer(cpu))
+                       pebs_err = 1;
+
+               if (bts_err && pebs_err)
                        break;
-               per_cpu(cpu_hw_events, cpu).ds = ds;
-
-               if (x86_pmu.bts) {
-                       buffer = kzalloc(BTS_BUFFER_SIZE, GFP_KERNEL);
-                       if (unlikely(!buffer))
-                               break;
-
-                       max = BTS_BUFFER_SIZE / BTS_RECORD_SIZE;
-                       thresh = max / 16;
-
-                       ds->bts_buffer_base = (u64)(unsigned long)buffer;
-                       ds->bts_index = ds->bts_buffer_base;
-                       ds->bts_absolute_maximum = ds->bts_buffer_base +
-                               max * BTS_RECORD_SIZE;
-                       ds->bts_interrupt_threshold = ds->bts_absolute_maximum -
-                               thresh * BTS_RECORD_SIZE;
-               }
+       }
 
-               if (x86_pmu.pebs) {
-                       buffer = kzalloc(PEBS_BUFFER_SIZE, GFP_KERNEL);
-                       if (unlikely(!buffer))
-                               break;
-
-                       max = PEBS_BUFFER_SIZE / x86_pmu.pebs_record_size;
-
-                       ds->pebs_buffer_base = (u64)(unsigned long)buffer;
-                       ds->pebs_index = ds->pebs_buffer_base;
-                       ds->pebs_absolute_maximum = ds->pebs_buffer_base +
-                               max * x86_pmu.pebs_record_size;
-                       /*
-                        * Always use single record PEBS
-                        */
-                       ds->pebs_interrupt_threshold = ds->pebs_buffer_base +
-                               x86_pmu.pebs_record_size;
-               }
+       if (bts_err) {
+               for_each_possible_cpu(cpu)
+                       release_bts_buffer(cpu);
+       }
 
-               err = 0;
+       if (pebs_err) {
+               for_each_possible_cpu(cpu)
+                       release_pebs_buffer(cpu);
        }
 
-       if (err)
-               release_ds_buffers();
-       else {
+       if (bts_err && pebs_err) {
+               for_each_possible_cpu(cpu)
+                       release_ds_buffer(cpu);
+       } else {
+               if (x86_pmu.bts && !bts_err)
+                       x86_pmu.bts_active = 1;
+
+               if (x86_pmu.pebs && !pebs_err)
+                       x86_pmu.pebs_active = 1;
+
                for_each_online_cpu(cpu)
                        init_debug_store_on_cpu(cpu);
        }
 
        put_online_cpus();
-
-       return err;
 }
 
 /*
@@ -233,7 +318,7 @@ static int intel_pmu_drain_bts_buffer(void)
        if (!event)
                return 0;
 
-       if (!ds)
+       if (!x86_pmu.bts_active)
                return 0;
 
        at  = (struct bts_record *)(unsigned long)ds->bts_buffer_base;
@@ -503,7 +588,7 @@ static void intel_pmu_drain_pebs_core(struct pt_regs *iregs)
        struct pebs_record_core *at, *top;
        int n;
 
-       if (!ds || !x86_pmu.pebs)
+       if (!x86_pmu.pebs_active)
                return;
 
        at  = (struct pebs_record_core *)(unsigned long)ds->pebs_buffer_base;
@@ -545,7 +630,7 @@ static void intel_pmu_drain_pebs_nhm(struct pt_regs *iregs)
        u64 status = 0;
        int bit, n;
 
-       if (!ds || !x86_pmu.pebs)
+       if (!x86_pmu.pebs_active)
                return;
 
        at  = (struct pebs_record_nhm *)(unsigned long)ds->pebs_buffer_base;
@@ -630,9 +715,8 @@ static void intel_ds_init(void)
 
 #else /* CONFIG_CPU_SUP_INTEL */
 
-static int reserve_ds_buffers(void)
+static void reserve_ds_buffers(void)
 {
-       return 0;
 }
 
 static void release_ds_buffers(void)
index 0f6376f..1bc7f75 100644 (file)
@@ -82,11 +82,11 @@ show_stack_log_lvl(struct task_struct *task, struct pt_regs *regs,
                if (kstack_end(stack))
                        break;
                if (i && ((i % STACKSLOTS_PER_LINE) == 0))
-                       printk("\n%s", log_lvl);
-               printk(" %08lx", *stack++);
+                       printk(KERN_CONT "\n");
+               printk(KERN_CONT " %08lx", *stack++);
                touch_nmi_watchdog();
        }
-       printk("\n");
+       printk(KERN_CONT "\n");
        show_trace_log_lvl(task, regs, sp, bp, log_lvl);
 }
 
index 57a21f1..6a34048 100644 (file)
@@ -265,20 +265,20 @@ show_stack_log_lvl(struct task_struct *task, struct pt_regs *regs,
                if (stack >= irq_stack && stack <= irq_stack_end) {
                        if (stack == irq_stack_end) {
                                stack = (unsigned long *) (irq_stack_end[-1]);
-                               printk(" <EOI> ");
+                               printk(KERN_CONT " <EOI> ");
                        }
                } else {
                if (((long) stack & (THREAD_SIZE-1)) == 0)
                        break;
                }
                if (i && ((i % STACKSLOTS_PER_LINE) == 0))
-                       printk("\n%s", log_lvl);
-               printk(" %016lx", *stack++);
+                       printk(KERN_CONT "\n");
+               printk(KERN_CONT " %016lx", *stack++);
                touch_nmi_watchdog();
        }
        preempt_enable();
 
-       printk("\n");
+       printk(KERN_CONT "\n");
        show_trace_log_lvl(task, regs, sp, bp, log_lvl);
 }
 
index 50fbbe6..64668db 100644 (file)
@@ -60,9 +60,6 @@ union irq_ctx {
 static DEFINE_PER_CPU(union irq_ctx *, hardirq_ctx);
 static DEFINE_PER_CPU(union irq_ctx *, softirq_ctx);
 
-static DEFINE_PER_CPU_MULTIPAGE_ALIGNED(union irq_ctx, hardirq_stack, THREAD_SIZE);
-static DEFINE_PER_CPU_MULTIPAGE_ALIGNED(union irq_ctx, softirq_stack, THREAD_SIZE);
-
 static void call_on_stack(void *func, void *stack)
 {
        asm volatile("xchgl     %%ebx,%%esp     \n"
@@ -128,7 +125,7 @@ void __cpuinit irq_ctx_init(int cpu)
        if (per_cpu(hardirq_ctx, cpu))
                return;
 
-       irqctx = &per_cpu(hardirq_stack, cpu);
+       irqctx = (union irq_ctx *)__get_free_pages(THREAD_FLAGS, THREAD_ORDER);
        irqctx->tinfo.task              = NULL;
        irqctx->tinfo.exec_domain       = NULL;
        irqctx->tinfo.cpu               = cpu;
@@ -137,7 +134,7 @@ void __cpuinit irq_ctx_init(int cpu)
 
        per_cpu(hardirq_ctx, cpu) = irqctx;
 
-       irqctx = &per_cpu(softirq_stack, cpu);
+       irqctx = (union irq_ctx *)__get_free_pages(THREAD_FLAGS, THREAD_ORDER);
        irqctx->tinfo.task              = NULL;
        irqctx->tinfo.exec_domain       = NULL;
        irqctx->tinfo.cpu               = cpu;
@@ -150,11 +147,6 @@ void __cpuinit irq_ctx_init(int cpu)
               cpu, per_cpu(hardirq_ctx, cpu),  per_cpu(softirq_ctx, cpu));
 }
 
-void irq_ctx_exit(int cpu)
-{
-       per_cpu(hardirq_ctx, cpu) = NULL;
-}
-
 asmlinkage void do_softirq(void)
 {
        unsigned long flags;
index 70c4872..45892dc 100644 (file)
@@ -801,7 +801,8 @@ void ptrace_disable(struct task_struct *child)
 static const struct user_regset_view user_x86_32_view; /* Initialized below. */
 #endif
 
-long arch_ptrace(struct task_struct *child, long request, long addr, long data)
+long arch_ptrace(struct task_struct *child, long request,
+                unsigned long addr, unsigned long data)
 {
        int ret;
        unsigned long __user *datap = (unsigned long __user *)data;
@@ -812,8 +813,7 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
                unsigned long tmp;
 
                ret = -EIO;
-               if ((addr & (sizeof(data) - 1)) || addr < 0 ||
-                   addr >= sizeof(struct user))
+               if ((addr & (sizeof(data) - 1)) || addr >= sizeof(struct user))
                        break;
 
                tmp = 0;  /* Default return condition */
@@ -830,8 +830,7 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
 
        case PTRACE_POKEUSR: /* write the word at location addr in the USER area */
                ret = -EIO;
-               if ((addr & (sizeof(data) - 1)) || addr < 0 ||
-                   addr >= sizeof(struct user))
+               if ((addr & (sizeof(data) - 1)) || addr >= sizeof(struct user))
                        break;
 
                if (addr < sizeof(struct user_regs_struct))
@@ -888,17 +887,17 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
 
 #if defined CONFIG_X86_32 || defined CONFIG_IA32_EMULATION
        case PTRACE_GET_THREAD_AREA:
-               if (addr < 0)
+               if ((int) addr < 0)
                        return -EIO;
                ret = do_get_thread_area(child, addr,
-                                        (struct user_desc __user *) data);
+                                       (struct user_desc __user *)data);
                break;
 
        case PTRACE_SET_THREAD_AREA:
-               if (addr < 0)
+               if ((int) addr < 0)
                        return -EIO;
                ret = do_set_thread_area(child, addr,
-                                        (struct user_desc __user *) data, 0);
+                                       (struct user_desc __user *)data, 0);
                break;
 #endif
 
index f7f53dc..c495aa8 100644 (file)
@@ -635,7 +635,7 @@ void native_machine_shutdown(void)
        /* O.K Now that I'm on the appropriate processor,
         * stop all of the others.
         */
-       smp_send_stop();
+       stop_other_cpus();
 #endif
 
        lapic_shutdown();
index d801210..513deac 100644 (file)
@@ -159,10 +159,10 @@ asmlinkage void smp_reboot_interrupt(void)
        irq_exit();
 }
 
-static void native_smp_send_stop(void)
+static void native_stop_other_cpus(int wait)
 {
        unsigned long flags;
-       unsigned long wait;
+       unsigned long timeout;
 
        if (reboot_force)
                return;
@@ -179,9 +179,12 @@ static void native_smp_send_stop(void)
        if (num_online_cpus() > 1) {
                apic->send_IPI_allbutself(REBOOT_VECTOR);
 
-               /* Don't wait longer than a second */
-               wait = USEC_PER_SEC;
-               while (num_online_cpus() > 1 && wait--)
+               /*
+                * Don't wait longer than a second if the caller
+                * didn't ask us to wait.
+                */
+               timeout = USEC_PER_SEC;
+               while (num_online_cpus() > 1 && (wait || timeout--))
                        udelay(1);
        }
 
@@ -227,7 +230,7 @@ struct smp_ops smp_ops = {
        .smp_prepare_cpus       = native_smp_prepare_cpus,
        .smp_cpus_done          = native_smp_cpus_done,
 
-       .smp_send_stop          = native_smp_send_stop,
+       .stop_other_cpus        = native_stop_other_cpus,
        .smp_send_reschedule    = native_smp_send_reschedule,
 
        .cpu_up                 = native_cpu_up,
index 6c7faec..083e99d 100644 (file)
@@ -1373,7 +1373,6 @@ void play_dead_common(void)
 {
        idle_task_exit();
        reset_lazy_tlbstate();
-       irq_ctx_exit(raw_smp_processor_id());
        c1e_remove_cpu(raw_smp_processor_id());
 
        mb();
index d723e36..b499626 100644 (file)
@@ -74,7 +74,7 @@ void __kunmap_atomic(void *kvaddr)
            vaddr <= __fix_to_virt(FIX_KMAP_BEGIN)) {
                int idx, type;
 
-               type = kmap_atomic_idx_pop();
+               type = kmap_atomic_idx();
                idx = type + KM_TYPE_NR * smp_processor_id();
 
 #ifdef CONFIG_DEBUG_HIGHMEM
@@ -87,6 +87,7 @@ void __kunmap_atomic(void *kvaddr)
                 * attributes or becomes a protected page in a hypervisor.
                 */
                kpte_clear_flush(kmap_pte-idx, vaddr);
+               kmap_atomic_idx_pop();
        }
 #ifdef CONFIG_DEBUG_HIGHMEM
        else {
index 8434620..71a5929 100644 (file)
@@ -51,7 +51,6 @@
 #include <asm/numa.h>
 #include <asm/cacheflush.h>
 #include <asm/init.h>
-#include <linux/bootmem.h>
 
 static int __init parse_direct_gbpages_off(char *arg)
 {
index 75a3d7f..7b179b4 100644 (file)
@@ -98,7 +98,7 @@ iounmap_atomic(void __iomem *kvaddr)
            vaddr <= __fix_to_virt(FIX_KMAP_BEGIN)) {
                int idx, type;
 
-               type = kmap_atomic_idx_pop();
+               type = kmap_atomic_idx();
                idx = type + KM_TYPE_NR * smp_processor_id();
 
 #ifdef CONFIG_DEBUG_HIGHMEM
@@ -111,6 +111,7 @@ iounmap_atomic(void __iomem *kvaddr)
                 * attributes or becomes a protected page in a hypervisor.
                 */
                kpte_clear_flush(kmap_pte-idx, vaddr);
+               kmap_atomic_idx_pop();
        }
 
        pagefault_enable();
index bd1489c..4e8baad 100644 (file)
@@ -726,6 +726,12 @@ int __init op_nmi_init(struct oprofile_operations *ops)
                case 0x11:
                        cpu_type = "x86-64/family11h";
                        break;
+               case 0x12:
+                       cpu_type = "x86-64/family12h";
+                       break;
+               case 0x14:
+                       cpu_type = "x86-64/family14h";
+                       break;
                default:
                        return -ENODEV;
                }
index 42fb46f..a011bcc 100644 (file)
@@ -48,17 +48,24 @@ static unsigned long reset_value[NUM_VIRT_COUNTERS];
 
 static u32 ibs_caps;
 
-struct op_ibs_config {
+struct ibs_config {
        unsigned long op_enabled;
        unsigned long fetch_enabled;
        unsigned long max_cnt_fetch;
        unsigned long max_cnt_op;
        unsigned long rand_en;
        unsigned long dispatched_ops;
+       unsigned long branch_target;
 };
 
-static struct op_ibs_config ibs_config;
-static u64 ibs_op_ctl;
+struct ibs_state {
+       u64             ibs_op_ctl;
+       int             branch_target;
+       unsigned long   sample_size;
+};
+
+static struct ibs_config ibs_config;
+static struct ibs_state ibs_state;
 
 /*
  * IBS cpuid feature detection
@@ -71,8 +78,16 @@ static u64 ibs_op_ctl;
  * bit 0 is used to indicate the existence of IBS.
  */
 #define IBS_CAPS_AVAIL                 (1U<<0)
+#define IBS_CAPS_FETCHSAM              (1U<<1)
+#define IBS_CAPS_OPSAM                 (1U<<2)
 #define IBS_CAPS_RDWROPCNT             (1U<<3)
 #define IBS_CAPS_OPCNT                 (1U<<4)
+#define IBS_CAPS_BRNTRGT               (1U<<5)
+#define IBS_CAPS_OPCNTEXT              (1U<<6)
+
+#define IBS_CAPS_DEFAULT               (IBS_CAPS_AVAIL         \
+                                        | IBS_CAPS_FETCHSAM    \
+                                        | IBS_CAPS_OPSAM)
 
 /*
  * IBS APIC setup
@@ -99,12 +114,12 @@ static u32 get_ibs_caps(void)
        /* check IBS cpuid feature flags */
        max_level = cpuid_eax(0x80000000);
        if (max_level < IBS_CPUID_FEATURES)
-               return IBS_CAPS_AVAIL;
+               return IBS_CAPS_DEFAULT;
 
        ibs_caps = cpuid_eax(IBS_CPUID_FEATURES);
        if (!(ibs_caps & IBS_CAPS_AVAIL))
                /* cpuid flags not valid */
-               return IBS_CAPS_AVAIL;
+               return IBS_CAPS_DEFAULT;
 
        return ibs_caps;
 }
@@ -197,8 +212,8 @@ op_amd_handle_ibs(struct pt_regs * const regs,
                rdmsrl(MSR_AMD64_IBSOPCTL, ctl);
                if (ctl & IBS_OP_VAL) {
                        rdmsrl(MSR_AMD64_IBSOPRIP, val);
-                       oprofile_write_reserve(&entry, regs, val,
-                                              IBS_OP_CODE, IBS_OP_SIZE);
+                       oprofile_write_reserve(&entry, regs, val, IBS_OP_CODE,
+                                              ibs_state.sample_size);
                        oprofile_add_data64(&entry, val);
                        rdmsrl(MSR_AMD64_IBSOPDATA, val);
                        oprofile_add_data64(&entry, val);
@@ -210,10 +225,14 @@ op_amd_handle_ibs(struct pt_regs * const regs,
                        oprofile_add_data64(&entry, val);
                        rdmsrl(MSR_AMD64_IBSDCPHYSAD, val);
                        oprofile_add_data64(&entry, val);
+                       if (ibs_state.branch_target) {
+                               rdmsrl(MSR_AMD64_IBSBRTARGET, val);
+                               oprofile_add_data(&entry, (unsigned long)val);
+                       }
                        oprofile_write_commit(&entry);
 
                        /* reenable the IRQ */
-                       ctl = op_amd_randomize_ibs_op(ibs_op_ctl);
+                       ctl = op_amd_randomize_ibs_op(ibs_state.ibs_op_ctl);
                        wrmsrl(MSR_AMD64_IBSOPCTL, ctl);
                }
        }
@@ -226,21 +245,32 @@ static inline void op_amd_start_ibs(void)
        if (!ibs_caps)
                return;
 
+       memset(&ibs_state, 0, sizeof(ibs_state));
+
+       /*
+        * Note: Since the max count settings may out of range we
+        * write back the actual used values so that userland can read
+        * it.
+        */
+
        if (ibs_config.fetch_enabled) {
-               val = (ibs_config.max_cnt_fetch >> 4) & IBS_FETCH_MAX_CNT;
+               val = ibs_config.max_cnt_fetch >> 4;
+               val = min(val, IBS_FETCH_MAX_CNT);
+               ibs_config.max_cnt_fetch = val << 4;
                val |= ibs_config.rand_en ? IBS_FETCH_RAND_EN : 0;
                val |= IBS_FETCH_ENABLE;
                wrmsrl(MSR_AMD64_IBSFETCHCTL, val);
        }
 
        if (ibs_config.op_enabled) {
-               ibs_op_ctl = ibs_config.max_cnt_op >> 4;
+               val = ibs_config.max_cnt_op >> 4;
                if (!(ibs_caps & IBS_CAPS_RDWROPCNT)) {
                        /*
                         * IbsOpCurCnt not supported.  See
                         * op_amd_randomize_ibs_op() for details.
                         */
-                       ibs_op_ctl = clamp(ibs_op_ctl, 0x0081ULL, 0xFF80ULL);
+                       val = clamp(val, 0x0081ULL, 0xFF80ULL);
+                       ibs_config.max_cnt_op = val << 4;
                } else {
                        /*
                         * The start value is randomized with a
@@ -248,13 +278,24 @@ static inline void op_amd_start_ibs(void)
                         * with the half of the randomized range. Also
                         * avoid underflows.
                         */
-                       ibs_op_ctl = min(ibs_op_ctl + IBS_RANDOM_MAXCNT_OFFSET,
-                                        IBS_OP_MAX_CNT);
+                       val += IBS_RANDOM_MAXCNT_OFFSET;
+                       if (ibs_caps & IBS_CAPS_OPCNTEXT)
+                               val = min(val, IBS_OP_MAX_CNT_EXT);
+                       else
+                               val = min(val, IBS_OP_MAX_CNT);
+                       ibs_config.max_cnt_op =
+                               (val - IBS_RANDOM_MAXCNT_OFFSET) << 4;
+               }
+               val = ((val & ~IBS_OP_MAX_CNT) << 4) | (val & IBS_OP_MAX_CNT);
+               val |= ibs_config.dispatched_ops ? IBS_OP_CNT_CTL : 0;
+               val |= IBS_OP_ENABLE;
+               ibs_state.ibs_op_ctl = val;
+               ibs_state.sample_size = IBS_OP_SIZE;
+               if (ibs_config.branch_target) {
+                       ibs_state.branch_target = 1;
+                       ibs_state.sample_size++;
                }
-               if (ibs_caps & IBS_CAPS_OPCNT && ibs_config.dispatched_ops)
-                       ibs_op_ctl |= IBS_OP_CNT_CTL;
-               ibs_op_ctl |= IBS_OP_ENABLE;
-               val = op_amd_randomize_ibs_op(ibs_op_ctl);
+               val = op_amd_randomize_ibs_op(ibs_state.ibs_op_ctl);
                wrmsrl(MSR_AMD64_IBSOPCTL, val);
        }
 }
@@ -281,29 +322,25 @@ static inline int eilvt_is_available(int offset)
 
 static inline int ibs_eilvt_valid(void)
 {
-       u64 val;
        int offset;
+       u64 val;
 
        rdmsrl(MSR_AMD64_IBSCTL, val);
+       offset = val & IBSCTL_LVT_OFFSET_MASK;
+
        if (!(val & IBSCTL_LVT_OFFSET_VALID)) {
-               pr_err(FW_BUG "cpu %d, invalid IBS "
-                      "interrupt offset %d (MSR%08X=0x%016llx)",
-                      smp_processor_id(), offset,
-                      MSR_AMD64_IBSCTL, val);
+               pr_err(FW_BUG "cpu %d, invalid IBS interrupt offset %d (MSR%08X=0x%016llx)\n",
+                      smp_processor_id(), offset, MSR_AMD64_IBSCTL, val);
                return 0;
        }
 
-       offset = val & IBSCTL_LVT_OFFSET_MASK;
-
-       if (eilvt_is_available(offset))
-               return !0;
-
-       pr_err(FW_BUG "cpu %d, IBS interrupt offset %d "
-              "not available (MSR%08X=0x%016llx)",
-              smp_processor_id(), offset,
-              MSR_AMD64_IBSCTL, val);
+       if (!eilvt_is_available(offset)) {
+               pr_err(FW_BUG "cpu %d, IBS interrupt offset %d not available (MSR%08X=0x%016llx)\n",
+                      smp_processor_id(), offset, MSR_AMD64_IBSCTL, val);
+               return 0;
+       }
 
-       return 0;
+       return 1;
 }
 
 static inline int get_ibs_offset(void)
@@ -630,28 +667,33 @@ static int setup_ibs_files(struct super_block *sb, struct dentry *root)
        /* model specific files */
 
        /* setup some reasonable defaults */
+       memset(&ibs_config, 0, sizeof(ibs_config));
        ibs_config.max_cnt_fetch = 250000;
-       ibs_config.fetch_enabled = 0;
        ibs_config.max_cnt_op = 250000;
-       ibs_config.op_enabled = 0;
-       ibs_config.dispatched_ops = 0;
-
-       dir = oprofilefs_mkdir(sb, root, "ibs_fetch");
-       oprofilefs_create_ulong(sb, dir, "enable",
-                               &ibs_config.fetch_enabled);
-       oprofilefs_create_ulong(sb, dir, "max_count",
-                               &ibs_config.max_cnt_fetch);
-       oprofilefs_create_ulong(sb, dir, "rand_enable",
-                               &ibs_config.rand_en);
-
-       dir = oprofilefs_mkdir(sb, root, "ibs_op");
-       oprofilefs_create_ulong(sb, dir, "enable",
-                               &ibs_config.op_enabled);
-       oprofilefs_create_ulong(sb, dir, "max_count",
-                               &ibs_config.max_cnt_op);
-       if (ibs_caps & IBS_CAPS_OPCNT)
-               oprofilefs_create_ulong(sb, dir, "dispatched_ops",
-                                       &ibs_config.dispatched_ops);
+
+       if (ibs_caps & IBS_CAPS_FETCHSAM) {
+               dir = oprofilefs_mkdir(sb, root, "ibs_fetch");
+               oprofilefs_create_ulong(sb, dir, "enable",
+                                       &ibs_config.fetch_enabled);
+               oprofilefs_create_ulong(sb, dir, "max_count",
+                                       &ibs_config.max_cnt_fetch);
+               oprofilefs_create_ulong(sb, dir, "rand_enable",
+                                       &ibs_config.rand_en);
+       }
+
+       if (ibs_caps & IBS_CAPS_OPSAM) {
+               dir = oprofilefs_mkdir(sb, root, "ibs_op");
+               oprofilefs_create_ulong(sb, dir, "enable",
+                                       &ibs_config.op_enabled);
+               oprofilefs_create_ulong(sb, dir, "max_count",
+                                       &ibs_config.max_cnt_op);
+               if (ibs_caps & IBS_CAPS_OPCNT)
+                       oprofilefs_create_ulong(sb, dir, "dispatched_ops",
+                                               &ibs_config.dispatched_ops);
+               if (ibs_caps & IBS_CAPS_BRNTRGT)
+                       oprofilefs_create_ulong(sb, dir, "branch_target",
+                                               &ibs_config.branch_target);
+       }
 
        return 0;
 }
index 44ab12d..70ddeae 100644 (file)
@@ -59,7 +59,6 @@
 #include <asm/pgtable.h>
 #include <asm/tlbflush.h>
 #include <asm/reboot.h>
-#include <asm/setup.h>
 #include <asm/stackprotector.h>
 #include <asm/hypervisor.h>
 
@@ -1016,7 +1015,7 @@ static void xen_reboot(int reason)
        struct sched_shutdown r = { .reason = reason };
 
 #ifdef CONFIG_SMP
-       smp_send_stop();
+       stop_other_cpus();
 #endif
 
        if (HYPERVISOR_sched_op(SCHEDOP_shutdown, &r))
index 25f232b..f4d0100 100644 (file)
@@ -400,9 +400,9 @@ static void stop_self(void *v)
        BUG();
 }
 
-static void xen_smp_send_stop(void)
+static void xen_stop_other_cpus(int wait)
 {
-       smp_call_function(stop_self, NULL, 0);
+       smp_call_function(stop_self, NULL, wait);
 }
 
 static void xen_smp_send_reschedule(int cpu)
@@ -470,7 +470,7 @@ static const struct smp_ops xen_smp_ops __initdata = {
        .cpu_disable = xen_cpu_disable,
        .play_dead = xen_play_dead,
 
-       .smp_send_stop = xen_smp_send_stop,
+       .stop_other_cpus = xen_stop_other_cpus,
        .smp_send_reschedule = xen_smp_send_reschedule,
 
        .send_call_func_ipi = xen_smp_send_call_function_ipi,
index 9d4e1ce..c72c947 100644 (file)
@@ -256,9 +256,11 @@ int ptrace_pokeusr(struct task_struct *child, long regno, long val)
        return 0;
 }
 
-long arch_ptrace(struct task_struct *child, long request, long addr, long data)
+long arch_ptrace(struct task_struct *child, long request,
+                unsigned long addr, unsigned long data)
 {
        int ret = -EPERM;
+       void __user *datap = (void __user *) data;
 
        switch (request) {
        case PTRACE_PEEKTEXT:   /* read word at location addr. */
@@ -267,7 +269,7 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
                break;
 
        case PTRACE_PEEKUSR:    /* read register specified by addr. */
-               ret = ptrace_peekusr(child, addr, (void __user *) data);
+               ret = ptrace_peekusr(child, addr, datap);
                break;
 
        case PTRACE_POKETEXT:   /* write the word at location addr. */
@@ -280,19 +282,19 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
                break;
 
        case PTRACE_GETREGS:
-               ret = ptrace_getregs(child, (void __user *) data);
+               ret = ptrace_getregs(child, datap);
                break;
 
        case PTRACE_SETREGS:
-               ret = ptrace_setregs(child, (void __user *) data);
+               ret = ptrace_setregs(child, datap);
                break;
 
        case PTRACE_GETXTREGS:
-               ret = ptrace_getxregs(child, (void __user *) data);
+               ret = ptrace_getxregs(child, datap);
                break;
 
        case PTRACE_SETXTREGS:
-               ret = ptrace_setxregs(child, (void __user *) data);
+               ret = ptrace_setxregs(child, datap);
                break;
 
        default:
index 80f9f36..97c5898 100644 (file)
@@ -1736,9 +1736,10 @@ static int __devinit eni_do_init(struct atm_dev *dev)
                eprom = (base+EPROM_SIZE-sizeof(struct midway_eprom));
                if (readl(&eprom->magic) != ENI155_MAGIC) {
                        printk("\n");
-                       printk(KERN_ERR KERN_ERR DEV_LABEL "(itf %d): bad "
-                           "magic - expected 0x%x, got 0x%x\n",dev->number,
-                           ENI155_MAGIC,(unsigned) readl(&eprom->magic));
+                       printk(KERN_ERR DEV_LABEL
+                              "(itf %d): bad magic - expected 0x%x, got 0x%x\n",
+                              dev->number, ENI155_MAGIC,
+                              (unsigned)readl(&eprom->magic));
                        error = -EINVAL;
                        goto unmap;
                }
index e7ba774..25373df 100644 (file)
@@ -566,6 +566,7 @@ static ssize_t ac_read (struct file *filp, char __user *buf, size_t count, loff_
                                struct mailbox mailbox;
 
                                /* Got a packet for us */
+                               memset(&st_loc, 0, sizeof(st_loc));
                                ret = do_ac_read(i, buf, &st_loc, &mailbox);
                                spin_unlock_irqrestore(&apbs[i].mutex, flags);
                                set_current_state(TASK_RUNNING);
index 3afd62e..e9cba13 100644 (file)
@@ -713,7 +713,6 @@ static int khvcd(void *unused)
        struct hvc_struct *hp;
 
        set_freezable();
-       __set_current_state(TASK_RUNNING);
        do {
                poll_mask = 0;
                hvc_kicked = 0;
index bc397d9..7b78e0d 100644 (file)
@@ -4,5 +4,5 @@
 
 obj-$(CONFIG_COMPUTONE)         += ip2.o
 
-ip2-objs                       := ip2main.o
+ip2-y                  := ip2main.o
 
index eb8a1a8..16a9364 100644 (file)
@@ -2,7 +2,7 @@
 # Makefile for the ipmi drivers.
 #
 
-ipmi_si-objs := ipmi_si_intf.o ipmi_kcs_sm.o ipmi_smic_sm.o ipmi_bt_sm.o
+ipmi_si-y := ipmi_si_intf.o ipmi_kcs_sm.o ipmi_smic_sm.o ipmi_bt_sm.o
 
 obj-$(CONFIG_IPMI_HANDLER) += ipmi_msghandler.o
 obj-$(CONFIG_IPMI_DEVICE_INTERFACE) += ipmi_devintf.o
index 1fc8876..2aa3977 100644 (file)
@@ -916,7 +916,7 @@ static struct ipmi_smi_watcher smi_watcher =
        .smi_gone = ipmi_smi_gone,
 };
 
-static __init int init_ipmi_devintf(void)
+static int __init init_ipmi_devintf(void)
 {
        int rv;
 
@@ -954,7 +954,7 @@ static __init int init_ipmi_devintf(void)
 }
 module_init(init_ipmi_devintf);
 
-static __exit void cleanup_ipmi(void)
+static void __exit cleanup_ipmi(void)
 {
        struct ipmi_reg_list *entry, *entry2;
        mutex_lock(&reg_list_mutex);
index 4f3f8c9..2fe72f8 100644 (file)
@@ -4442,13 +4442,13 @@ static int ipmi_init_msghandler(void)
        return 0;
 }
 
-static __init int ipmi_init_msghandler_mod(void)
+static int __init ipmi_init_msghandler_mod(void)
 {
        ipmi_init_msghandler();
        return 0;
 }
 
-static __exit void cleanup_ipmi(void)
+static void __exit cleanup_ipmi(void)
 {
        int count;
 
index b293d57..035da9e 100644 (file)
@@ -1846,7 +1846,7 @@ static int hotmod_handler(const char *val, struct kernel_param *kp)
        return rv;
 }
 
-static __devinit void hardcode_find_bmc(void)
+static void __devinit hardcode_find_bmc(void)
 {
        int             i;
        struct smi_info *info;
@@ -2029,7 +2029,7 @@ struct SPMITable {
        s8      spmi_id[1]; /* A '\0' terminated array starts here. */
 };
 
-static __devinit int try_init_spmi(struct SPMITable *spmi)
+static int __devinit try_init_spmi(struct SPMITable *spmi)
 {
        struct smi_info  *info;
 
@@ -2112,7 +2112,7 @@ static __devinit int try_init_spmi(struct SPMITable *spmi)
        return 0;
 }
 
-static __devinit void spmi_find_bmc(void)
+static void __devinit spmi_find_bmc(void)
 {
        acpi_status      status;
        struct SPMITable *spmi;
@@ -2325,7 +2325,7 @@ static int __devinit decode_dmi(const struct dmi_header *dm,
        return 0;
 }
 
-static __devinit void try_init_dmi(struct dmi_ipmi_data *ipmi_data)
+static void __devinit try_init_dmi(struct dmi_ipmi_data *ipmi_data)
 {
        struct smi_info *info;
 
@@ -3012,7 +3012,7 @@ static __devinitdata struct ipmi_default_vals
        { .port = 0 }
 };
 
-static __devinit void default_find_bmc(void)
+static void __devinit default_find_bmc(void)
 {
        struct smi_info *info;
        int             i;
@@ -3312,7 +3312,7 @@ static int try_smi_init(struct smi_info *new_smi)
        return rv;
 }
 
-static __devinit int init_ipmi_si(void)
+static int __devinit init_ipmi_si(void)
 {
        int  i;
        char *str;
@@ -3525,7 +3525,7 @@ static void cleanup_one_si(struct smi_info *to_clean)
        kfree(to_clean);
 }
 
-static __exit void cleanup_ipmi_si(void)
+static void __exit cleanup_ipmi_si(void)
 {
        struct smi_info *e, *tmp_e;
 
index c070b53..e6d7562 100644 (file)
@@ -176,9 +176,9 @@ static void mmtimer_setup_int_2(int cpu, u64 expires)
  * in order to insure that the setup succeeds in a deterministic time frame.
  * It will check if the interrupt setup succeeded.
  */
-static int mmtimer_setup(int cpu, int comparator, unsigned long expires)
+static int mmtimer_setup(int cpu, int comparator, unsigned long expires,
+       u64 *set_completion_time)
 {
-
        switch (comparator) {
        case 0:
                mmtimer_setup_int_0(cpu, expires);
@@ -191,7 +191,8 @@ static int mmtimer_setup(int cpu, int comparator, unsigned long expires)
                break;
        }
        /* We might've missed our expiration time */
-       if (rtc_time() <= expires)
+       *set_completion_time = rtc_time();
+       if (*set_completion_time <= expires)
                return 1;
 
        /*
@@ -227,6 +228,8 @@ static int mmtimer_disable_int(long nasid, int comparator)
 #define TIMER_OFF      0xbadcabLL      /* Timer is not setup */
 #define TIMER_SET      0               /* Comparator is set for this timer */
 
+#define MMTIMER_INTERVAL_RETRY_INCREMENT_DEFAULT 40
+
 /* There is one of these for each timer */
 struct mmtimer {
        struct rb_node list;
@@ -242,6 +245,11 @@ struct mmtimer_node {
 };
 static struct mmtimer_node *timers;
 
+static unsigned mmtimer_interval_retry_increment =
+       MMTIMER_INTERVAL_RETRY_INCREMENT_DEFAULT;
+module_param(mmtimer_interval_retry_increment, uint, 0644);
+MODULE_PARM_DESC(mmtimer_interval_retry_increment,
+       "RTC ticks to add to expiration on interval retry (default 40)");
 
 /*
  * Add a new mmtimer struct to the node's mmtimer list.
@@ -289,7 +297,8 @@ static void mmtimer_set_next_timer(int nodeid)
        struct mmtimer_node *n = &timers[nodeid];
        struct mmtimer *x;
        struct k_itimer *t;
-       int o;
+       u64 expires, exp, set_completion_time;
+       int i;
 
 restart:
        if (n->next == NULL)
@@ -300,7 +309,8 @@ restart:
        if (!t->it.mmtimer.incr) {
                /* Not an interval timer */
                if (!mmtimer_setup(x->cpu, COMPARATOR,
-                                       t->it.mmtimer.expires)) {
+                                       t->it.mmtimer.expires,
+                                       &set_completion_time)) {
                        /* Late setup, fire now */
                        tasklet_schedule(&n->tasklet);
                }
@@ -308,14 +318,23 @@ restart:
        }
 
        /* Interval timer */
-       o = 0;
-       while (!mmtimer_setup(x->cpu, COMPARATOR, t->it.mmtimer.expires)) {
-               unsigned long e, e1;
-               struct rb_node *next;
-               t->it.mmtimer.expires += t->it.mmtimer.incr << o;
-               t->it_overrun += 1 << o;
-               o++;
-               if (o > 20) {
+       i = 0;
+       expires = exp = t->it.mmtimer.expires;
+       while (!mmtimer_setup(x->cpu, COMPARATOR, expires,
+                               &set_completion_time)) {
+               int to;
+
+               i++;
+               expires = set_completion_time +
+                               mmtimer_interval_retry_increment + (1 << i);
+               /* Calculate overruns as we go. */
+               to = ((u64)(expires - exp) / t->it.mmtimer.incr);
+               if (to) {
+                       t->it_overrun += to;
+                       t->it.mmtimer.expires += t->it.mmtimer.incr * to;
+                       exp = t->it.mmtimer.expires;
+               }
+               if (i > 20) {
                        printk(KERN_ALERT "mmtimer: cannot reschedule timer\n");
                        t->it.mmtimer.clock = TIMER_OFF;
                        n->next = rb_next(&x->list);
@@ -323,21 +342,6 @@ restart:
                        kfree(x);
                        goto restart;
                }
-
-               e = t->it.mmtimer.expires;
-               next = rb_next(&x->list);
-
-               if (next == NULL)
-                       continue;
-
-               e1 = rb_entry(next, struct mmtimer, list)->
-                       timer->it.mmtimer.expires;
-               if (e > e1) {
-                       n->next = next;
-                       rb_erase(&x->list, &n->timer_head);
-                       mmtimer_add_list(x);
-                       goto restart;
-               }
        }
 }
 
index 754c9e2..26b4fce 100644 (file)
@@ -6,10 +6,10 @@
 
 obj-$(CONFIG_MWAVE) += mwave.o
 
-mwave-objs := mwavedd.o smapi.o tp3780i.o 3780i.o
+mwave-y := mwavedd.o smapi.o tp3780i.o 3780i.o
 
 # To have the mwave driver disable other uarts if necessary
 # EXTRA_CFLAGS += -DMWAVE_FUTZ_WITH_OTHER_DEVICES
 
 # To compile in lots (~20 KiB) of run-time enablable printk()s for debugging:
-EXTRA_CFLAGS += -DMW_TRACE
+ccflags-y := -DMW_TRACE
index 463df27..dd9d753 100644 (file)
@@ -303,6 +303,7 @@ static void mxser_enable_must_enchance_mode(unsigned long baseio)
        outb(oldlcr, baseio + UART_LCR);
 }
 
+#ifdef CONFIG_PCI
 static void mxser_disable_must_enchance_mode(unsigned long baseio)
 {
        u8 oldlcr;
@@ -317,6 +318,7 @@ static void mxser_disable_must_enchance_mode(unsigned long baseio)
        outb(efr, baseio + MOXA_MUST_EFR_REGISTER);
        outb(oldlcr, baseio + UART_LCR);
 }
+#endif
 
 static void mxser_set_must_xon1_value(unsigned long baseio, u8 value)
 {
@@ -388,6 +390,7 @@ static void mxser_set_must_enum_value(unsigned long baseio, u8 value)
        outb(oldlcr, baseio + UART_LCR);
 }
 
+#ifdef CONFIG_PCI
 static void mxser_get_must_hardware_id(unsigned long baseio, u8 *pId)
 {
        u8 oldlcr;
@@ -404,6 +407,7 @@ static void mxser_get_must_hardware_id(unsigned long baseio, u8 *pId)
        *pId = inb(baseio + MOXA_MUST_HWID_REGISTER);
        outb(oldlcr, baseio + UART_LCR);
 }
+#endif
 
 static void SET_MOXA_MUST_NO_SOFTWARE_FLOW_CONTROL(unsigned long baseio)
 {
index b71eb59..db80873 100644 (file)
@@ -6,5 +6,5 @@
 
 obj-$(CONFIG_IPWIRELESS) += ipwireless.o
 
-ipwireless-objs := hardware.o main.o network.o tty.o
+ipwireless-y := hardware.o main.o network.o tty.o
 
index 723152d..f176dba 100644 (file)
@@ -613,6 +613,7 @@ static int pp_do_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
 
        case PPGETTIME:
                to_jiffies = pp->pdev->timeout;
+               memset(&par_timeout, 0, sizeof(par_timeout));
                par_timeout.tv_sec = to_jiffies / HZ;
                par_timeout.tv_usec = (to_jiffies % (long)HZ) * (1000000/HZ);
                if (copy_to_user (argp, &par_timeout, sizeof(struct timeval)))
index 74f00b5..73dcb0e 100644 (file)
@@ -25,6 +25,8 @@
 #include <linux/time.h>
 #include <linux/io.h>
 #include <linux/ioport.h>
+#include <linux/platform_device.h>
+#include <linux/ramoops.h>
 
 #define RAMOOPS_KERNMSG_HDR "===="
 #define RAMOOPS_HEADER_SIZE   (5 + sizeof(struct timeval))
@@ -91,11 +93,17 @@ static void ramoops_do_dump(struct kmsg_dumper *dumper,
        cxt->count = (cxt->count + 1) % cxt->max_count;
 }
 
-static int __init ramoops_init(void)
+static int __init ramoops_probe(struct platform_device *pdev)
 {
+       struct ramoops_platform_data *pdata = pdev->dev.platform_data;
        struct ramoops_context *cxt = &oops_cxt;
        int err = -EINVAL;
 
+       if (pdata) {
+               mem_size = pdata->mem_size;
+               mem_address = pdata->mem_address;
+       }
+
        if (!mem_size) {
                printk(KERN_ERR "ramoops: invalid size specification");
                goto fail3;
@@ -142,7 +150,7 @@ fail3:
        return err;
 }
 
-static void __exit ramoops_exit(void)
+static int __exit ramoops_remove(struct platform_device *pdev)
 {
        struct ramoops_context *cxt = &oops_cxt;
 
@@ -151,8 +159,26 @@ static void __exit ramoops_exit(void)
 
        iounmap(cxt->virt_addr);
        release_mem_region(cxt->phys_addr, cxt->size);
+       return 0;
 }
 
+static struct platform_driver ramoops_driver = {
+       .remove         = __exit_p(ramoops_remove),
+       .driver         = {
+               .name   = "ramoops",
+               .owner  = THIS_MODULE,
+       },
+};
+
+static int __init ramoops_init(void)
+{
+       return platform_driver_probe(&ramoops_driver, ramoops_probe);
+}
+
+static void __exit ramoops_exit(void)
+{
+       platform_driver_unregister(&ramoops_driver);
+}
 
 module_init(ramoops_init);
 module_exit(ramoops_exit);
index 2d1c5a7..1661875 100644 (file)
@@ -8,5 +8,5 @@
 
 obj-$(CONFIG_RIO) += rio.o
 
-rio-objs := rio_linux.o rioinit.o rioboot.o riocmd.o rioctrl.o riointr.o \
+rio-y := rio_linux.o rioinit.o rioboot.o riocmd.o rioctrl.o riointr.o \
             rioparam.o rioroute.o riotable.o riotty.o
index 7c79d24..8630883 100644 (file)
@@ -2345,7 +2345,7 @@ static int __init rp_init(void)
        ret = tty_register_driver(rocket_driver);
        if (ret < 0) {
                printk(KERN_ERR "Couldn't install tty RocketPort driver\n");
-               goto err_tty;
+               goto err_controller;
        }
 
 #ifdef ROCKET_DEBUG_OPEN
@@ -2380,6 +2380,9 @@ static int __init rp_init(void)
        return 0;
 err_ttyu:
        tty_unregister_driver(rocket_driver);
+err_controller:
+       if (controller)
+               release_region(controller, 4);
 err_tty:
        put_tty_driver(rocket_driver);
 err:
index 1746d91..d01fffe 100644 (file)
@@ -301,6 +301,8 @@ struct slgt_info {
        unsigned int rx_pio;
        unsigned int if_mode;
        unsigned int base_clock;
+       unsigned int xsync;
+       unsigned int xctrl;
 
        /* device status */
 
@@ -405,6 +407,8 @@ static MGSL_PARAMS default_params = {
 #define TDCSR 0x94 /* tx DMA control/status */
 #define RDDAR 0x98 /* rx DMA descriptor address */
 #define TDDAR 0x9c /* tx DMA descriptor address */
+#define XSR   0x40 /* extended sync pattern */
+#define XCR   0x44 /* extended control */
 
 #define RXIDLE      BIT14
 #define RXBREAK     BIT14
@@ -517,6 +521,10 @@ static int  set_interface(struct slgt_info *info, int if_mode);
 static int  set_gpio(struct slgt_info *info, struct gpio_desc __user *gpio);
 static int  get_gpio(struct slgt_info *info, struct gpio_desc __user *gpio);
 static int  wait_gpio(struct slgt_info *info, struct gpio_desc __user *gpio);
+static int  get_xsync(struct slgt_info *info, int __user *if_mode);
+static int  set_xsync(struct slgt_info *info, int if_mode);
+static int  get_xctrl(struct slgt_info *info, int __user *if_mode);
+static int  set_xctrl(struct slgt_info *info, int if_mode);
 
 /*
  * driver functions
@@ -1056,6 +1064,14 @@ static int ioctl(struct tty_struct *tty, struct file *file,
                return get_gpio(info, argp);
        case MGSL_IOCWAITGPIO:
                return wait_gpio(info, argp);
+       case MGSL_IOCGXSYNC:
+               return get_xsync(info, argp);
+       case MGSL_IOCSXSYNC:
+               return set_xsync(info, (int)arg);
+       case MGSL_IOCGXCTRL:
+               return get_xctrl(info, argp);
+       case MGSL_IOCSXCTRL:
+               return set_xctrl(info, (int)arg);
        }
        mutex_lock(&info->port.mutex);
        switch (cmd) {
@@ -1132,6 +1148,7 @@ static long get_params32(struct slgt_info *info, struct MGSL_PARAMS32 __user *us
        struct MGSL_PARAMS32 tmp_params;
 
        DBGINFO(("%s get_params32\n", info->device_name));
+       memset(&tmp_params, 0, sizeof(tmp_params));
        tmp_params.mode            = (compat_ulong_t)info->params.mode;
        tmp_params.loopback        = info->params.loopback;
        tmp_params.flags           = info->params.flags;
@@ -1212,12 +1229,16 @@ static long slgt_compat_ioctl(struct tty_struct *tty, struct file *file,
        case MGSL_IOCSGPIO:
        case MGSL_IOCGGPIO:
        case MGSL_IOCWAITGPIO:
+       case MGSL_IOCGXSYNC:
+       case MGSL_IOCGXCTRL:
        case MGSL_IOCSTXIDLE:
        case MGSL_IOCTXENABLE:
        case MGSL_IOCRXENABLE:
        case MGSL_IOCTXABORT:
        case TIOCMIWAIT:
        case MGSL_IOCSIF:
+       case MGSL_IOCSXSYNC:
+       case MGSL_IOCSXCTRL:
                rc = ioctl(tty, file, cmd, arg);
                break;
        }
@@ -1617,6 +1638,8 @@ static int hdlcdev_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
        if (cmd != SIOCWANDEV)
                return hdlc_ioctl(dev, ifr, cmd);
 
+       memset(&new_line, 0, sizeof(new_line));
+
        switch(ifr->ifr_settings.type) {
        case IF_GET_IFACE: /* return current sync_serial_settings */
 
@@ -1958,6 +1981,7 @@ static void bh_handler(struct work_struct *work)
                        case MGSL_MODE_RAW:
                        case MGSL_MODE_MONOSYNC:
                        case MGSL_MODE_BISYNC:
+                       case MGSL_MODE_XSYNC:
                                while(rx_get_buf(info));
                                break;
                        }
@@ -2357,26 +2381,27 @@ static irqreturn_t slgt_interrupt(int dummy, void *dev_id)
 
        DBGISR(("slgt_interrupt irq=%d entry\n", info->irq_level));
 
-       spin_lock(&info->lock);
-
        while((gsr = rd_reg32(info, GSR) & 0xffffff00)) {
                DBGISR(("%s gsr=%08x\n", info->device_name, gsr));
                info->irq_occurred = true;
                for(i=0; i < info->port_count ; i++) {
                        if (info->port_array[i] == NULL)
                                continue;
+                       spin_lock(&info->port_array[i]->lock);
                        if (gsr & (BIT8 << i))
                                isr_serial(info->port_array[i]);
                        if (gsr & (BIT16 << (i*2)))
                                isr_rdma(info->port_array[i]);
                        if (gsr & (BIT17 << (i*2)))
                                isr_tdma(info->port_array[i]);
+                       spin_unlock(&info->port_array[i]->lock);
                }
        }
 
        if (info->gpio_present) {
                unsigned int state;
                unsigned int changed;
+               spin_lock(&info->lock);
                while ((changed = rd_reg32(info, IOSR)) != 0) {
                        DBGISR(("%s iosr=%08x\n", info->device_name, changed));
                        /* read latched state of GPIO signals */
@@ -2388,22 +2413,24 @@ static irqreturn_t slgt_interrupt(int dummy, void *dev_id)
                                        isr_gpio(info->port_array[i], changed, state);
                        }
                }
+               spin_unlock(&info->lock);
        }
 
        for(i=0; i < info->port_count ; i++) {
                struct slgt_info *port = info->port_array[i];
-
-               if (port && (port->port.count || port->netcount) &&
+               if (port == NULL)
+                       continue;
+               spin_lock(&port->lock);
+               if ((port->port.count || port->netcount) &&
                    port->pending_bh && !port->bh_running &&
                    !port->bh_requested) {
                        DBGISR(("%s bh queued\n", port->device_name));
                        schedule_work(&port->task);
                        port->bh_requested = true;
                }
+               spin_unlock(&port->lock);
        }
 
-       spin_unlock(&info->lock);
-
        DBGISR(("slgt_interrupt irq=%d exit\n", info->irq_level));
        return IRQ_HANDLED;
 }
@@ -2883,6 +2910,69 @@ static int set_interface(struct slgt_info *info, int if_mode)
        return 0;
 }
 
+static int get_xsync(struct slgt_info *info, int __user *xsync)
+{
+       DBGINFO(("%s get_xsync=%x\n", info->device_name, info->xsync));
+       if (put_user(info->xsync, xsync))
+               return -EFAULT;
+       return 0;
+}
+
+/*
+ * set extended sync pattern (1 to 4 bytes) for extended sync mode
+ *
+ * sync pattern is contained in least significant bytes of value
+ * most significant byte of sync pattern is oldest (1st sent/detected)
+ */
+static int set_xsync(struct slgt_info *info, int xsync)
+{
+       unsigned long flags;
+
+       DBGINFO(("%s set_xsync=%x)\n", info->device_name, xsync));
+       spin_lock_irqsave(&info->lock, flags);
+       info->xsync = xsync;
+       wr_reg32(info, XSR, xsync);
+       spin_unlock_irqrestore(&info->lock, flags);
+       return 0;
+}
+
+static int get_xctrl(struct slgt_info *info, int __user *xctrl)
+{
+       DBGINFO(("%s get_xctrl=%x\n", info->device_name, info->xctrl));
+       if (put_user(info->xctrl, xctrl))
+               return -EFAULT;
+       return 0;
+}
+
+/*
+ * set extended control options
+ *
+ * xctrl[31:19] reserved, must be zero
+ * xctrl[18:17] extended sync pattern length in bytes
+ *              00 = 1 byte  in xsr[7:0]
+ *              01 = 2 bytes in xsr[15:0]
+ *              10 = 3 bytes in xsr[23:0]
+ *              11 = 4 bytes in xsr[31:0]
+ * xctrl[16]    1 = enable terminal count, 0=disabled
+ * xctrl[15:0]  receive terminal count for fixed length packets
+ *              value is count minus one (0 = 1 byte packet)
+ *              when terminal count is reached, receiver
+ *              automatically returns to hunt mode and receive
+ *              FIFO contents are flushed to DMA buffers with
+ *              end of frame (EOF) status
+ */
+static int set_xctrl(struct slgt_info *info, int xctrl)
+{
+       unsigned long flags;
+
+       DBGINFO(("%s set_xctrl=%x)\n", info->device_name, xctrl));
+       spin_lock_irqsave(&info->lock, flags);
+       info->xctrl = xctrl;
+       wr_reg32(info, XCR, xctrl);
+       spin_unlock_irqrestore(&info->lock, flags);
+       return 0;
+}
+
 /*
  * set general purpose IO pin state and direction
  *
@@ -2906,7 +2996,7 @@ static int set_gpio(struct slgt_info *info, struct gpio_desc __user *user_gpio)
                 info->device_name, gpio.state, gpio.smask,
                 gpio.dir, gpio.dmask));
 
-       spin_lock_irqsave(&info->lock,flags);
+       spin_lock_irqsave(&info->port_array[0]->lock, flags);
        if (gpio.dmask) {
                data = rd_reg32(info, IODR);
                data |= gpio.dmask & gpio.dir;
@@ -2919,7 +3009,7 @@ static int set_gpio(struct slgt_info *info, struct gpio_desc __user *user_gpio)
                data &= ~(gpio.smask & ~gpio.state);
                wr_reg32(info, IOVR, data);
        }
-       spin_unlock_irqrestore(&info->lock,flags);
+       spin_unlock_irqrestore(&info->port_array[0]->lock, flags);
 
        return 0;
 }
@@ -3020,7 +3110,7 @@ static int wait_gpio(struct slgt_info *info, struct gpio_desc __user *user_gpio)
                return -EINVAL;
        init_cond_wait(&wait, gpio.smask);
 
-       spin_lock_irqsave(&info->lock, flags);
+       spin_lock_irqsave(&info->port_array[0]->lock, flags);
        /* enable interrupts for watched pins */
        wr_reg32(info, IOER, rd_reg32(info, IOER) | gpio.smask);
        /* get current pin states */
@@ -3032,20 +3122,20 @@ static int wait_gpio(struct slgt_info *info, struct gpio_desc __user *user_gpio)
        } else {
                /* wait for target state */
                add_cond_wait(&info->gpio_wait_q, &wait);
-               spin_unlock_irqrestore(&info->lock, flags);
+               spin_unlock_irqrestore(&info->port_array[0]->lock, flags);
                schedule();
                if (signal_pending(current))
                        rc = -ERESTARTSYS;
                else
                        gpio.state = wait.data;
-               spin_lock_irqsave(&info->lock, flags);
+               spin_lock_irqsave(&info->port_array[0]->lock, flags);
                remove_cond_wait(&info->gpio_wait_q, &wait);
        }
 
        /* disable all GPIO interrupts if no waiting processes */
        if (info->gpio_wait_q == NULL)
                wr_reg32(info, IOER, 0);
-       spin_unlock_irqrestore(&info->lock,flags);
+       spin_unlock_irqrestore(&info->port_array[0]->lock, flags);
 
        if ((rc == 0) && copy_to_user(user_gpio, &gpio, sizeof(gpio)))
                rc = -EFAULT;
@@ -3578,7 +3668,6 @@ static void device_init(int adapter_num, struct pci_dev *pdev)
 
                /* copy resource information from first port to others */
                for (i = 1; i < port_count; ++i) {
-                       port_array[i]->lock      = port_array[0]->lock;
                        port_array[i]->irq_level = port_array[0]->irq_level;
                        port_array[i]->reg_addr  = port_array[0]->reg_addr;
                        alloc_dma_bufs(port_array[i]);