1. 14 7月, 2010 2 次提交
  2. 09 7月, 2010 12 次提交
    • M
      powerpc/book3e: Resend doorbell exceptions to ourself · 850f22d5
      Michael Ellerman 提交于
      If we are soft disabled and receive a doorbell exception we don't process
      it immediately. This means we need to check on the way out of irq restore
      if there are any doorbell exceptions to process.
      
      The problem is at that point we don't know what our regs are, and that
      in turn makes xmon unhappy. To workaround the problem, instead of checking
      for and processing doorbells, we check for any doorbells and if there were
      any we send ourselves another.
      Signed-off-by: NMichael Ellerman <michael@ellerman.id.au>
      Signed-off-by: NBenjamin Herrenschmidt <benh@kernel.crashing.org>
      850f22d5
    • D
      powerpc/book3e: Use set_irq_regs() in the msgsnd/msgrcv IPI path · 0e37d259
      David Gibson 提交于
      include/asm-generic/irq_regs.h declares per-cpu irq_regs variables and
      get_irq_regs() and set_irq_regs() helper functions to maintain them.
      These can be used to access the proper pt_regs structure related to the
      current interrupt entry (if any).
      
      In the powerpc arch code, this is used to maintain irq regs on
      decrementer and external interrupt exceptions.  However, for the
      doorbell exceptions used by the msgsnd/msgrcv IPI mechanism of newer
      BookE CPUs, the irq_regs are not kept up to date.
      
      In particular this means that xmon will not work properly on SMP,
      because the secondary xmon instances started by IPI will blow up when
      they cannot retrieve the irq regs.
      
      This patch fixes the problem by adding calls to maintain the irq regs
      across doorbell exceptions.
      Signed-off-by: NDavid Gibson <david@gibson.dropbear.id.au>
      Signed-off-by: NBenjamin Herrenschmidt <benh@kernel.crashing.org>
      0e37d259
    • B
      powerpc/book3e: Hookup doorbells exceptions on 64-bit Book3E · 89c81797
      Benjamin Herrenschmidt 提交于
      Note that critical doorbells are an unimplemented stub just like
      other critical or machine check handlers, since we haven't done
      support for "levelled" exceptions yet.
      Signed-off-by: NBenjamin Herrenschmidt <benh@kernel.crashing.org>
      89c81797
    • B
      powerpc/book3e: Don't re-trigger decrementer on lazy irq restore · e8775d4a
      Benjamin Herrenschmidt 提交于
      The decrementer on BookE acts as a level interrupt and doesn't
      need to be re-triggered when going negative. It doesn't go
      negative anyways (unless programmed to auto-reload with a
      negative value) as it stops when reaching 0.
      Signed-off-by: NBenjamin Herrenschmidt <benh@kernel.crashing.org>
      e8775d4a
    • B
      powerpc/book3e: More doorbell cleanups. Sample the PIR register · b9f1cd71
      Benjamin Herrenschmidt 提交于
      The doorbells use the content of the PIR register to match messages
      from other CPUs. This may or may not be the same as our linux CPU
      number, so using that as the "target" is no right.
      
      Instead, we sample the PIR register at boot on every processor
      and use that value subsequently when sending IPIs.
      
      We also use a per-cpu message mask rather than a global array which
      should limit cache line contention.
      
      Note: We could use the CPU number in the device-tree instead of
      the PIR register, as they are supposed to be equivalent. This
      might prove useful if doorbells are to be used to kick CPUs out
      of FW at boot time, thus before we can sample the PIR. This is
      however not the case now and using the PIR just works.
      Signed-off-by: NBenjamin Herrenschmidt <benh@kernel.crashing.org>
      b9f1cd71
    • B
      e3145b38
    • B
      powerpc/book3e: Hack to get gdb moving along on Book3E 64-bit · a2e19811
      Benjamin Herrenschmidt 提交于
      Our handling of debug interrupts on Book3E 64-bit is not quite
      the way it should be just yet. This is a workaround to let gdb
      work at least for now. We ensure that when context switching,
      we set the appropriate DBCR0 value for the new task. We also
      make sure that we turn off MSR[DE] within the kernel, and set
      it as part of the bits that get set when going back to userspace.
      
      In the long run, we will probably set the userspace DBCR0 on the
      exception exit code path and ensure we have some proper kernel
      value to set on the way into the kernel, a bit like ppc32 does,
      but that will take more work.
      Signed-off-by: NBenjamin Herrenschmidt <benh@kernel.crashing.org>
      a2e19811
    • M
      powerpc: Add i8042 keyboard and mouse irq parsing · 540c6c39
      Martyn Welch 提交于
      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: NMartyn Welch <martyn.welch@ge.com>
      Signed-off-by: NBenjamin Herrenschmidt <benh@kernel.crashing.org>
      540c6c39
    • A
      powerpc: Optimise per cpu accesses on 64bit · ae01f84b
      Anton Blanchard 提交于
      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: NAnton Blanchard <anton@samba.org>
      Signed-off-by: NBenjamin Herrenschmidt <benh@kernel.crashing.org>
      ae01f84b
    • B
      powerpc/pseries: Migration code reorganization / hibernation prep · 8fe93f8d
      Brian King 提交于
      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: NBrian King <brking@linux.vnet.ibm.com>
      Signed-off-by: NBenjamin Herrenschmidt <benh@kernel.crashing.org>
      8fe93f8d
    • P
      powerpc: Clean up obsolete code relating to decrementer and timebase · c1aa687d
      Paul Mackerras 提交于
      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: NPaul Mackerras <paulus@samba.org>
      Signed-off-by: NBenjamin Herrenschmidt <benh@kernel.crashing.org>
      c1aa687d
    • P
      powerpc: Rework VDSO gettimeofday to prevent time going backwards · 8fd63a9e
      Paul Mackerras 提交于
      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: NPaul Mackerras <paulus@samba.org>
      Signed-off-by: NBenjamin Herrenschmidt <benh@kernel.crashing.org>
      8fd63a9e
  3. 08 7月, 2010 5 次提交
  4. 30 6月, 2010 1 次提交
    • P
      powerpc, hw_breakpoint: Tell generic code we have no instruction breakpoints · d09ec738
      Paul Mackerras 提交于
      At present, hw_breakpoint_slots() returns 1 regardless of what
      type of breakpoint is specified in the type argument.  Since we
      don't define CONFIG_HAVE_MIXED_BREAKPOINTS_REGS, there are
      separate values for TYPE_INST and TYPE_DATA, and hw_breakpoint_slots()
      returns 1 for both, effectively advertising instruction breakpoint
      support which doesn't exist.
      
      This fixes it by making hw_breakpoint_slots return 1 for TYPE_DATA
      and 0 for TYPE_INST.  This moves hw_breakpoint_slots() from the
      powerpc hw_breakpoint.h to hw_breakpoint.c because the definitions
      of TYPE_INST and TYPE_DATA aren't available in <asm/hw_breakpoint.h>.
      They are defined in <linux/hw_breakpoint.h> but we can't include
      that header in <asm/hw_breakpoint.h>, and nor can we rely on
      <linux/hw_breakpoint.h> being included before <asm/hw_breakpoint.h>.
      Since hw_breakpoint_slots() is only called at boot time, there is
      no performance impact from making it a real function rather than
      a static inline.
      Signed-off-by: NPaul Mackerras <paulus@samba.org>
      d09ec738
  5. 23 6月, 2010 2 次提交
  6. 22 6月, 2010 4 次提交
    • K
      powerpc, hw_breakpoint: Discard extraneous interrupt due to accesses outside symbol length · e3e94084
      K.Prasad 提交于
      Many a times, the requested breakpoint length can be less than the
      fixed breakpoint length i.e. 8 bytes supported by PowerPC 64-bit
      server (Book III S) processors.  This could lead to extraneous
      interrupts resulting in false breakpoint notifications.  This
      detects and discards such interrupts for non-ptrace requests.
      We don't change ptrace behaviour to avoid breaking compatability.
      
      [Suggestion from Paul Mackerras <paulus@samba.org> to add a new flag in
      'struct arch_hw_breakpoint' to identify extraneous interrupts]
      Signed-off-by: NK.Prasad <prasad@linux.vnet.ibm.com>
      Signed-off-by: NPaul Mackerras <paulus@samba.org>
      e3e94084
    • K
      powerpc, hw_breakpoint: Enable hw-breakpoints while handling intervening signals · 06532a67
      K.Prasad 提交于
      A signal delivered between a hw_breakpoint_handler() and the
      single_step_dabr_instruction() will not have the breakpoint active
      while the signal handler is running -- the signal delivery will
      set up a new MSR value which will not have MSR_SE set, so we
      won't get the signal step interrupt until and unless the signal
      handler returns (which it may never do).
      
      To fix this, we restore the breakpoint when delivering a signal --
      we clear the MSR_SE bit and set the DABR again.  If the signal
      handler returns, the DABR interrupt will occur again when the
      instruction that we were originally trying to single-step gets
      re-executed.
      
      [Paul Mackerras <paulus@samba.org> pointed out the need to do this.]
      Signed-off-by: NK.Prasad <prasad@linux.vnet.ibm.com>
      Signed-off-by: NPaul Mackerras <paulus@samba.org>
      06532a67
    • K
      powerpc, hw_breakpoint: Handle concurrent alignment interrupts · 2538c2d0
      K.Prasad 提交于
      If an alignment interrupt occurs on an instruction that is being
      single-stepped, the alignment interrupt handler currently handles
      the single-step condition by unconditionally sending a SIGTRAP to
      the process.  Other synchronous interrupts that result in the
      instruction being emulated do likewise.
      
      With hw_breakpoint support, the hw_breakpoint code needs to be able
      to intercept these single-step events as well as those where the
      instruction executes normally and a trace interrupt happens.
      
      Fix this by making emulate_single_step() use the existing
      single_step_exception() function instead of calling _exception()
      directly.  We then make single_step_exception() use the abstracted
      clear_single_step() rather than clearing bits in the MSR image
      directly so that emulate_single_step() will continue to work
      correctly on Book 3E processors.
      Signed-off-by: NK.Prasad <prasad@linux.vnet.ibm.com>
      Signed-off-by: NPaul Mackerras <paulus@samba.org>
      2538c2d0
    • K
      powerpc, hw_breakpoints: Implement hw_breakpoints for 64-bit server processors · 5aae8a53
      K.Prasad 提交于
      Implement perf-events based hw-breakpoint interfaces for PowerPC
      64-bit server (Book III S) processors.  This allows access to a
      given location to be used as an event that can be counted or
      profiled by the perf_events subsystem.
      
      This is done using the DABR (data breakpoint register), which can
      also be used for process debugging via ptrace.  When perf_event
      hw_breakpoint support is configured in, the perf_event subsystem
      manages the DABR and arbitrates access to it, and ptrace then
      creates a perf_event when it is requested to set a data breakpoint.
      
      [Adopted suggestions from Paul Mackerras <paulus@samba.org> to
      - emulate_step() all system-wide breakpoints and single-step only the
        per-task breakpoints
      - perform arch-specific cleanup before unregistration through
        arch_unregister_hw_breakpoint()
      ]
      Signed-off-by: NK.Prasad <prasad@linux.vnet.ibm.com>
      Signed-off-by: NPaul Mackerras <paulus@samba.org>
      5aae8a53
  7. 15 6月, 2010 3 次提交
    • M
      powerpc: rtas_flash needs to use rtas_data_buf · bd2b64a1
      Milton Miller 提交于
      When trying to flash a machine via the update_flash command, Anton received the
      following error:
      
          Restarting system.
          FLASH: kernel bug...flash list header addr above 4GB
      
      The code in question has a comment that the flash list should be in
      the kernel data and therefore under 4GB:
      
              /* NOTE: the "first" block list is a global var with no data
               * blocks in the kernel data segment.  We do this because
               * we want to ensure this block_list addr is under 4GB.
               */
      
      Unfortunately the Kconfig option is marked tristate which means the variable
      may not be in the kernel data and could be above 4GB.
      
      Instead of relying on the data segment being below 4GB, use the static
      data buffer allocated by the kernel for use by rtas.  Since we don't
      use the header struct directly anymore, convert it to a simple pointer.
      Reported-By: NAnton Blanchard <anton@samba.org>
      Signed-Off-By: Milton Miller <miltonm@bga.com
      Tested-By: NAnton Blanchard <anton@samba.org>
      Signed-off-by: NBenjamin Herrenschmidt <benh@kernel.crashing.org>
      bd2b64a1
    • C
      powerpc: Unconditionally enabled irq stacks · f1ba9a5b
      Christoph Hellwig 提交于
      Irq stacks provide an essential protection from stack overflows through
      external interrupts, at the cost of two additionals stacks per CPU.
      
      Enable them unconditionally to simplify the kernel build and prevent
      people from accidentally disabling them.
      Signed-off-by: NChristoph Hellwig <hch@lst.de>
      Signed-off-by: NBenjamin Herrenschmidt <benh@kernel.crashing.org>
      f1ba9a5b
    • M
      powerpc/kexec: Wait for online/possible CPUs only. · b636f137
      Matt Evans 提交于
      kexec_perpare_cpus_wait() iterates i through NR_CPUS to check
      paca[i].kexec_state of each to make sure they have quiesced.
      However now we have dynamic PACA allocation, paca[NR_CPUS] is not necessarily
      valid and we overrun the array;  spurious "cpu is not possible, ignoring"
      errors result.  This patch iterates for_each_online_cpu so stays
      within the bounds of paca[] -- and every CPU is now 'possible'.
      Signed-off-by: NMatt Evans <matt@ozlabs.org>
      Signed-off-by: NBenjamin Herrenschmidt <benh@kernel.crashing.org>
      b636f137
  8. 12 6月, 2010 1 次提交
  9. 02 6月, 2010 1 次提交
  10. 31 5月, 2010 1 次提交
  11. 28 5月, 2010 1 次提交
  12. 25 5月, 2010 3 次提交
  13. 22 5月, 2010 3 次提交
  14. 21 5月, 2010 1 次提交