1. 05 10月, 2006 1 次提交
    • D
      IRQ: Maintain regs pointer globally rather than passing to IRQ handlers · 7d12e780
      David Howells 提交于
      Maintain a per-CPU global "struct pt_regs *" variable which can be used instead
      of passing regs around manually through all ~1800 interrupt handlers in the
      Linux kernel.
      
      The regs pointer is used in few places, but it potentially costs both stack
      space and code to pass it around.  On the FRV arch, removing the regs parameter
      from all the genirq function results in a 20% speed up of the IRQ exit path
      (ie: from leaving timer_interrupt() to leaving do_IRQ()).
      
      Where appropriate, an arch may override the generic storage facility and do
      something different with the variable.  On FRV, for instance, the address is
      maintained in GR28 at all times inside the kernel as part of general exception
      handling.
      
      Having looked over the code, it appears that the parameter may be handed down
      through up to twenty or so layers of functions.  Consider a USB character
      device attached to a USB hub, attached to a USB controller that posts its
      interrupts through a cascaded auxiliary interrupt controller.  A character
      device driver may want to pass regs to the sysrq handler through the input
      layer which adds another few layers of parameter passing.
      
      I've build this code with allyesconfig for x86_64 and i386.  I've runtested the
      main part of the code on FRV and i386, though I can't test most of the drivers.
      I've also done partial conversion for powerpc and MIPS - these at least compile
      with minimal configurations.
      
      This will affect all archs.  Mostly the changes should be relatively easy.
      Take do_IRQ(), store the regs pointer at the beginning, saving the old one:
      
      	struct pt_regs *old_regs = set_irq_regs(regs);
      
      And put the old one back at the end:
      
      	set_irq_regs(old_regs);
      
      Don't pass regs through to generic_handle_irq() or __do_IRQ().
      
      In timer_interrupt(), this sort of change will be necessary:
      
      	-	update_process_times(user_mode(regs));
      	-	profile_tick(CPU_PROFILING, regs);
      	+	update_process_times(user_mode(get_irq_regs()));
      	+	profile_tick(CPU_PROFILING);
      
      I'd like to move update_process_times()'s use of get_irq_regs() into itself,
      except that i386, alone of the archs, uses something other than user_mode().
      
      Some notes on the interrupt handling in the drivers:
      
       (*) input_dev() is now gone entirely.  The regs pointer is no longer stored in
           the input_dev struct.
      
       (*) finish_unlinks() in drivers/usb/host/ohci-q.c needs checking.  It does
           something different depending on whether it's been supplied with a regs
           pointer or not.
      
       (*) Various IRQ handler function pointers have been moved to type
           irq_handler_t.
      Signed-Off-By: NDavid Howells <dhowells@redhat.com>
      (cherry picked from 1b16e7ac850969f38b375e511e3fa2f474a33867 commit)
      7d12e780
  2. 02 10月, 2006 1 次提交
  3. 01 10月, 2006 1 次提交
  4. 02 9月, 2006 1 次提交
    • B
      [PATCH] powerpc: More via-pmu backlight fixes · d565dd3b
      Benjamin Herrenschmidt 提交于
      The via-pmu backlight code (introduced in 2.6.18) has various design issues
      causing crashes on machines using it like the old Wallstreet powerbook
      (Michael, the author, never managed to test on these and I just got my hand
      on one of those old beasts).
      
      This fixes them by no longer trying to hijack the backlight device of the
      frontmost framebuffer (causing that framebuffer to crash) but having it's
      own local bits instead.  Might look weird but it's better that way on those
      old machines, at least as a last-minute fix for 2.6.18.  We might rework
      the whole thing later.  This patch also changes the way it gets notified of
      sleep and wakeup in order to properly shut the backlight down on sleep and
      bring it back on wakeup.
      Signed-off-by: NBenjamin Herrenschmidt <benh@kernel.crashing.org>
      Cc: "Antonino A. Daplas" <adaplas@pol.net>
      Signed-off-by: NAndrew Morton <akpm@osdl.org>
      Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
      d565dd3b
  5. 01 8月, 2006 1 次提交
  6. 31 7月, 2006 1 次提交
  7. 03 7月, 2006 1 次提交
    • B
      [POWERPC] Add new interrupt mapping core and change platforms to use it · 0ebfff14
      Benjamin Herrenschmidt 提交于
      This adds the new irq remapper core and removes the old one.  Because
      there are some fundamental conflicts with the old code, like the value
      of NO_IRQ which I'm now setting to 0 (as per discussions with Linus),
      etc..., this commit also changes the relevant platform and driver code
      over to use the new remapper (so as not to cause difficulties later
      in bisecting).
      
      This patch removes the old pre-parsing of the open firmware interrupt
      tree along with all the bogus assumptions it made to try to renumber
      interrupts according to the platform. This is all to be handled by the
      new code now.
      
      For the pSeries XICS interrupt controller, a single remapper host is
      created for the whole machine regardless of how many interrupt
      presentation and source controllers are found, and it's set to match
      any device node that isn't a 8259.  That works fine on pSeries and
      avoids having to deal with some of the complexities of split source
      controllers vs. presentation controllers in the pSeries device trees.
      
      The powerpc i8259 PIC driver now always requests the legacy interrupt
      range. It also has the feature of being able to match any device node
      (including NULL) if passed no device node as an input. That will help
      porting over platforms with broken device-trees like Pegasos who don't
      have a proper interrupt tree.
      Signed-off-by: NBenjamin Herrenschmidt <benh@kernel.crashing.org>
      Signed-off-by: NPaul Mackerras <paulus@samba.org>
      0ebfff14
  8. 01 7月, 2006 1 次提交
  9. 26 6月, 2006 2 次提交
  10. 11 6月, 2006 1 次提交
  11. 28 3月, 2006 1 次提交
    • A
      [PATCH] Notifier chain update: API changes · e041c683
      Alan Stern 提交于
      The kernel's implementation of notifier chains is unsafe.  There is no
      protection against entries being added to or removed from a chain while the
      chain is in use.  The issues were discussed in this thread:
      
          http://marc.theaimsgroup.com/?l=linux-kernel&m=113018709002036&w=2
      
      We noticed that notifier chains in the kernel fall into two basic usage
      classes:
      
      	"Blocking" chains are always called from a process context
      	and the callout routines are allowed to sleep;
      
      	"Atomic" chains can be called from an atomic context and
      	the callout routines are not allowed to sleep.
      
      We decided to codify this distinction and make it part of the API.  Therefore
      this set of patches introduces three new, parallel APIs: one for blocking
      notifiers, one for atomic notifiers, and one for "raw" notifiers (which is
      really just the old API under a new name).  New kinds of data structures are
      used for the heads of the chains, and new routines are defined for
      registration, unregistration, and calling a chain.  The three APIs are
      explained in include/linux/notifier.h and their implementation is in
      kernel/sys.c.
      
      With atomic and blocking chains, the implementation guarantees that the chain
      links will not be corrupted and that chain callers will not get messed up by
      entries being added or removed.  For raw chains the implementation provides no
      guarantees at all; users of this API must provide their own protections.  (The
      idea was that situations may come up where the assumptions of the atomic and
      blocking APIs are not appropriate, so it should be possible for users to
      handle these things in their own way.)
      
      There are some limitations, which should not be too hard to live with.  For
      atomic/blocking chains, registration and unregistration must always be done in
      a process context since the chain is protected by a mutex/rwsem.  Also, a
      callout routine for a non-raw chain must not try to register or unregister
      entries on its own chain.  (This did happen in a couple of places and the code
      had to be changed to avoid it.)
      
      Since atomic chains may be called from within an NMI handler, they cannot use
      spinlocks for synchronization.  Instead we use RCU.  The overhead falls almost
      entirely in the unregister routine, which is okay since unregistration is much
      less frequent that calling a chain.
      
      Here is the list of chains that we adjusted and their classifications.  None
      of them use the raw API, so for the moment it is only a placeholder.
      
        ATOMIC CHAINS
        -------------
      arch/i386/kernel/traps.c:		i386die_chain
      arch/ia64/kernel/traps.c:		ia64die_chain
      arch/powerpc/kernel/traps.c:		powerpc_die_chain
      arch/sparc64/kernel/traps.c:		sparc64die_chain
      arch/x86_64/kernel/traps.c:		die_chain
      drivers/char/ipmi/ipmi_si_intf.c:	xaction_notifier_list
      kernel/panic.c:				panic_notifier_list
      kernel/profile.c:			task_free_notifier
      net/bluetooth/hci_core.c:		hci_notifier
      net/ipv4/netfilter/ip_conntrack_core.c:	ip_conntrack_chain
      net/ipv4/netfilter/ip_conntrack_core.c:	ip_conntrack_expect_chain
      net/ipv6/addrconf.c:			inet6addr_chain
      net/netfilter/nf_conntrack_core.c:	nf_conntrack_chain
      net/netfilter/nf_conntrack_core.c:	nf_conntrack_expect_chain
      net/netlink/af_netlink.c:		netlink_chain
      
        BLOCKING CHAINS
        ---------------
      arch/powerpc/platforms/pseries/reconfig.c:	pSeries_reconfig_chain
      arch/s390/kernel/process.c:		idle_chain
      arch/x86_64/kernel/process.c		idle_notifier
      drivers/base/memory.c:			memory_chain
      drivers/cpufreq/cpufreq.c		cpufreq_policy_notifier_list
      drivers/cpufreq/cpufreq.c		cpufreq_transition_notifier_list
      drivers/macintosh/adb.c:		adb_client_list
      drivers/macintosh/via-pmu.c		sleep_notifier_list
      drivers/macintosh/via-pmu68k.c		sleep_notifier_list
      drivers/macintosh/windfarm_core.c	wf_client_list
      drivers/usb/core/notify.c		usb_notifier_list
      drivers/video/fbmem.c			fb_notifier_list
      kernel/cpu.c				cpu_chain
      kernel/module.c				module_notify_list
      kernel/profile.c			munmap_notifier
      kernel/profile.c			task_exit_notifier
      kernel/sys.c				reboot_notifier_list
      net/core/dev.c				netdev_chain
      net/decnet/dn_dev.c:			dnaddr_chain
      net/ipv4/devinet.c:			inetaddr_chain
      
      It's possible that some of these classifications are wrong.  If they are,
      please let us know or submit a patch to fix them.  Note that any chain that
      gets called very frequently should be atomic, because the rwsem read-locking
      used for blocking chains is very likely to incur cache misses on SMP systems.
      (However, if the chain's callout routines may sleep then the chain cannot be
      atomic.)
      
      The patch set was written by Alan Stern and Chandra Seetharaman, incorporating
      material written by Keith Owens and suggestions from Paul McKenney and Andrew
      Morton.
      
      [jes@sgi.com: restructure the notifier chain initialization macros]
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NChandra Seetharaman <sekharan@us.ibm.com>
      Signed-off-by: NJes Sorensen <jes@sgi.com>
      Signed-off-by: NAndrew Morton <akpm@osdl.org>
      Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
      e041c683
  12. 23 3月, 2006 2 次提交
  13. 14 3月, 2006 1 次提交
  14. 09 1月, 2006 6 次提交
    • B
      [PATCH] 3/5 powerpc: Add platform functions interpreter · 5b9ca526
      Benjamin Herrenschmidt 提交于
      This is the platform function interpreter itself along with the backends
      for UniN/U3/U4, mac-io, GPIOs and i2c. It adds the ability to execute
      those do-platform-* scripts in the device-tree (at least for most
      devices for which a backend is provided). This should replace the clock
      spreading hacks properly. It might also have an impact on all sort of
      machines since some of the scripts marked "at init" will now be executed
      on boot (or some other on sleep/wakeup), those will possibly do things
      that the kernel didn't do at all, like setting some values into some i2c
      devices (changing thermal sensor calibration or conversion rate) etc...
      Thus regression testing is MUCH welcome. Also loook for errors in dmesg.
      That's also why I've left rather verbose debugging enabled in this
      version of the patch.
      
      (I do expect some Windtunnel G4s to show some errors as they have an i2c
      clock chip on the PMU bus that uses some primitives that the i2c backend
      doesn't implement yet. I really need users that have one of those
      machine to come back to me so we can get that done right, though the
      errors themselves should be harmless, I suspect the machine might not
      run at full speed).
      Signed-off-by: NBenjamin Herrenschmidt <benh@kernel.crashing.org>
      Signed-off-by: NPaul Mackerras <paulus@samba.org>
      5b9ca526
    • B
      [PATCH] 1/5 powerpc: Rework PowerMac i2c part 1 · 730745a5
      Benjamin Herrenschmidt 提交于
      This is the first part of a rework of the PowerMac i2c code. It
      completely reworks the "low_i2c" layer. It is now more flexible,
      supports KeyWest, SMU and PMU i2c busses, and provides functions to
      match device nodes to i2c busses and adapters.
      
      This patch also extends & fix some bugs in the SMU driver related to i2c
      support and removes the clock spreading hacks from the pmac feature code
      rather than adapting them to the new API since they'll be replaced by
      the platform function code completely in patch 3/5
      Signed-off-by: NBenjamin Herrenschmidt <benh@kernel.crashing.org>
      Signed-off-by: NPaul Mackerras <paulus@samba.org>
      730745a5
    • K
      [PATCH] via-pmu: compile without Power Management support · a04c8780
      Kristian Mueller 提交于
      Fix compilation of via-pmu.c without Power Management support.
      Signed-off-by: NPaul Mackerras <paulus@samba.org>
      a04c8780
    • B
      [PATCH] powerpc: Remove device_node addrs/n_addr · cc5d0189
      Benjamin Herrenschmidt 提交于
      The pre-parsed addrs/n_addrs fields in struct device_node are finally
      gone. Remove the dodgy heuristics that did that parsing at boot and
      remove the fields themselves since we now have a good replacement with
      the new OF parsing code. This patch also fixes a bunch of drivers to use
      the new code instead, so that at least pmac32, pseries, iseries and g5
      defconfigs build.
      Signed-off-by: NBenjamin Herrenschmidt <benh@kernel.crashing.org>
      Signed-off-by: NPaul Mackerras <paulus@samba.org>
      cc5d0189
    • B
      [PATCH] powerpc: udbg updates · bb6b9b28
      Benjamin Herrenschmidt 提交于
      The udbg low level io layer has an issue with udbg_getc() returning a
      char (unsigned on ppc) instead of an int, thus the -1 if you had no
      available input device could end up turned into 0xff, filling your
      display with bogus characters. This fixes it, along with adding a little
      blob to xmon to do a delay before exiting when getting an EOF and fixing
      the detection of ADB keyboards in udbg_adb.c
      Signed-off-by: NBenjamin Herrenschmidt <benh@kernel.crashing.org>
      Signed-off-by: NPaul Mackerras <paulus@samba.org>
      bb6b9b28
    • B
      [PATCH] powerpc: Unify udbg (#2) · 51d3082f
      Benjamin Herrenschmidt 提交于
      This patch unifies udbg for both ppc32 and ppc64 when building the
      merged achitecture. xmon now has a single "back end". The powermac udbg
      stuff gets enriched with some ADB capabilities and btext output. In
      addition, the early_init callback is now called on ppc32 as well,
      approx. in the same order as ppc64 regarding device-tree manipulations.
      The init sequences of ppc32 and ppc64 are getting closer, I'll unify
      them in a later patch.
      
      For now, you can force udbg to the scc using "sccdbg" or to btext using
      "btextdbg" on powermacs. I'll implement a cleaner way of forcing udbg
      output to something else than the autodetected OF output device in a
      later patch.
      Signed-off-by: NBenjamin Herrenschmidt <benh@kernel.crashing.org>
      Signed-off-by: NPaul Mackerras <paulus@samba.org>
      51d3082f
  15. 08 11月, 2005 2 次提交
  16. 02 11月, 2005 1 次提交
  17. 20 10月, 2005 1 次提交
    • P
      powerpc: Merge time.c and asm/time.h. · f2783c15
      Paul Mackerras 提交于
      We now use the merged time.c for both 32-bit and 64-bit compilation
      with ARCH=powerpc, and for ARCH=ppc64, but not for ARCH=ppc32.
      This removes setup_default_decr (folds its function into time_init)
      and moves wakeup_decrementer into time.c.  This also makes an
      asm-powerpc/rtc.h.
      Signed-off-by: NPaul Mackerras <paulus@samba.org>
      f2783c15
  18. 26 9月, 2005 1 次提交
    • P
      powerpc: Merge enough to start building in arch/powerpc. · 14cf11af
      Paul Mackerras 提交于
      This creates the directory structure under arch/powerpc and a bunch
      of Kconfig files.  It does a first-cut merge of arch/powerpc/mm,
      arch/powerpc/lib and arch/powerpc/platforms/powermac.  This is enough
      to build a 32-bit powermac kernel with ARCH=powerpc.
      
      For now we are getting some unmerged files from arch/ppc/kernel and
      arch/ppc/syslib, or arch/ppc64/kernel.  This makes some minor changes
      to files in those directories and files outside arch/powerpc.
      
      The boot directory is still not merged.  That's going to be interesting.
      Signed-off-by: NPaul Mackerras <paulus@samba.org>
      14cf11af
  19. 19 9月, 2005 1 次提交
  20. 05 9月, 2005 1 次提交
  21. 28 6月, 2005 2 次提交
  22. 10 6月, 2005 1 次提交
    • B
      [PATCH] ppc32: Fix nasty sleep/wakeup problem · 0086b5ec
      Benjamin Herrenschmidt 提交于
      Despite all the care lately in making the powermac sleep/wakeup as
      robust as possible, there is still a nasty related to the use of cpufreq
      on PMU based machines.  Unfortunately, it affects paulus old powerbook
      so I have to fix it :)
      
      We didn't manage to understand what is precisely going on, it leads to
      memory corruption and might have to do with RAM not beeing properly
      refreshed when a cpufreq transition is done right before the sleep.
      
      The best workaround (and less intrusive at this point) we could come up
      with is included in this patch.  We basically do _not_ force a switch to
      high speed on suspend anymore (that is what is causing the problem) on
      those machines.  We still force a speed switch on wakeup (since we don't
      know what speed we are coming back from sleep at, and that seems to work
      fine).
      
      Since, during this short interval, the actual CPU speed might be
      incorrect, we also hack around by multiplying loops_per_jiffy by 2 (max
      speed factor on those machines) during early wakeup stage to make sure
      udelay's during that time aren't too short.
      
      For after 2.6.12, we'll change udelay implementation to use the CPU
      timebase (which is always constant) instead like we do on ppc64 and thus
      get rid of all those problems.
      Signed-off-by: NBenjamin Herrenschmidt <benh@kernel.crashing.org>
      Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
      0086b5ec
  23. 29 5月, 2005 1 次提交
    • B
      [PATCH] ppc32: Fix cpufreq vs. sleep issue · b16eeb47
      Benjamin Herrenschmidt 提交于
      Recent kernels occasionally trigger a PMU timeout on some mac laptops,
      typically on wakeup from sleep.  This seem to be caused by either a too big
      latency caused by the cpufreq switch on wakeup from sleep or by an
      interrupt beeing lost due to the reset of the interrupt controller done
      during wakeup.
      
      This patch makes that code more robust by stopping PMU auto poll activity
      around cpufreq changes on machines that use the PMU for such changes (long
      latency switching involving a CPU hard reset and flush of all caches) and
      by removing the reset of the open pic interrupt controller on wakeup (that
      can cause the loss of an interrupt and Darwin doesn't do it, so it must not
      be necessary).
      Signed-off-by: NBenjamin Herrenschmidt <benh@kernel.crashing.org>
      Signed-off-by: NAndrew Morton <akpm@osdl.org>
      Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
      b16eeb47
  24. 02 5月, 2005 1 次提交
  25. 17 4月, 2005 3 次提交