1. 09 Jul, 2010 19 commits
    • Christoph Egger's avatar
      powerpc: Removing dead CONFIG_SMP_750 · cccd2342
      Christoph Egger authored
      CONFIG_SMP_750 doesn't exist in Kconfig, therefore removing all
      references for it from the source code.
      Signed-off-by: default avatarChristoph Egger <siccegge@cs.fau.de>
      Signed-off-by: default avatarBenjamin Herrenschmidt <benh@kernel.crashing.org>
      cccd2342
    • Julia Lawall's avatar
      powerpc/pseries: Use kstrdup · 74052173
      Julia Lawall authored
      Use kstrdup when the goal of an allocation is copy a string into the
      allocated region.
      
      The semantic patch that makes this change is as follows:
      (http://coccinelle.lip6.fr/)
      
      // <smpl>
      @@
      expression from,to;
      expression flag,E1,E2;
      statement S;
      @@
      
      -  to = kmalloc(strlen(from) + 1,flag);
      +  to = kstrdup(from, flag);
         ... when != \(from = E1 \| to = E1 \)
         if (to==NULL || ...) S
         ... when != \(from = E2 \| to = E2 \)
      -  strcpy(to, from);
      // </smpl>
      Signed-off-by: default avatarJulia Lawall <julia@diku.dk>
      Signed-off-by: default avatarBenjamin Herrenschmidt <benh@kernel.crashing.org>
      74052173
    • Julia Lawall's avatar
      powerpc/iseries: Use kstrdup · 307a54cc
      Julia Lawall authored
      Use kstrdup when the goal of an allocation is copy a string into the
      allocated region.
      
      The semantic patch that makes this change is as follows:
      (http://coccinelle.lip6.fr/)
      
      // <smpl>
      @@
      expression from,to;
      expression flag,E1,E2;
      statement S;
      @@
      
      -  to = kmalloc(strlen(from) + 1,flag);
      +  to = kstrdup(from, flag);
         ... when != \(from = E1 \| to = E1 \)
         if (to==NULL || ...) S
         ... when != \(from = E2 \| to = E2 \)
      -  strcpy(to, from);
      // </smpl>
      Signed-off-by: default avatarJulia Lawall <julia@diku.dk>
      Signed-off-by: default avatarBenjamin Herrenschmidt <benh@kernel.crashing.org>
      307a54cc
    • Anton Blanchard's avatar
      powerpc/numa: Use form 1 affinity to setup node distance · 41eab6f8
      Anton Blanchard authored
      Form 1 affinity allows multiple entries in ibm,associativity-reference-points
      which represent affinity domains in decreasing order of importance. The
      Linux concept of a node is always the first entry, but using the other
      values as an input to node_distance() allows the memory allocator to make
      better decisions on which node to go first when local memory has been
      exhausted.
      
      We keep things simple and create an array indexed by NUMA node, capped at
      4 entries. Each time we lookup an associativity property we initialise
      the array which is overkill, but since we should only hit this path during
      boot it didn't seem worth adding a per node valid bit.
      Signed-off-by: default avatarAnton Blanchard <anton@samba.org>
      Signed-off-by: default avatarBenjamin Herrenschmidt <benh@kernel.crashing.org>
      41eab6f8
    • Paul E. McKenney's avatar
      powerpc: Remove all rcu head initializations · a591f6b5
      Paul E. McKenney authored
      Remove all rcu head inits. We don't care about the RCU head state before
      passing it to call_rcu() anyway. Only leave the "on_stack" variants so
      debugobjects can keep track of objects on stack.
      Signed-off-by: default avatarMathieu Desnoyers <mathieu.desnoyers@efficios.com>
      Signed-off-by: default avatarPaul E. McKenney <paulmck@linux.vnet.ibm.com>
      Signed-off-by: default avatarBenjamin Herrenschmidt <benh@kernel.crashing.org>
      a591f6b5
    • Martyn Welch's avatar
      powerpc: Add i8042 keyboard and mouse irq parsing · 540c6c39
      Martyn Welch authored
      Currently the irqs for the i8042, which historically provides keyboard and
      mouse (aux) support, is hardwired in the driver rather than parsing the
      dts.  This patch modifies the powerpc legacy IO code to attempt to parse
      the device tree for this information, failing back to the hardcoded values
      if it fails.
      Signed-off-by: default avatarMartyn Welch <martyn.welch@ge.com>
      Signed-off-by: default avatarBenjamin Herrenschmidt <benh@kernel.crashing.org>
      540c6c39
    • Mark Nelson's avatar
      powerpc/pseries: Add WARN_ON() to request_event_sources_irqs() on irq allocation/request failure · 68581e93
      Mark Nelson authored
      At the moment if request_event_sources_irqs() can't allocate or request
      the interrupt, it just does a KERN_ERR printk. This may be fine for the
      existing RAS code where if we miss an EPOW event it just means that the
      event won't be logged and if we miss one of the RAS errors then we could
      miss an event that we perhaps should take action on.
      
      But, for the upcoming IO events code that will use event-sources if we
      can't allocate or request the interrupt it means we'd potentially miss
      an interrupt from the device. So, let's add a WARN_ON() in this error
      case so that we're a bit more vocal when something's amiss.
      
      While we're at it, also use pr_err() to neaten the code up a bit.
      Signed-off-by: default avatarMark Nelson <markn@au1.ibm.com>
      Signed-off-by: default avatarBenjamin Herrenschmidt <benh@kernel.crashing.org>
      68581e93
    • Mark Nelson's avatar
      powerpc/pseries: Rename RAS_VECTOR_OFFSET to RTAS_VECTOR_EXTERNAL_INTERRUPT and move to rtas.h · b08e281b
      Mark Nelson authored
      The RAS code has a #define, RAS_VECTOR_OFFSET, that's used in the
      check-exception RTAS call for the vector offset of the exception.
      
      We'll be using this same vector offset for the upcoming IO Event interrupts
      code (0x500) so let's move it to include/asm/rtas.h and call it
      RTAS_VECTOR_EXTERNAL_INTERRUPT.
      Signed-off-by: default avatarMark Nelson <markn@au1.ibm.com>
      Signed-off-by: default avatarBenjamin Herrenschmidt <benh@kernel.crashing.org>
      b08e281b
    • Anton Blanchard's avatar
      powerpc: Optimise per cpu accesses on 64bit · ae01f84b
      Anton Blanchard authored
      Now we dynamically allocate the paca array, it takes an extra load
      whenever we want to access another cpu's paca. One place we do that a lot
      is per cpu variables. A simple example:
      
      DEFINE_PER_CPU(unsigned long, vara);
      unsigned long test4(int cpu)
      {
      	return per_cpu(vara, cpu);
      }
      
      This takes 4 loads, 5 if you include the actual load of the per cpu variable:
      
          ld r11,-32760(r30)  # load address of paca pointer
          ld r9,-32768(r30)   # load link address of percpu variable
          sldi r3,r29,9       # get offset into paca (each entry is 512 bytes)
          ld r0,0(r11)        # load paca pointer
          add r3,r0,r3        # paca + offset
          ld r11,64(r3)       # load paca[cpu].data_offset
      
          ldx r3,r9,r11       # load per cpu variable
      
      If we remove the ppc64 specific per_cpu_offset(), we get the generic one
      which indexes into a statically allocated array. This removes one load and
      one add:
      
          ld r11,-32760(r30)  # load address of __per_cpu_offset
          ld r9,-32768(r30)   # load link address of percpu variable
          sldi r3,r29,3       # get offset into __per_cpu_offset (each entry 8 bytes)
          ldx r11,r11,r3      # load __per_cpu_offset[cpu]
      
          ldx r3,r9,r11       # load per cpu variable
      
      Having all the offsets in one array also helps when iterating over a per cpu
      variable across a number of cpus, such as in the scheduler. Before we would
      need to load one paca cacheline when calculating each per cpu offset. Now we
      have 16 (128 / sizeof(long)) per cpu offsets in each cacheline.
      Signed-off-by: default avatarAnton Blanchard <anton@samba.org>
      Signed-off-by: default avatarBenjamin Herrenschmidt <benh@kernel.crashing.org>
      ae01f84b
    • Denis Kirjanov's avatar
      powerpc/iseries: Fix constant warning · 51c7fdba
      Denis Kirjanov authored
      Fix smatch warning: constant 0x8000000000000000 is so big it is unsigned long
      Signed-off-by: default avatarDenis Kirjanov <dkirjanov@kernel.org>
      Signed-off-by: default avatarBenjamin Herrenschmidt <benh@kernel.crashing.org>
      51c7fdba
    • Matthew McClintock's avatar
      powerpc/mpic: Add ability to reset a core via MPIC · 66953ebe
      Matthew McClintock authored
      We need the ability to reset cores for use with kexec/kdump for
      SMP systems. Calling this function with the specific core you want
      to reset will cause the CPU to spin in reset.
      Signed-off-by: default avatarMatthew McClintock <msm@freescale.com>
      Signed-off-by: default avatarBenjamin Herrenschmidt <benh@kernel.crashing.org>
      66953ebe
    • Becky Bruce's avatar
      powerpc/fsl-booke: Fix comments in mmu code that mention BATS · d10ac373
      Becky Bruce authored
      There are no BATS on BookE - we have the TLBCAM instead.  Also correct
      the page size information to included extended sizes.  We don't actually allow
      a 4G page size to be used, so comment on that as well.
      Signed-off-by: default avatarBecky Bruce <beckyb@kernel.crashing.org>
      Signed-off-by: default avatarBenjamin Herrenschmidt <benh@kernel.crashing.org>
      d10ac373
    • Kulikov Vasiliy's avatar
      powerpc/pseries/eeh: Use for_each_pci_dev() · 6901c6cc
      Kulikov Vasiliy authored
      Use for_each_pci_dev() to simplify the code.
      Signed-off-by: default avatarKulikov Vasiliy <segooon@gmail.com>
      Signed-off-by: default avatarBenjamin Herrenschmidt <benh@kernel.crashing.org>
      6901c6cc
    • Chris Metcalf's avatar
      hvc_console: use "*_console" nomenclature to avoid modpost warning. · 4455b119
      Chris Metcalf authored
      The use of "hvc_con_driver" as the name for a file-static "struct
      console" with a ".setup" field pointing to an __init function causes
      a modpost warning, since a non-initdata structure points to init code.
      Using "hvc_console" as the name triggers the hacky "*_console"
      workaround in modpost to silence the warning, and is the same thing
      that most of the other console drivers already do.
      
      I made the same change in hvsi.c since I happened to notice it was
      likely to suffer from the same problem.
      Signed-off-by: default avatarChris Metcalf <cmetcalf@tilera.com>
      Signed-off-by: default avatarBenjamin Herrenschmidt <benh@kernel.crashing.org>
      4455b119
    • Brian King's avatar
      powerpc/pseries: Partition hibernation support · 32d8ad4e
      Brian King authored
      Enables support for HMC initiated partition hibernation. This is
      a firmware assisted hibernation, since the firmware handles writing
      the memory out to disk, along with other partition information,
      so we just mimic suspend to ram.
      Signed-off-by: default avatarBrian King <brking@linux.vnet.ibm.com>
      Signed-off-by: default avatarBenjamin Herrenschmidt <benh@kernel.crashing.org>
      32d8ad4e
    • Brian King's avatar
      powerpc/pseries: Migration code reorganization / hibernation prep · 8fe93f8d
      Brian King authored
      Partition hibernation will use some of the same code as is
      currently used for Live Partition Migration. This function
      further abstracts this code such that code outside of rtas.c
      can utilize it. It also changes the error field in the suspend
      me data structure to be an atomic type, since it is set and
      checked on different cpus without any barriers or locking.
      Signed-off-by: default avatarBrian King <brking@linux.vnet.ibm.com>
      Signed-off-by: default avatarBenjamin Herrenschmidt <benh@kernel.crashing.org>
      8fe93f8d
    • Paul Mackerras's avatar
      powerpc: Clean up obsolete code relating to decrementer and timebase · c1aa687d
      Paul Mackerras authored
      Since the decrementer and timekeeping code was moved over to using
      the generic clockevents and timekeeping infrastructure, several
      variables and functions have been obsolete and effectively unused.
      This deletes them.
      
      In particular, wakeup_decrementer() is no longer needed since the
      generic code reprograms the decrementer as part of the process of
      resuming the timekeeping code, which happens during sysdev resume.
      Thus the wakeup_decrementer calls in the suspend_enter methods for
      52xx platforms have been removed.  The call in the powermac cpu
      frequency change code has been replaced by set_dec(1), which will
      cause a timer interrupt as soon as interrupts are enabled, and the
      generic code will then reprogram the decrementer with the correct
      value.
      
      This also simplifies the generic_suspend_en/disable_irqs functions
      and makes them static since they are not referenced outside time.c.
      The preempt_enable/disable calls are removed because the generic
      code has disabled all but the boot cpu at the point where these
      functions are called, so we can't be moved to another cpu.
      Signed-off-by: default avatarPaul Mackerras <paulus@samba.org>
      Signed-off-by: default avatarBenjamin Herrenschmidt <benh@kernel.crashing.org>
      c1aa687d
    • Paul Mackerras's avatar
      powerpc: Rework VDSO gettimeofday to prevent time going backwards · 8fd63a9e
      Paul Mackerras authored
      Currently it is possible for userspace to see the result of
      gettimeofday() going backwards by 1 microsecond, assuming that
      userspace is using the gettimeofday() in the VDSO.  The VDSO
      gettimeofday() algorithm computes the time in "xsecs", which are
      units of 2^-20 seconds, or approximately 0.954 microseconds,
      using the algorithm
      
      	now = (timebase - tb_orig_stamp) * tb_to_xs + stamp_xsec
      
      and then converts the time in xsecs to seconds and microseconds.
      
      The kernel updates the tb_orig_stamp and stamp_xsec values every
      tick in update_vsyscall().  If the length of the tick is not an
      integer number of xsecs, then some precision is lost in converting
      the current time to xsecs.  For example, with CONFIG_HZ=1000, the
      tick is 1ms long, which is 1048.576 xsecs.  That means that
      stamp_xsec will advance by either 1048 or 1049 on each tick.
      With the right conditions, it is possible for userspace to get
      (timebase - tb_orig_stamp) * tb_to_xs being 1049 if the kernel is
      slightly late in updating the vdso_datapage, and then for stamp_xsec
      to advance by 1048 when the kernel does update it, and for userspace
      to then see (timebase - tb_orig_stamp) * tb_to_xs being zero due to
      integer truncation.  The result is that time appears to go backwards
      by 1 microsecond.
      
      To fix this we change the VDSO gettimeofday to use a new field in the
      VDSO datapage which stores the nanoseconds part of the time as a
      fractional number of seconds in a 0.32 binary fraction format.
      (Or put another way, as a 32-bit number in units of 0.23283 ns.)
      This is convenient because we can use the mulhwu instruction to
      convert it to either microseconds or nanoseconds.
      
      Since it turns out that computing the time of day using this new field
      is simpler than either using stamp_xsec (as gettimeofday does) or
      stamp_xtime.tv_nsec (as clock_gettime does), this converts both
      gettimeofday and clock_gettime to use the new field.  The existing
      __do_get_tspec function is converted to use the new field and take
      a parameter in r7 that indicates the desired resolution, 1,000,000
      for microseconds or 1,000,000,000 for nanoseconds.  The __do_get_xsec
      function is then unused and is deleted.
      
      The new algorithm is
      
      	now = ((timebase - tb_orig_stamp) << 12) * tb_to_xs
      		+ (stamp_xtime_seconds << 32) + stamp_sec_fraction
      
      with 'now' in units of 2^-32 seconds.  That is then converted to
      seconds and either microseconds or nanoseconds with
      
      	seconds = now >> 32
      	partseconds = ((now & 0xffffffff) * resolution) >> 32
      
      The 32-bit VDSO code also makes a further simplification: it ignores
      the bottom 32 bits of the tb_to_xs value, which is a 0.64 format binary
      fraction.  Doing so gets rid of 4 multiply instructions.  Assuming
      a timebase frequency of 1GHz or less and an update interval of no
      more than 10ms, the upper 32 bits of tb_to_xs will be at least
      4503599, so the error from ignoring the low 32 bits will be at most
      2.2ns, which is more than an order of magnitude less than the time
      taken to do gettimeofday or clock_gettime on our fastest processors,
      so there is no possibility of seeing inconsistent values due to this.
      
      This also moves update_gtod() down next to its only caller, and makes
      update_vsyscall use the time passed in via the wall_time argument rather
      than accessing xtime directly.  At present, wall_time always points to
      xtime, but that could change in future.
      Signed-off-by: default avatarPaul Mackerras <paulus@samba.org>
      Signed-off-by: default avatarBenjamin Herrenschmidt <benh@kernel.crashing.org>
      8fd63a9e
    • Benjamin Herrenschmidt's avatar
      5f07aa75
  2. 08 Jul, 2010 19 commits
  3. 07 Jul, 2010 2 commits