1. 09 Jul, 2008 6 commits
  2. 03 Jul, 2008 11 commits
  3. 01 Jul, 2008 23 commits
    • Michael Neuling's avatar
      powerpc: Update for VSX core file and ptrace · f3e909c2
      Michael Neuling authored
      This correctly hooks the VSX dump into Roland McGrath core file
      infrastructure.  It adds the VSX dump information as an additional elf
      note in the core file (after talking more to the tool chain/gdb guys).
      This also ensures the formats are consistent between signals, ptrace
      and core files.
      Signed-off-by: default avatarMichael Neuling <mikey@neuling.org>
      Signed-off-by: default avatarPaul Mackerras <paulus@samba.org>
      f3e909c2
    • Michael Neuling's avatar
      powerpc: Fix compile error for CONFIG_VSX · 436db693
      Michael Neuling authored
      Fix compile error when CONFIG_VSX is enabled.
      
      arch/powerpc/kernel/signal_64.c: In function 'restore_sigcontext':
      arch/powerpc/kernel/signal_64.c:241: error: 'i' undeclared (first use in this function)
      Signed-off-by: default avatarMichael Neuling <mikey@neuling.org>
      Signed-off-by: default avatarPaul Mackerras <paulus@samba.org>
      436db693
    • Eric B Munson's avatar
      powerpc: Keep 3 high personality bytes across exec · a91a03ee
      Eric B Munson authored
      Currently when a 32 bit process is exec'd on a powerpc 64 bit host the
      value in the top three bytes of the personality is clobbered.  patch
      adds a check in the SET_PERSONALITY macro that will carry all the
      values in the top three bytes across the exec.
      
      These three bytes currently carry flags to disable address randomisation,
      limit the address space, force zeroing of an mmapped page, etc.  Should an
      application set any of these bits they will be maintained and honoured on
      homogeneous environment but discarded and ignored on a heterogeneous
      environment.  So if an application requires all mmapped pages to be initialised
      to zero and a wrapper is used to setup the personality and exec the target,
      these flags will remain set on an all 32 or all 64 bit envrionment, but they
      will be lost in the exec on a mixed 32/64 bit environment.  Losing these bits
      means that the same application would behave differently in different
      environments.  Tested on a POWER5+ machine with 64bit kernel and a mixed
      64/32 bit user space.
      Signed-off-by: default avatarEric B Munson <ebmunson@us.ibm.com>
      Signed-off-by: default avatarPaul Mackerras <paulus@samba.org>
      a91a03ee
    • Bart Van Assche's avatar
      powerpc: Make sure that include/asm-powerpc/spinlock.h does not trigger compilation warnings · 89b5810f
      Bart Van Assche authored
      When compiling kernel modules for ppc that include <linux/spinlock.h>,
      gcc prints a warning message every time it encounters a function
      declaration where the inline keyword appears after the return type.
      This makes sure that the order of the inline keyword and the return
      type is as gcc expects it.  Additionally, the __inline__ keyword is
      replaced by inline, as checkpatch expects.
      Signed-off-by: default avatarBart Van Assche <bart.vanassche@gmail.com>
      Signed-off-by: default avatarPaul Mackerras <paulus@samba.org>
      89b5810f
    • Stephen Rothwell's avatar
      powerpc: Explicitly copy elements of pt_regs · fcbc5a97
      Stephen Rothwell authored
      Gcc 4.3 produced this warning:
      
      arch/powerpc/kernel/signal_64.c: In function 'restore_sigcontext':
      arch/powerpc/kernel/signal_64.c:161: warning: array subscript is above array bounds
      
      This is caused by us copying to aliases of elements of the pt_regs
      structure.  Make those explicit.
      
      This adds one extra __get_user and unrolls a loop.
      Signed-off-by: default avatarStephen Rothwell <sfr@canb.auug.org.au>
      Signed-off-by: default avatarPaul Mackerras <paulus@samba.org>
      fcbc5a97
    • Bernhard Walle's avatar
      powerpc: Remove experimental status of kdump on 64-bit powerpc · 3420b5da
      Bernhard Walle authored
      This removes the experimental status of kdump on PPC64.  kdump is on
      PPC64 now since more than one year and it has proven to be stable.
      Signed-off-by: default avatarBernhard Walle <bwalle@suse.de>
      Signed-off-by: default avatarPaul Mackerras <paulus@samba.org>
      3420b5da
    • Andy Whitcroft's avatar
      powerpc: Add 64 bit version of huge_ptep_set_wrprotect · 016b33c4
      Andy Whitcroft authored
      The implementation of huge_ptep_set_wrprotect() directly calls
      ptep_set_wrprotect() to mark a hugepte write protected.  However this
      call is not appropriate on ppc64 kernels as this is a small page only
      implementation.  This can lead to the hash not being flushed correctly
      when a mapping is being converted to COW, allowing processes to continue
      using the original copy.
      
      Currently huge_ptep_set_wrprotect() unconditionally calls
      ptep_set_wrprotect().  This is fine on ppc32 kernels as this call is
      generic.  On 64 bit this is implemented as:
      
      	pte_update(mm, addr, ptep, _PAGE_RW, 0);
      
      On ppc64 this last parameter is the page size and is passed directly on
      to hpte_need_flush():
      
      	hpte_need_flush(mm, addr, ptep, old, huge);
      
      And this directly affects the page size we pass to flush_hash_page():
      
      	flush_hash_page(vaddr, rpte, psize, ssize, 0);
      
      As this changes the way the hash is calculated we will flush the wrong
      pages, potentially leaving live hashes to the original page.
      
      Move the definition of huge_ptep_set_wrprotect() to the 32/64 bit specific
      headers.
      Signed-off-by: default avatarAndy Whitcroft <apw@shadowen.org>
      Acked-by: default avatarBenjamin Herrenschmidt <benh@kernel.crashing.org>
      Signed-off-by: default avatarPaul Mackerras <paulus@samba.org>
      016b33c4
    • Andrew Lewis's avatar
      powerpc: Prevent memory corruption due to cache invalidation of unaligned DMA buffer · 03d70617
      Andrew Lewis authored
      On PowerPC processors with non-coherent cache architectures the DMA
      subsystem calls invalidate_dcache_range() before performing a DMA read
      operation.  If the address and length of the DMA buffer are not aligned
      to a cache-line boundary this can result in memory outside of the DMA
      buffer being invalidated in the cache.  If this memory has an
      uncommitted store then the data will be lost and a subsequent read of
      that address will result in an old value being returned from main memory.
      
      Only when the DMA buffer starts on a cache-line boundary and is an exact
      mutiple of the cache-line size can invalidate_dcache_range() be called,
      otherwise flush_dcache_range() must be called.  flush_dcache_range()
      will first flush uncommitted writes, and then invalidate the cache.
      
      Signed-off-by: Andrew Lewis <andrew-lewis at netspace.net.au>
      Signed-off-by: default avatarPaul Mackerras <paulus@samba.org>
      03d70617
    • Kumar Gala's avatar
      powerpc/bootwrapper: Pad .dtb by default · 9d4ae9fc
      Kumar Gala authored
      Since most bootloaders or wrappers tend to update or add some information
      to the .dtb they a handled they need some working space to do that in.
      
      By default add 1K of padding via a default setting of DTS_FLAGS.
      Signed-off-by: default avatarKumar Gala <galak@kernel.crashing.org>
      Signed-off-by: default avatarPaul Mackerras <paulus@samba.org>
      9d4ae9fc
    • Michael Neuling's avatar
      powerpc: Add CONFIG_VSX config option · 96d5b52c
      Michael Neuling authored
      Add CONFIG_VSX config build option.  Must compile with POWER4, FPU and ALTIVEC.
      Signed-off-by: default avatarMichael Neuling <mikey@neuling.org>
      Signed-off-by: default avatarPaul Mackerras <paulus@samba.org>
      96d5b52c
    • Michael Neuling's avatar
      powerpc: Add VSX context save/restore, ptrace and signal support · ce48b210
      Michael Neuling authored
      This patch extends the floating point save and restore code to use the
      VSX load/stores when VSX is available.  This will make FP context
      save/restore marginally slower on FP only code, when VSX is available,
      as it has to load/store 128bits rather than just 64bits.
      
      Mixing FP, VMX and VSX code will get constant architected state.
      
      The signals interface is extended to enable access to VSR 0-31
      doubleword 1 after discussions with tool chain maintainers.  Backward
      compatibility is maintained.
      
      The ptrace interface is also extended to allow access to VSR 0-31 full
      registers.
      Signed-off-by: default avatarMichael Neuling <mikey@neuling.org>
      Signed-off-by: default avatarPaul Mackerras <paulus@samba.org>
      ce48b210
    • Michael Neuling's avatar
      powerpc: Add VSX assembler code macros · 72ffff5b
      Michael Neuling authored
      This adds the macros for the VSX load/store instruction as most
      binutils are not going to support this for a while.
      
      Also add VSX register save/restore macros and vsr[0-63] register definitions.
      Signed-off-by: default avatarMichael Neuling <mikey@neuling.org>
      Signed-off-by: default avatarPaul Mackerras <paulus@samba.org>
      72ffff5b
    • Michael Neuling's avatar
      powerpc: Add VSX CPU feature · b962ce9d
      Michael Neuling authored
      Add a VSX CPU feature.  Also add code to detect if VSX is available
      from the device tree.
      Signed-off-by: default avatarMichael Neuling <mikey@neuling.org>
      Signed-off-by: default avatarJoel Schopp <jschopp@austin.ibm.com>
      Signed-off-by: default avatarPaul Mackerras <paulus@samba.org>
      b962ce9d
    • Michael Neuling's avatar
      powerpc: Introduce VSX thread_struct and CONFIG_VSX · c6e6771b
      Michael Neuling authored
      The layout of the new VSR registers and how they overlap on top of the
      legacy FPR and VR registers is:
      
                         VSR doubleword 0               VSR doubleword 1
                ----------------------------------------------------------------
        VSR[0]  |             FPR[0]            |                              |
                ----------------------------------------------------------------
        VSR[1]  |             FPR[1]            |                              |
                ----------------------------------------------------------------
                |              ...              |                              |
                |              ...              |                              |
                ----------------------------------------------------------------
        VSR[30] |             FPR[30]           |                              |
                ----------------------------------------------------------------
        VSR[31] |             FPR[31]           |                              |
                ----------------------------------------------------------------
        VSR[32] |                             VR[0]                            |
                ----------------------------------------------------------------
        VSR[33] |                             VR[1]                            |
                ----------------------------------------------------------------
                |                              ...                             |
                |                              ...                             |
                ----------------------------------------------------------------
        VSR[62] |                             VR[30]                           |
                ----------------------------------------------------------------
        VSR[63] |                             VR[31]                           |
                ----------------------------------------------------------------
      
      VSX has 64 128bit registers.  The first 32 regs overlap with the FP
      registers and hence extend them with and additional 64 bits.  The
      second 32 regs overlap with the VMX registers.
      
      This commit introduces the thread_struct changes required to reflect
      this register layout.  Ptrace and signals code is updated so that the
      floating point registers are correctly accessed from the thread_struct
      when CONFIG_VSX is enabled.
      Signed-off-by: default avatarMichael Neuling <mikey@neuling.org>
      Signed-off-by: default avatarPaul Mackerras <paulus@samba.org>
      c6e6771b
    • Michael Neuling's avatar
      powerpc: Make load_up_fpu and load_up_altivec callable · 6f3d8e69
      Michael Neuling authored
      Make load_up_fpu and load_up_altivec callable so they can be reused by
      the VSX code.
      Signed-off-by: default avatarMichael Neuling <mikey@neuling.org>
      Signed-off-by: default avatarPaul Mackerras <paulus@samba.org>
      6f3d8e69
    • Michael Neuling's avatar
      powerpc: Move altivec_unavailable · 10e34392
      Michael Neuling authored
      Move the altivec_unavailable code, to make room at 0xf40 where the
      vsx_unavailable exception will be.
      Signed-off-by: default avatarMichael Neuling <mikey@neuling.org>
      Signed-off-by: default avatarPaul Mackerras <paulus@samba.org>
      10e34392
    • Michael Neuling's avatar
      powerpc: Add macros to access floating point registers in thread_struct. · 9c75a31c
      Michael Neuling authored
      We are going to change where the floating point registers are stored
      in the thread_struct, so in preparation add some macros to access the
      floating point registers.  Update all code to use these new macros.
      Signed-off-by: default avatarMichael Neuling <mikey@neuling.org>
      Signed-off-by: default avatarPaul Mackerras <paulus@samba.org>
      9c75a31c
    • Michael Neuling's avatar
      powerpc: Fix MSR setting in 32 bit signal code · 9e751186
      Michael Neuling authored
      If we set the SPE MSR bit in save_user_regs we can blow away the VEC
      bit.  This doesn't matter in reality as they are in fact the same bit
      but looks bad.
      
      Also, when we add VSX in a later patch, we need to be able to set two
      separate MSR bits here.
      Signed-off-by: default avatarMichael Neuling <mikey@neuling.org>
      Signed-off-by: default avatarPaul Mackerras <paulus@samba.org>
      9e751186
    • Tony Breeds's avatar
      powerpc: Change the default link address for pSeries zImage kernels · 9b09c6d9
      Tony Breeds authored
      Currently we set the start of the .text section to be 4Mb for pSeries.
      In situations where the zImage is > 8Mb we'll fail to boot (due to
      overlapping with OF).  Move .text in a zImage from 4MB to 64MB
      (well past OF).
      
      We still will not be able to load large zImage unless we also move OF,
      to that end, add a note to the zImage ELF to move OF to 32Mb.  If this
      is the very first kernel booted then we'll need to move OF manually by
      setting real-base.
      Signed-off-by: default avatarTony Breeds <tony@bakeyournoodle.com>
      Signed-off-by: default avatarPaul Mackerras <paulus@samba.org>
      9b09c6d9
    • Michael Ellerman's avatar
      powerpc: Use an alternative feature section in entry_64.S · c230328d
      Michael Ellerman authored
      Use an alternative feature section in _switch. There are three cases
      handled here, either we don't have an SLB, in which case we jump over the
      entire code section, or if we do we either do or don't have 1TB segments.
      
      Boot tested on Power3, Power5 and Power5+.
      Signed-off-by: default avatarMichael Ellerman <michael@ellerman.id.au>
      Signed-off-by: default avatarPaul Mackerras <paulus@samba.org>
      c230328d
    • Michael Ellerman's avatar
      powerpc: Add self-tests of the feature fixup code · 362e7701
      Michael Ellerman authored
      This commit adds tests of the feature fixup code, they are run during
      boot if CONFIG_FTR_FIXUP_SELFTEST=y. Some of the tests manually invoke
      the patching routines to check their behaviour, and others use the
      macros and so are patched during the normal patching done during boot.
      
      Because we have two sets of macros with different names, we use a macro
      to generate the test of the macros, very niiiice.
      Signed-off-by: default avatarMichael Ellerman <michael@ellerman.id.au>
      Signed-off-by: default avatarPaul Mackerras <paulus@samba.org>
      362e7701
    • Michael Ellerman's avatar
      powerpc: Add logic to patch alternative feature sections · 9b1a735d
      Michael Ellerman authored
      This commit adds the logic to patch alternative sections.  This is fairly
      straightforward, except for branches.  Relative branches that jump from
      inside the else section to outside of it need to be translated as they're
      moved, otherwise they will jump to the wrong location.
      Signed-off-by: default avatarMichael Ellerman <michael@ellerman.id.au>
      Signed-off-by: default avatarPaul Mackerras <paulus@samba.org>
      9b1a735d
    • Michael Ellerman's avatar
      powerpc: Introduce infrastructure for feature sections with alternatives · fac23fe4
      Michael Ellerman authored
      The current feature section logic only supports nop'ing out code, this means
      if you want to choose at runtime between instruction sequences, one or both
      cases will have to execute the nop'ed out contents of the other section, eg:
      
      BEGIN_FTR_SECTION
      	or	1,1,1
      END_FTR_SECTION_IFSET(FOO)
      BEGIN_FTR_SECTION
      	or	2,2,2
      END_FTR_SECTION_IFCLR(FOO)
      
      and the resulting code will be either,
      
      	or	1,1,1
      	nop
      
      or,
      	nop
      	or	2,2,2
      
      For small code segments this is fine, but for larger code blocks and in
      performance criticial code segments, it would be nice to avoid the nops.
      This commit starts to implement logic to allow the following:
      
      BEGIN_FTR_SECTION
      	or	1,1,1
      FTR_SECTION_ELSE
      	or	2,2,2
      ALT_FTR_SECTION_END_IFSET(FOO)
      
      and the resulting code will be:
      
      	or	1,1,1
      or,
      	or	2,2,2
      
      We achieve this by extending the existing FTR macros. The current feature
      section semantic just becomes a special case, ie. if the else case is empty
      we nop out the default case.
      
      The key limitation is that the size of the else case must be less than or
      equal to the size of the default case. If the else case is smaller the
      remainder of the section is nop'ed.
      
      We let the linker put the else case code in with the rest of the text,
      so that relative branches from the else case are more likley to link,
      this has the disadvantage that we can't free the unused else cases.
      
      This commit introduces the required macro and linker script changes, but
      does not enable the patching of the alternative sections.
      
      We also need to update two hand-made section entries in reg.h and timex.h
      Signed-off-by: default avatarMichael Ellerman <michael@ellerman.id.au>
      Signed-off-by: default avatarPaul Mackerras <paulus@samba.org>
      fac23fe4