1. 25 Jun, 2007 3 commits
    • Olof Johansson's avatar
      [POWERPC] pasemi: Electra IDE/pata_platform glue · 8fa336d8
      Olof Johansson authored
      Glue code to hook up the pata_platform on the PA Semi Electra eval board.
      CFE sets up device tree entries for the IDE interface, with device type
      'ide' and compatible field 'electra-ide'.
      
      We unfortunately need to modify the resources before calling the generic
      platform driver, since the device tree only has one register window in
      it and the driver expects two.  Adding this as an of_platform driver
      instead doesn't give us any benefit, it just adds one more layer of
      register/probe functions.
      
      Since CONFIG_PATA_PLATFORM depends on CONFIG_EMBEDDED, add that as a
      default for PPC_PASEMI.
      Signed-off-by: default avatarOlof Johansson <olof@lixom.net>
      Signed-off-by: default avatarPaul Mackerras <paulus@samba.org>
      8fa336d8
    • Johannes Berg's avatar
      [POWERPC] Use mktime in timer sysdev · 0c358e70
      Johannes Berg authored
      This makes the timer sysdev use mktime instead of rtc_tm_to_time,
      since rtc_tm_to_time just calls mktime anyway, and this means we
      don't have a dependency on rtc-lib.
      Signed-off-by: default avatarJohannes Berg <johannes@sipsolutions.net>
      Signed-off-by: default avatarPaul Mackerras <paulus@samba.org>
      0c358e70
    • Milton Miller's avatar
      [POWERPC] kexec: Send slaves to new kernel earlier · ee46a90b
      Milton Miller authored
      With this, when kexec-ing, we copy the code and start the slaves on
      their journey to the next kernel's spin loop as soon as we copy the
      kexec image into place.
      
      The kernel doesn't know exactly which slaves are spinning in
      kexec_wait.  This allows us to pass more than max-cpus to the
      next kernel.  But it also means that we might leave some behind.
      
      Moving the code here means they have the time it takes us to
      clear the hash table to wake up and move on.  Moving the code
      any earlier would reuqire walking the image description to
      search for the code, which could span multiple pages.
      Signed-off-by: default avatarMilton Miller <miltonm@bga.com>
      Signed-off-by: default avatarPaul Mackerras <paulus@samba.org>
      ee46a90b
  2. 14 Jun, 2007 37 commits
    • David Gibson's avatar
      [POWERPC] Fix problems with device tree representation of TSI-1xx bridges · e58ca3de
      David Gibson authored
      This fixes some problems with the way the some things
      represented in the device tree for the Holly and Taiga boards.  This
      means changes both to the dts files, and to the code which
      instantiates the tsi108 ethernet platform devices based on the device
      tree.
      
      	- First, and most importantly, the ethernet PHYs are given
      with an identical 'reg' property.  This reg currently encodes the
      accessible register used to initiate mdio interaction with the PHYs,
      rather than a meaningful address on the parent bus (mdio in this
      case), which is incorrect.  Instead we give the address of these
      registers as 'reg' in the mdio node itself, and encode the ID of each
      phy in their 'reg' propertyies.
      	- Currently the platform device constructor enables a
      workaround in the tsi108 ethernet driver based on the compatible
      property of the PHY.  This is incorrect, because the workaround in
      question is necessary due to the board's wiring of the PHY, not the
      model of PHY itself.  This patch alters the constructor to instead
      enable the workaround based on a new special property in the PHY node.
      	- The compatible properties on a number of nodes in the device
      tree are insufficiently precise.  In particular the PHYs give only
      "bcm54xx", which is broken, since there are many bcm54xx PHY models,
      and they have differences which matter.  The mdio had a compatible
      property of "tsi-ethernet" identical to the ethernet MAC nodes, which
      doesn't make sense.  The ethernet, i2c, bridge and PCI nodes were
      given only as "tsi-*" which is somewhat inprecise, we replace with
      "tsi108-*" in the case of Taiga (which has a TSI108 bridge), and
      "tsi109-*", "tsi108-*" in the case of Holly (which has a TSI109
      bridge).
      	- We remove some "model" properties from the ethernets on
      Taiga board which were neither useful nor adequately precise.
      	- On Holly we change to using a dtc label instead of a full
      path to reference the MPIC node, which makes the dts a little more
      readable.
      Signed-off-by: default avatarDavid Gibson <david@gibson.dropbear.id.au>
      Signed-off-by: default avatarPaul Mackerras <paulus@samba.org>
      e58ca3de
    • David Gibson's avatar
      [POWERPC] Don't store a command line in the Holly device tree · e60c526f
      David Gibson authored
      Currently, the Holly device tree includes a bootargs property in
      /chosen, which gives a commandline.  This is somewhat inconvenient,
      because it means an alternative default command line can't be given in
      the kernel config - the value obtained from the dts via the
      bootwrapper will always override CONFIG_CMDLINE.
      
      This removes the command line from the dts, and instead puts the
      same command line as a default in holly_defconfig.
      Signed-off-by: default avatarDavid Gibson <david@gibson.dropbear.id.au>
      Signed-off-by: default avatarPaul Mackerras <paulus@samba.org>
      e60c526f
    • David Gibson's avatar
      [POWERPC] Consolidate cuboot initialization code · 85aecac8
      David Gibson authored
      The various cuboot platforms (i.e. pre-device tree aware u-boot for
      83xx, 85xx and Ebony) share a certain amount of code for parsing the
      boot parameters.  To a certain extent that's inevitable, since they
      platforms have different definitions of the bd_t structure.  However,
      with some macro work and a helper function, this patch improves the
      situation a bit.
      
      In the process, this fixes a bug on Ebony, which was incorrectly
      handling the parameters passed form u-boot for the command line (the
      bug was copied from 83xx and 85xx which have subsequently been fixed).
      Signed-off-by: default avatarDavid Gibson <david@gibson.dropbear.id.au>
      Signed-off-by: default avatarPaul Mackerras <paulus@samba.org>
      85aecac8
    • David Gibson's avatar
      [POWERPC] Derive ebc ranges property from EBC registers · b2ba34f3
      David Gibson authored
      In the device tree for Ebony, the 'ranges' property in the node for
      the EBC bridge shows the mappings from the chip select / address lines
      actually used for the EBC peripherals into the address space of the
      OPB.  At present, these mappings are hardcoded in ebony.dts for the
      mappings set up by the OpenBIOS firmware when it configures the EBC
      bridge.
      
      This replaces the hardcoded mappings with code in the zImage to
      read the EBC configuration registers and create an appropriate ranges
      property based on them.  This should make the zImage and kernel more
      robust to changes in firmware configuration.  In particular, some of
      the Ebony's DIP switches can change the effective address of the Flash
      and other peripherals in OPB space.  With this patch, the kernel will
      be able to cope with at least some of the possible variations.
      Signed-off-by: default avatarDavid Gibson <david@gibson.dropbear.id.au>
      Signed-off-by: default avatarPaul Mackerras <paulus@samba.org>
      b2ba34f3
    • David Gibson's avatar
      [POWERPC] Factor zImage's 44x reset code out of ebony.c · 11123346
      David Gibson authored
      The ebony_exit() function which resets the Ebony board should in fact
      be common to most if not all 44x boards.  This moves the function out
      into 44x.c, renaming it, so it can be used by other 44x platforms.
      Signed-off-by: default avatarDavid Gibson <david@gibson.dropbear.id.au>
      Signed-off-by: default avatarPaul Mackerras <paulus@samba.org>
      11123346
    • David Gibson's avatar
      [POWERPC] Merge CPU features pertaining to icache coherency · 4508dc21
      David Gibson authored
      Currently the powerpc kernel has a 64-bit only feature,
      COHERENT_ICACHE used for those CPUS which maintain icache/dcache
      coherency in hardware (POWER5, essentially).  It also has a feature,
      SPLIT_ID_CACHE, which is used on CPUs which have separate i and
      d-caches, which is to say everything except 601 and Freescale E200.
      
      In nearly all the places we check the SPLIT_ID_CACHE, what we actually
      care about is whether the i and d-caches are coherent (which they will
      be, trivially, if they're the same cache).
      
      This tries to clarify the situation a little.  The COHERENT_ICACHE
      feature becomes availble on 32-bit and is set for all CPUs where i and
      d-cache are effectively coherent, whether this is due to special logic
      (POWER5) or because they're unified.  We check this, instead of
      SPLIT_ID_CACHE nearly everywhere.
      
      The SPLIT_ID_CACHE feature itself is replaced by a UNIFIED_ID_CACHE
      feature with reversed sense, set only on 601 and Freescale E200.  In
      the two places (one Freescale BookE specific) where we really care
      whether it's a unified cache, not whether they're coherent, we check
      this feature.  The CPUs with unified cache are so few, we could
      consider replacing this feature bit with explicit checks against the
      PVR.
      
      This will make unifying the 32-bit and 64-bit cache flush code a
      little more straightforward.
      Signed-off-by: default avatarDavid Gibson <dwg@au1.ibm.com>
      Signed-off-by: default avatarPaul Mackerras <paulus@samba.org>
      4508dc21
    • David Gibson's avatar
      [POWERPC] Kill typedef-ed structs for hash PTEs and BATs · 8e561e7e
      David Gibson authored
      Using typedefs to rename structure types if frowned on by CodingStyle.
      However, we do so for the hash PTE structure on both ppc32 (where it's
      called "PTE") and ppc64 (where it's called "hpte_t").  On ppc32 we
      also have such a typedef for the BATs ("BAT").
      
      This removes this unhelpful use of typedefs, in the process
      bringing ppc32 and ppc64 closer together, by using the name "struct
      hash_pte" in both cases.
      Signed-off-by: default avatarDavid Gibson <david@gibson.dropbear.id.au>
      Signed-off-by: default avatarPaul Mackerras <paulus@samba.org>
      8e561e7e
    • David Gibson's avatar
      [POWERPC] Start factoring pgtable-ppc32.h and pgtable-ppc64.h · 9c709f3b
      David Gibson authored
      This factors some things defined in both pgtable-ppc32.h and
      pgtable-ppc64.h into the common part of asm-powerpc/pgtable.h.  These
      are all things which have essentially identical definitions, and which
      by their nature are very unlikely ever to need different definitions
      in the two cases.
      Signed-off-by: default avatarDavid Gibson <david@gibson.dropbear.id.au>
      Signed-off-by: default avatarPaul Mackerras <paulus@samba.org>
      9c709f3b
    • David Gibson's avatar
      [POWERPC] Remove a couple of unused definitions from pgtable_32.c · c0770f68
      David Gibson authored
      In arch/powerpc/mm/pgtable_32.c, the variable io_bat_index and the
      macro is_power_of_4() no longer have any users.  This removes them.
      Signed-off-by: default avatarDavid Gibson <david@gibson.dropbear.id.au>
      Signed-off-by: default avatarPaul Mackerras <paulus@samba.org>
      c0770f68
    • David Gibson's avatar
      [POWERPC] Remove the dregs of APUS support from arch/powerpc · f21f49ea
      David Gibson authored
      APUS (the Amiga Power-Up System) is not supported under arch/powerpc
      and it's unlikely it ever will be.  Therefore, this patch removes the
      fragments of APUS support code from arch/powerpc which have been
      copied from arch/ppc.
      
      A few APUS references are left in asm-powerpc in .h files which are
      still used from arch/ppc.
      Signed-off-by: default avatarDavid Gibson <david@gibson.dropbear.id.au>
      Signed-off-by: default avatarPaul Mackerras <paulus@samba.org>
      f21f49ea
    • David Gibson's avatar
      [POWERPC] Abolish iopa(), mm_ptov(), io_block_mapping() from arch/powerpc · 90ac19a8
      David Gibson authored
      These old-fashioned IO mapping functions no longer have any callers in
      code which remains relevant on arch/powerpc.  Therefore, this removes
      them from arch/powerpc.
      Signed-off-by: default avatarDavid Gibson <david@gibson.dropbear.id.au>
      Signed-off-by: default avatarPaul Mackerras <paulus@samba.org>
      90ac19a8
    • David Gibson's avatar
      [POWERPC] Split out asm-ppc/mmu.h portions for the "classic" hash-based MMU · 4db68bfe
      David Gibson authored
      arch/powerpc still relies on asm-ppc/mmu.h for most 32-bit MMU types.
      This is another step towards fixing this.  It takes the portions
      of asm-ppc/mmu.h related to the "classic" 32-bit hash page table MMU
      which are still relevant in arch/powerpc and puts them in a new
      asm-powerpc/mmu-hash32.h, included when appropriate from
      asm-powerpc/mmu.h.
      Signed-off-by: default avatarDavid Gibson <david@gibson.dropbear.id.au>
      Signed-off-by: default avatarPaul Mackerras <paulus@samba.org>
      4db68bfe
    • David Gibson's avatar
      [POWERPC] Split low-level OF-related bootloader code into separate files · 2e601613
      David Gibson authored
      Currently, all OF-related code in the bootloader is contained in of.c.
      of.c also provides the platform specific things necessary to boot on
      an OF platform.
      
      However, there are platforms (such as PReP) which can include an OF
      implementation, but are not bootable as pure OF systems.  For use by
      such platforms, this patch splits out the low-level parts of the OF
      code (call_prom() and various wrappers thereof) into a new oflib.c
      file.  In addition, the code related to bootwrapper console output via
      OF are moved to a new ofconsole.c file.  Both these files are included
      in the wrapper.a library where they can be used by both full-OF and
      partial OF platforms.
      Signed-off-by: default avatarDavid Gibson <david@gibson.dropbear.id.au>
      Signed-off-by: default avatarPaul Mackerras <paulus@samba.org>
      2e601613
    • Arnd Bergmann's avatar
      [POWERPC] Split out CPU specific options into a new Kconfig file · a0ae9c7c
      Arnd Bergmann authored
      A lot of the options in arch/powerpc/Kconfig deal with the CPU menu,
      and my next patches add more to them.  Moving them to a new
      arch/powerpc/platforms/Kconfig.cputype file makes it easier to
      follow.
      
      There are no functional changes in here.
      Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
      Signed-off-by: default avatarPaul Mackerras <paulus@samba.org>
      a0ae9c7c
    • will schmidt's avatar
      [POWERPC] During VM oom condition, kill all threads in process group · effe24bd
      will schmidt authored
      We have had complaints where a threaded application is left in a bad state
      after one of it's threads is killed when we hit a VM: out_of_memory
      condition.
      
      Killing just one of the process threads can leave the application in a
      bad state, whereas killing the entire process group would allow for
      the application to restart, or be otherwise handled, and makes it very
      obvious that something has gone wrong.
      
      This change allows the entire process group to be taken down, rather than
      just the one thread.
      
      lightly tested on powerpc
      Signed-off-by: default avatarWill <will_schmidt@vnet.ibm.com>
      Signed-off-by: default avatarPaul Mackerras <paulus@samba.org>
      effe24bd
    • Jake Moilanen's avatar
      [POWERPC] Donate idle CPU cycles on dedicated partitions · d8c391a5
      Jake Moilanen authored
      A Power6 can give up CPU cycles on a dedicated CPU (as opposed to a
      shared CPU) to other shared processors if the administrator asks for it
      (via the HMC).
      
      This enables that to work properly on P6.
      
      This just involves setting a bit in the CAS structure as well as the
      VPA.  To donate cycles, a CPU has to have all SMT threads idle and
      have the donate bit set in the VPA.  Then call H_CEDE.
      
      The reason why shared processors just aren't used is because dedicated
      CPUs are guaranteed an actual processor, yet the system is still able to
      increase the capacity of the shared CPU pool.
      
      Also rename the VPA's cpuctls_task_attrs field to a more accurate name.
      Signed-off-by: default avatarJake Moilanen <moilanen@austin.ibm.com>
      Signed-off-by: default avatarPaul Mackerras <paulus@samba.org>
      d8c391a5
    • Benjamin Herrenschmidt's avatar
      [POWERPC] Less ifdef's in signal.c/signal.h · 2f97cd39
      Benjamin Herrenschmidt authored
      This patch moves things around a little bit in the new common signal.c
      and signal.h files to remove the last #ifdef in the middle of the
      common do_signal().
      Signed-off-by: default avatarBenjamin Herrenschmidt <benh@kernel.crashing.org>
      Signed-off-by: default avatarPaul Mackerras <paulus@samba.org>
      2f97cd39
    • Benjamin Herrenschmidt's avatar
      [POWERPC] Remove #ifdef around set_dabr in signal code · 0edc4ffd
      Benjamin Herrenschmidt authored
      set_dabr() and thread.dabr exist on 32 bits as well nowadays (they
      actually may do something even, depending on what CPU you have).
      
      So this removes the ifdef.
      Signed-off-by: default avatarBenjamin Herrenschmidt <benh@kernel.crashing.org>
      Signed-off-by: default avatarPaul Mackerras <paulus@samba.org>
      0edc4ffd
    • Benjamin Herrenschmidt's avatar
      [POWERPC] Merge creation of signal frame · a3f61dc0
      Benjamin Herrenschmidt authored
      The code for creating signal frames was still duplicated and split
      in strange ways between 32 and 64 bits, including the SA_ONSTACK
      handling being in do_signal on 32 bits but inside handle_rt_signal
      on 64 bits etc...
      
      This moves the 64 bits get_sigframe() to the generic signal.c,
      cleans it a bit, moves the access_ok() call done by all callers to
      it as well, and adapts/cleanups the 3 different signal handling cases
      to use that common function.
      Signed-off-by: default avatarBenjamin Herrenschmidt <benh@kernel.crashing.org>
      Signed-off-by: default avatarPaul Mackerras <paulus@samba.org>
      a3f61dc0
    • Benjamin Herrenschmidt's avatar
      [POWERPC] Remove obsolete freezer bits · 5f9f375a
      Benjamin Herrenschmidt authored
      The powerpc signal code still had some obsolete freezer bits that
      have long been removed from x86 (it's now done in generic code).
      Signed-off-by: default avatarBenjamin Herrenschmidt <benh@kernel.crashing.org>
      Signed-off-by: default avatarPaul Mackerras <paulus@samba.org>
      5f9f375a
    • Christoph Hellwig's avatar
      [POWERPC] Consolidate do_signal · f478f543
      Christoph Hellwig authored
      do_signal has exactly the same behaviour on 32bit and 64bit and 32bit
      compat on 64bit for handling 32bit signals.  Consolidate all these
      into one common function in signal.c.  The only odd left over is
      the try_to_free in the 32bit version that no other architecture has
      in mainline (only in i386 for some odd SuSE release).  We should
      probably get rid of it in a separate patch.
      Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
      Signed-off-by: default avatarBenjamin Herrenschmidt <benh@kernel.crashing.org>
      Signed-off-by: default avatarPaul Mackerras <paulus@samba.org>
      f478f543
    • Christoph Hellwig's avatar
      [POWERPC] Consolidate restore_sigmask · db277e9a
      Christoph Hellwig authored
      restore_sigmask is exactly the same on 32 and 64bit, so move it to
      common code.  Also move _BLOCKABLE to signal.h to avoid defining it
      multiple times.
      Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
      Signed-off-by: default avatarBenjamin Herrenschmidt <benh@kernel.crashing.org>
      Signed-off-by: default avatarPaul Mackerras <paulus@samba.org>
      db277e9a
    • Christoph Hellwig's avatar
      [POWERPC] Consolidate sys_sigaltstack · 69d15f6b
      Christoph Hellwig authored
      sys_sigaltstack is the same on 32bit and 64 and we can consolidate it
      to signal.c.  The only difference is that the 32bit code uses ints
      for the unused register paramaters and 64bit unsigned long.  I've
      changed it to unsigned long because it's the same width on 32bit.
      
      (I also wonder who came up with this awkward calling convention.. :))
      Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
      Signed-off-by: default avatarBenjamin Herrenschmidt <benh@kernel.crashing.org>
      Signed-off-by: default avatarPaul Mackerras <paulus@samba.org>
      69d15f6b
    • Benjamin Herrenschmidt's avatar
      [POWERPC] Make syscall restart code more common · 22e38f29
      Benjamin Herrenschmidt authored
      This patch moves the code in signal_32.c and signal_64.c for handling
      syscall restart into a common signal.c file and converge around a single
      implementation that is based on the 32 bits one, using trap, ccr
      and r3 rather than the special "result" field for deciding what to do.
      
      The "result" field is now pretty much deprecated. We still set it for
      the sake of whatever might rely on it in userland but we no longer use
      it's content.
      
      This, along with a previous patch that enables ptracers to write to
      "trap" and "orig_r3" should allow gdb to properly handle syscall
      restarting.
      Signed-off-by: default avatarBenjamin Herrenschmidt <benh@kernel.crashing.org>
      Signed-off-by: default avatarPaul Mackerras <paulus@samba.org>
      22e38f29
    • Benjamin Herrenschmidt's avatar
      [POWERPC] Always apply DABR changes on context switches · 791cc501
      Benjamin Herrenschmidt authored
      This patch removes the #ifdef CONFIG_PPC64 around setting the DABR.
      
      The actual setting of the SPR inside of the set_dabr() function is dependent
      on CONFIG_PPC64 || CONFIG_6xx but you can always provide a ppc_md hook to
      override that.  We should improve support for different HW breakpoints
      facilities but this is a first step.
      Signed-off-by: default avatarBenjamin Herrenschmidt <benh@kernel.crashing.org>
      Signed-off-by: default avatarPaul Mackerras <paulus@samba.org>
      791cc501
    • Benjamin Herrenschmidt's avatar
      [POWERPC] powerpc: ptrace can set DABR on both 32 and 64 bits · 6d110da8
      Benjamin Herrenschmidt authored
      Allow ptrace to set dabr in the thread structure for both 32 and 64 bits,
      though only 64 bits actually uses that field, it's actually defined in both.
      Signed-off-by: default avatarBenjamin Herrenschmidt <benh@kernel.crashing.org>
      Signed-off-by: default avatarPaul Mackerras <paulus@samba.org>
      6d110da8
    • Benjamin Herrenschmidt's avatar
      [POWERPC] ptrace shouldn't touch FP exec mode · abd06505
      Benjamin Herrenschmidt authored
      One of the gratuitous difference between 32 and 64-bit ptrace is
      whether you can whack the MSR:FE0 and FE1 bits from ptrace.  This
      patch forbids it unconditionally.  In addition, the 64-bit kernels
      used to return the exception mode in the MSR on reads, but 32-bit
      kernels didn't.  This patch makes it return those bits on both.
      
      Finally, since ptrace-ppc32.h and ptrace-ppc64.h are mostly empty now, and
      since the previous patch made ptrace32.c no longer need the MSR_DEBUGCHANGE
      definition, we just remove those 2 files and move back the remaining bits
      to ptrace.c (they were short lived heh ?).
      Signed-off-by: default avatarBenjamin Herrenschmidt <benh@kernel.crashing.org>
      Signed-off-by: default avatarPaul Mackerras <paulus@samba.org>
      abd06505
    • Benjamin Herrenschmidt's avatar
      [POWERPC] Allow ptrace write to pt_regs trap and orig_r3 · 912000e7
      Benjamin Herrenschmidt authored
      This patch allows a ptracer to write to the "trap" and "orig_r3" words
      of the pt_regs.
      
      This, along with a subsequent patch to the signal restart code, should
      enable gdb to properly handle syscall restarting after executing a separate
      function (at least when there's no restart block).
      
      This patch also removes ptrace32.c code toying directly with the registers
      and makes it use the ptrace_get/put_reg() accessors for everything so that
      the logic for checking what is permitted is in only one place.
      Signed-off-by: default avatarBenjamin Herrenschmidt <benh@kernel.crashing.org>
      Signed-off-by: default avatarPaul Mackerras <paulus@samba.org>
      912000e7
    • Benjamin Herrenschmidt's avatar
      [POWERPC] Remove some useless ifdef's in ptrace · 1b6610d6
      Benjamin Herrenschmidt authored
      CHECK_FULL_REGS() exist on both 32 and 64 bits, so there's no need
      to make it conditional on CONFIG_PPC32.
      Signed-off-by: default avatarBenjamin Herrenschmidt <benh@kernel.crashing.org>
      Signed-off-by: default avatarPaul Mackerras <paulus@samba.org>
      1b6610d6
    • Benjamin Herrenschmidt's avatar
      [POWERPC] Uninline common ptrace bits · 865418d8
      Benjamin Herrenschmidt authored
      This folds back the ptrace-common.h bits back into ptrace.c and removes
      that file. The FSL SPE bits from ptrace-ppc32.h are folded back in as
      well.
      Signed-off-by: default avatarBenjamin Herrenschmidt <benh@kernel.crashing.org>
      Signed-off-by: default avatarPaul Mackerras <paulus@samba.org>
      865418d8
    • Benjamin Herrenschmidt's avatar
      [POWERPC] ptrace updates & new, better requests · e17666ba
      Benjamin Herrenschmidt authored
      The powerpc ptrace interface is dodgy at best. We have defined our
      "own" versions of GETREGS/SETREGS/GETFPREGS/SETFPREGS that strangely
      take arguments in reverse order from other archs (in addition to having
      different request numbers) and have subtle issue, like not accessing
      all of the registers in their respective categories.
      
      This patch moves the implementation of those to a separate function
      in order to facilitate their deprecation in the future, and provides
      new ptrace requests that mirror the x86 and sparc ones and use the
      same numbers:
      
         PTRACE_GETREGS    : returns an entire pt_regs (the whole thing,
                             not only the 32 GPRs, though that doesn't
                             include the FPRs etc... There's a compat version
                             for 32 bits that returns a 32 bits compatible
                             pt_regs (44 uints)
      
         PTRACE_SETREGS    : sets an entire pt_regs (the whole thing,
                             not only the 32 GPRs, though that doesn't
                             include the FPRs etc... Some registers cannot be
                             written to and will just be dropped, this is the
                             same as with POKEUSR, that is anything above MQ
                             on 32 bits and CCR on 64 bits. There is a compat
                             version as well.
      
         PTRACE_GETFPREGS  : returns all the FP registers -including- the FPSCR
                             that is 33 doubles (regardless of 32/64 bits)
      
         PTRACE_SETFPREGS  : sets all the FP registers -including- the FPSCR
                             that is 33 doubles (regardless of 32/64 bits)
      
      And two that only exist on 64 bits kernels:
      
         PTRACE_GETREGS64  : Same as PTRACE_GETREGS, except there is no compat
                             function, a 32 bits process will obtain the full 64
                             bits registers
      
         PTRACE_SETREGS64  : Same as PTRACE_SETREGS, except there is no compat
                             function, a 32 bits process will set the full 64
                             bits registers
      
      The two later ones makes things easier to have a 32 bits debugger on a
      64 bits program (or on a 32 bits program that uses the full 64 bits of
      the GPRs, which is possible though has issues that will be fixed in a
      later patch).
      
      Finally, while at it, the patch removes a whole bunch of code duplication
      between ptrace32.c and ptrace.c, in large part by having the former call
      into the later for all requests that don't need any special "compat"
      treatment.
      Signed-off-by: default avatarBenjamin Herrenschmidt <benh@kernel.crashing.org>
      Signed-off-by: default avatarPaul Mackerras <paulus@samba.org>
      e17666ba
    • Benjamin Herrenschmidt's avatar
      [POWERPC] ptrace cleanups · acd89828
      Benjamin Herrenschmidt authored
      The powerpc ptrace code has some weirdness, like a ptrace-common.h file that
      is actually ppc64 only and some of the 32 bits code ifdef'ed inside ptrace.c.
      
      There are also separate implementations for things like get/set_vrregs for
      32 and 64 bits which is totally unnecessary.
      
      This patch cleans that up a bit by having a ptrace-common.h which contains
      really common code (and makes a lot more code common), and ptrace-ppc32.h and
      ptrace-ppc64.h files that contain the few remaining different bits.
      Signed-off-by: default avatarBenjamin Herrenschmidt <benh@kernel.crashing.org>
      Signed-off-by: default avatarPaul Mackerras <paulus@samba.org>
      acd89828
    • Benjamin Herrenschmidt's avatar
      [POWERPC] Disable broken PPC_PTRACE_GETFPREGS on 32 bits · 0b3d5c48
      Benjamin Herrenschmidt authored
      The handling of PPC_PTRACE_GETFPREGS is broken on 32 bits kernel,
      it will only return half of the registers. Since that call didn't
      initially exist for 32 bits kernel (added recently), rather than
      fixing it, let's just remove it.
      Signed-off-by: default avatarBenjamin Herrenschmidt <benh@kernel.crashing.org>
      Signed-off-by: default avatarPaul Mackerras <paulus@samba.org>
      0b3d5c48
    • Benjamin Herrenschmidt's avatar
      [POWERPC] spufs: Add a "capabilities" file to spu contexts · cbe709c1
      Benjamin Herrenschmidt authored
      This adds a "capabilities" file to spu contexts consisting of a
      list of linefeed separated capability names. The current exposed
      capabilities are "sched" (the context is scheduleable) and
      "step" (the context supports single stepping).
      Signed-off-by: default avatarBenjamin Herrenschmidt <benh@kernel.crashing.org>
      Acked-by: default avatarJeremy Kerr <jk@ozlabs.org>
      Signed-off-by: default avatarPaul Mackerras <paulus@samba.org>
      cbe709c1
    • Benjamin Herrenschmidt's avatar
      [POWERPC] spufs: Add support for SPU single stepping · 05169237
      Benjamin Herrenschmidt authored
      This patch adds support for SPU single stepping. The single
      step bit is set in the SPU when the current process is
      being single-stepped via ptrace. The spu then stops and
      returns with a specific flag set and the syscall exit code
      will generate the SIGTRAP.
      Signed-off-by: default avatarBenjamin Herrenschmidt <benh@kernel.crashing.org>
      Acked-by: default avatarJeremy Kerr <jk@ozlabs.org>
      Signed-off-by: default avatarPaul Mackerras <paulus@samba.org>
      05169237
    • Benjamin Herrenschmidt's avatar
      [POWERPC] Rewrite IO allocation & mapping on powerpc64 · 3d5134ee
      Benjamin Herrenschmidt authored
      This rewrites pretty much from scratch the handling of MMIO and PIO
      space allocations on powerpc64.  The main goals are:
      
       - Get rid of imalloc and use more common code where possible
       - Simplify the current mess so that PIO space is allocated and
         mapped in a single place for PCI bridges
       - Handle allocation constraints of PIO for all bridges including
         hot plugged ones within the 2GB space reserved for IO ports,
         so that devices on hotplugged busses will now work with drivers
         that assume IO ports fit in an int.
       - Cleanup and separate tracking of the ISA space in the reserved
         low 64K of IO space. No ISA -> Nothing mapped there.
      
      I booted a cell blade with IDE on PIO and MMIO and a dual G5 so
      far, that's it :-)
      
      With this patch, all allocations are done using the code in
      mm/vmalloc.c, though we use the low level __get_vm_area with
      explicit start/stop constraints in order to manage separate
      areas for vmalloc/vmap, ioremap, and PCI IOs.
      
      This greatly simplifies a lot of things, as you can see in the
      diffstat of that patch :-)
      
      A new pair of functions pcibios_map/unmap_io_space() now replace
      all of the previous code that used to manipulate PCI IOs space.
      The allocation is done at mapping time, which is now called from
      scan_phb's, just before the devices are probed (instead of after,
      which is by itself a bug fix). The only other caller is the PCI
      hotplug code for hot adding PCI-PCI bridges (slots).
      
      imalloc is gone, as is the "sub-allocation" thing, but I do beleive
      that hotplug should still work in the sense that the space allocation
      is always done by the PHB, but if you unmap a child bus of this PHB
      (which seems to be possible), then the code should properly tear
      down all the HPTE mappings for that area of the PHB allocated IO space.
      
      I now always reserve the first 64K of IO space for the bridge with
      the ISA bus on it. I have moved the code for tracking ISA in a separate
      file which should also make it smarter if we ever are capable of
      hot unplugging or re-plugging an ISA bridge.
      
      This should have a side effect on platforms like powermac where VGA IOs
      will no longer work. This is done on purpose though as they would have
      worked semi-randomly before. The idea at this point is to isolate drivers
      that might need to access those and fix them by providing a proper
      function to obtain an offset to the legacy IOs of a given bus.
      Signed-off-by: default avatarBenjamin Herrenschmidt <benh@kernel.crashing.org>
      Signed-off-by: default avatarPaul Mackerras <paulus@samba.org>
      3d5134ee
    • Benjamin Herrenschmidt's avatar
      [POWERPC] unmap_vm_area becomes unmap_kernel_range for the public · c19c03fc
      Benjamin Herrenschmidt authored
      This makes unmap_vm_area static and a wrapper around a new
      exported unmap_kernel_range that takes an explicit range instead
      of a vm_area struct.
      
      This makes it more versatile for code that wants to play with kernel
      page tables outside of the standard vmalloc area.
      
      (One example is some rework of the PowerPC PCI IO space mapping
      code that depends on that patch and removes some code duplication
      and horrible abuse of forged struct vm_struct).
      Signed-off-by: default avatarBenjamin Herrenschmidt <benh@kernel.crashing.org>
      Signed-off-by: default avatarPaul Mackerras <paulus@samba.org>
      c19c03fc