1. 05 Nov, 2008 24 commits
    • Sebastian Siewior's avatar
      powerpc/boot: Allocate more memory for dtb · 5b4d2189
      Sebastian Siewior authored
      David Gibson suggested that since we are now unconditionally copying
      the dtb into a malloc()ed buffer, it would be sensible to add a little
      padding to the buffer at that point, so that further device tree
      manipulations won't need to reallocate it.
      
      This implements that suggestion.
      Signed-off-by: default avatarSebastian Andrzej Siewior <bigeasy@linutronix.de>
      Signed-off-by: default avatarPaul Mackerras <paulus@samba.org>
      5b4d2189
    • Jon Tollefson's avatar
      powerpc: Hugetlb pgtable cache access cleanup · 7d4320f3
      Jon Tollefson authored
      Andrew Morton suggested that using a macro that makes an array
      reference look like a function call makes it harder to understand the
      code.
      
      This therefore removes the huge_pgtable_cache(psize) macro and
      replaces its uses with pgtable_cache[HUGE_PGTABLE_INDEX(psize)].
      Signed-off-by: default avatarJon Tollefson <kniht@linux.vnet.ibm.com>
      Cc: Nick Piggin <nickpiggin@yahoo.com.au>
      Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Acked-by: default avatarDavid Gibson <david@gibson.dropbear.id.au>
      Signed-off-by: default avatarPaul Mackerras <paulus@samba.org>
      7d4320f3
    • Masakazu Mokuno's avatar
      powerpc/ps3: Fix memory leak in device init · d4ad3048
      Masakazu Mokuno authored
      Free dynamically allocated device data structures when device registration
      fails.  This fixes memory leakage when the registration fails.
      Signed-off-by: default avatarMasakazu Mokuno <mokuno@sm.sony.co.jp>
      Signed-off-by: default avatarGeoff Levand <geoffrey.levand@am.sony.com>
      Signed-off-by: default avatarPaul Mackerras <paulus@samba.org>
      d4ad3048
    • Paul Mackerras's avatar
      powerpc: Eliminate unused do_gtod variable · 3cc69878
      Paul Mackerras authored
      Since we started using the generic timekeeping code, we haven't had a
      powerpc-specific version of do_gettimeofday, and hence there is now
      nothing that reads the do_gtod variable in arch/powerpc/kernel/time.c.
      This therefore removes it and the code that sets it.
      Signed-off-by: default avatarPaul Mackerras <paulus@samba.org>
      3cc69878
    • Paul Mackerras's avatar
      powerpc: Improve resolution of VDSO clock_gettime · 597bc5c0
      Paul Mackerras authored
      Currently the clock_gettime implementation in the VDSO produces a
      result with microsecond resolution for the cases that are handled
      without a system call, i.e. CLOCK_REALTIME and CLOCK_MONOTONIC.  The
      nanoseconds field of the result is obtained by computing a
      microseconds value and multiplying by 1000.
      
      This changes the code in the VDSO to do the computation for
      clock_gettime with nanosecond resolution.  That means that the
      resolution of the result will ultimately depend on the timebase
      frequency.
      
      Because the timestamp in the VDSO datapage (stamp_xsec, the real time
      corresponding to the timebase count in tb_orig_stamp) is in units of
      2^-20 seconds, it doesn't have sufficient resolution for computing a
      result with nanosecond resolution.  Therefore this adds a copy of
      xtime to the VDSO datapage and updates it in update_gtod() along with
      the other time-related fields.
      Signed-off-by: default avatarPaul Mackerras <paulus@samba.org>
      597bc5c0
    • Mark Nelson's avatar
      powerpc: Remove map_/unmap_single() from dma_mapping_ops · c73049f6
      Mark Nelson authored
      Now that all of the remaining dma_mapping_ops have had their
      map_/unmap_single functions updated to become map/unmap_page
      functions, there is no need to have the map_/unmap_single function
      pointers in the dma_mapping_ops.
      
      So, this removes them and also removes the code that does the checking
      for which set of functions to use.
      Signed-off-by: default avatarMark Nelson <markn@au1.ibm.com>
      Acked-by: default avatarBecky Bruce <becky.bruce@freescale.com>
      Signed-off-by: default avatarPaul Mackerras <paulus@samba.org>
      c73049f6
    • Benjamin Herrenschmidt's avatar
      powerpc/pci: Cosmetic cleanups of pci-common.c · 7eef440a
      Benjamin Herrenschmidt authored
      This does a few cosmetic cleanups, moving a couple of things around
      but without actually changing what the code does.
      
      (There is a minor change in ordering of operations in
      pcibios_setup_bus_devices but it should have no impact).
      Signed-off-by: default avatarBenjamin Herrenschmidt <benh@kernel.crashing.org>
      Signed-off-by: default avatarPaul Mackerras <paulus@samba.org>
      7eef440a
    • Benjamin Herrenschmidt's avatar
      powerpc/pci: Fix various pseries PCI hotplug issues · fd6852c8
      Benjamin Herrenschmidt authored
      The pseries PCI hotplug code has a number of issues, ranging from
      incorrect resource setup to crashes, depending on what is added,
      when, whether it contains a bridge, etc etc....
      
      This fixes a whole bunch of these, while actually simplifying the code
      a bit, using more generic code in the process and factoring out common
      code between adding of a PHB, a slot or a device.
      Signed-off-by: default avatarBenjamin Herrenschmidt <benh@kernel.crashing.org>
      Signed-off-by: default avatarPaul Mackerras <paulus@samba.org>
      fd6852c8
    • Benjamin Herrenschmidt's avatar
      powerpc/pci: Make pcibios_allocate_bus_resources more robust · b5ae5f91
      Benjamin Herrenschmidt authored
      To properly fix PCI hotplug, it's useful to be able to make the fixup
      passes on all devices whether they were just hot plugged or already
      there.
      
      However, pcibios_allocate_bus_resources() wouldn't cope well with
      being called twice for a given bus.  This makes it ignore resources
      that have already been allocated, along with adding a bit of debug
      output.
      Signed-off-by: default avatarBenjamin Herrenschmidt <benh@kernel.crashing.org>
      Signed-off-by: default avatarPaul Mackerras <paulus@samba.org>
      b5ae5f91
    • Benjamin Herrenschmidt's avatar
      powerpc/eeh: Make EEH device add/remove more robust · 57b066ff
      Benjamin Herrenschmidt authored
      To properly fix PCI hotplug, it's useful to be able to make the fixup
      passes on all devices whether they were just hot plugged or already
      there.
      
      The EEH code however used to not be very friendly with calling
      eeh_add_device_late() multiple time, and not very rebust in the way it
      generally tests whether a device is in the expected state vs. the EEH
      code.
      
      This improves it, along with cleaning up a couple of debug printk's.
      Signed-off-by: default avatarBenjamin Herrenschmidt <benh@kernel.crashing.org>
      Signed-off-by: default avatarPaul Mackerras <paulus@samba.org>
      57b066ff
    • Benjamin Herrenschmidt's avatar
      powerpc/pci: Split pcibios_fixup_bus() into bus setup and device setup · 8b8da358
      Benjamin Herrenschmidt authored
      Currently, our PCI code uses the pcibios_fixup_bus() callback, which
      is called by the generic code when probing PCI buses, for two
      different things.
      
      One is to set up things related to the bus itself, such as reading
      bridge resources for P2P bridges, fixing them up, or setting up the
      iommu's associated with bridges on some platforms.
      
      The other is some setup for each individual device under that bridge,
      mostly setting up DMA mappings and interrupts.
      
      The problem is that this approach doesn't work well with PCI hotplug
      when an existing bus is re-probed for new children.  We fix this
      problem by splitting pcibios_fixup_bus into two routines:
      
      	pcibios_setup_bus_self() is now called to setup the bus itself
      
      	pcibios_setup_bus_devices() is now called to setup devices
      
      pcibios_fixup_bus() is then modified to call these two after reading the
      bridge bases, and the OF based PCI probe is modified to avoid calling
      into the first one when rescanning an existing bridge.
      
      [paulus@samba.org - fixed eeh.h for 32-bit compile now that pci-common.c
      is including it unconditionally.]
      Signed-off-by: default avatarBenjamin Herrenschmidt <benh@kernel.crashing.org>
      Signed-off-by: default avatarPaul Mackerras <paulus@samba.org>
      8b8da358
    • Benjamin Herrenschmidt's avatar
      powerpc/pci: Remove pcibios_do_bus_setup() · ab56ced9
      Benjamin Herrenschmidt authored
      The function pcibios_do_bus_setup() was used by pcibios_fixup_bus()
      to perform setup that is different between the 32-bit and 64-bit
      code.  This difference no longer exists, thus the function is removed
      and the setup now done directly from pci-common.c.
      Signed-off-by: default avatarBenjamin Herrenschmidt <benh@kernel.crashing.org>
      Signed-off-by: default avatarPaul Mackerras <paulus@samba.org>
      ab56ced9
    • Benjamin Herrenschmidt's avatar
      powerpc/pci: Use common PHB resource hookup · 53280323
      Benjamin Herrenschmidt authored
      The 32-bit and 64-bit powerpc PCI code used to set up the resource
      pointers of the root bus of a given PHB in completely different
      places.
      
      This unifies this in large part, by making 32-bit use a routine very
      similar to what 64-bit does when initially scanning the PCI busses.
      
      The actual setup of the PHB resources itself is then moved to a
      common function in pci-common.c.
      
      This should cause no functional change on 64-bit.  On 32-bit, the
      effect is that the PHB resources are going to be setup a bit earlier,
      instead of being setup from pcibios_fixup_bus().
      Signed-off-by: default avatarBenjamin Herrenschmidt <benh@kernel.crashing.org>
      Signed-off-by: default avatarPaul Mackerras <paulus@samba.org>
      53280323
    • Benjamin Herrenschmidt's avatar
      powerpc/pci: Cleanup debug printk's · b0494bc8
      Benjamin Herrenschmidt authored
      This removes the various DBG() macro from the powerpc PCI code and
      makes it use the standard pr_debug instead.
      Signed-off-by: default avatarBenjamin Herrenschmidt <benh@kernel.crashing.org>
      Signed-off-by: default avatarPaul Mackerras <paulus@samba.org>
      b0494bc8
    • Mark Nelson's avatar
      powerpc: Update 64bit memcpy() using CPU_FTR_UNALIGNED_LD_STD · 25d6e2d7
      Mark Nelson authored
      Update memcpy() to add two new feature sections: one for aligning the
      destination before copying and one for copying using aligned load
      and store doubles.
      
      These new feature sections will only affect Power6 and Cell because
      the CPU feature bit was only added to these two processors.
      
      Power6 gets its best performance in memcpy() when aligning neither the
      source nor the destination, while Cell gets its best performance when
      just the destination is aligned. But in order to save on CPU feature
      bits we can use the previously added CPU_FTR_CP_USE_DCBTZ feature bit
      to differentiate between Power6 and Cell (because CPU_FTR_CP_USE_DCBTZ
      was added to Cell but not Power6).
      
      The first feature section acts to nop out the branch that takes us to
      the code that aligns us to an eight byte boundary for the destination.
      We only want to nop out this branch on Power6.
      
      So the ALT_FTR_SECTION_END() for this feature section creates a test
      mask of the two feature bits ORed together and provides an expected
      result of just CPU_FTR_UNALIGNED_LD_STD, thus we nop out the branch
      if we're on a CPU that has CPU_FTR_UNALIGNED_LD_STD set and
      CPU_FTR_CP_USE_DCBTZ unset.
      
      For the second feature section added, if we're on a CPU that has the
      CPU_FTR_UNALIGNED_LD_STD bit set then we don't want to do the copy
      with aligned loads and stores (and the appropriate shifting left and
      right instructions), so we want to nop out the branch to
      .Lsrc_unaligned.
      
      The andi. used for this branch is moved to just above the branch
      because this allows us to nop out both instructions with just one
      feature section which gives us better performance and doesn't hurt
      readability which two separate feature sections did.
      
      Moving the andi. to just above the branch doesn't have any noticeable
      negative effect on the remaining 64bit processors (the ones that
      didn't have this feature bit added).
      
      On Cell this simple modification results in an improvement to measured
      memcpy() bandwidth of up to 50% in the hot cache case and up to 15% in
      the cold cache case.
      
      On Power6 we get memory bandwidth results that are up to three times
      faster in the hot cache case and up to 50% faster in the cold cache
      case.
      
      Commit 2a929436 ("powerpc: Add new CPU
      feature: CPU_FTR_CP_USE_DCBTZ") was where CPU_FTR_CP_USE_DCBTZ was
      added.
      
      To say that Cell gets its best performance in memcpy() with just the
      destination aligned is true but only for the reason that the indirect
      shift and rotate instructions, sld and srd, are microcoded on Cell.
      This means that either the destination or the source can be aligned,
      but not both, and seeing as we get better performance with the
      destination aligned we choose this option.
      
      While we're at it make a one line change from cmpldi r1,... to
      cmpldi cr1,... for consistency.
      Signed-off-by: default avatarMark Nelson <markn@au1.ibm.com>
      Signed-off-by: default avatarPaul Mackerras <paulus@samba.org>
      25d6e2d7
    • Mark Nelson's avatar
      powerpc: Add new CPU feature: CPU_FTR_UNALIGNED_LD_STD · 4ec577a2
      Mark Nelson authored
      Add a new CPU feature bit, CPU_FTR_UNALIGNED_LD_STD, to be added
      to the 64bit powerpc chips that can do unaligned load double and
      store double without any performance hit.
      
      This is added to Power6 and Cell and will be used in the next commit
      to disable the code that gets the destination address aligned on
      those CPUs where doing that doesn't improve performance.
      Signed-off-by: default avatarMark Nelson <markn@au1.ibm.com>
      Signed-off-by: default avatarPaul Mackerras <paulus@samba.org>
      4ec577a2
    • Brian King's avatar
      powerpc: Update page-in counter for CMM · 40900194
      Brian King authored
      A new field has been added to the VPA as a method for the client OS to
      communicate to firmware the number of page-ins it is performing when
      running collaborative memory overcommit.  The hypervisor will use this
      information to better determine if a partition is experiencing memory
      pressure and needs more memory allocated to it.
      Signed-off-by: default avatarBrian King <brking@linux.vnet.ibm.com>
      Signed-off-by: default avatarPaul Mackerras <paulus@samba.org>
      40900194
    • Sebastien Dugue's avatar
      powerpc/pseries: Fix getting the server number size · 1ef8014d
      Sebastien Dugue authored
      The 'ibm,interrupt-server#-size' properties are not in the cpu nodes,
      which is where we currently look for them, but rather live under the
      interrupt source controller nodes (which have "ibm,ppc-xics" in their
      compatible property).
      
      This moves the code that looks for the ibm,interrupt-server#-size
      properties from xics_update_irq_servers() into xics_init_IRQ().
      
      Also this adds a check for mismatched sizes across the interrupt
      source controller nodes.  Not sure this is necessary as in this case
      the firmware might be seriously busted.
      
      This property only appears on POWER6 boxes and is only used in the
      set-indicator(gqirm) call, and apparently firmware currently ignores
      the value we pass.  Nevertheless we need to fix it in case future
      firmware versions use it.
      Signed-off-by: default avatarSebastien Dugue <sebastien.dugue@bull.net>
      Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
      Acked-by: default avatarMilton Miller <miltonm@bga.com>
      Signed-off-by: default avatarPaul Mackerras <paulus@samba.org>
      1ef8014d
    • Anton Vorontsov's avatar
      powerpc: Remove device_type = "rtc" properties in .dts files · 691de576
      Anton Vorontsov authored
      We don't want to encourage the device_type usage.  It isn't used in
      the code, so we can simply remove it from the dts files.
      Suggested-by: default avatarScott Wood <scottwood@freescale.com>
      Signed-off-by: default avatarAnton Vorontsov <avorontsov@ru.mvista.com>
      Acked-by: default avatarGrant Likely <grant.likely@secretlab.ca>
      Acked-by: default avatarDavid Gibson <david@gibson.dropbear.id.au>
      Signed-off-by: default avatarPaul Mackerras <paulus@samba.org>
      691de576
    • Benjamin Herrenschmidt's avatar
      powerpc: Silence software timebase sync · a6a8e009
      Benjamin Herrenschmidt authored
      When no hardware method is provided to sync the timebase registers
      across the machine, and the platform doesn't sync them for us, then we
      use a generic software implementation.  Currently, the code for that
      has many printks, and they don't have log levels.  Most of the printks
      are only useful for debugging the code, and since we haven't had any
      problems with it for years, this turns them into pr_debug.
      Signed-off-by: default avatarBenjamin Herrenschmidt <benh@kernel.crashing.org>
      Signed-off-by: default avatarPaul Mackerras <paulus@samba.org>
      a6a8e009
    • Benjamin Herrenschmidt's avatar
      powerpc: Fix domain numbers in /proc on 64-bit · 1fd0f525
      Benjamin Herrenschmidt authored
      The code to properly expose domain numbers in /proc is somewhat
      bogus on ppc64 as it depends on the "buid" field being non-0,
      but that field is really pseries specific.
      
      This removes that code and makes ppc64 use the same code as 32-bit
      which effectively decides whether to expose domains based on
      ppc_pci_flags set by the platform, and sets the default for 64-bit
      to enable domains and enable compatibility for domain 0 (which
      strips the domain number for domain 0 to help with X servers).
      Signed-off-by: default avatarBenjamin Herrenschmidt <benh@kernel.crashing.org>
      Signed-off-by: default avatarPaul Mackerras <paulus@samba.org>
      1fd0f525
    • Stephen Rothwell's avatar
      powerpc: Fix "unused variable" warning in pci_dlpar.c · 454666eb
      Stephen Rothwell authored
      This gets rid of this build warning:
      
      arch/powerpc/platforms/pseries/pci_dlpar.c: In function 'init_phb_dynamic':
      arch/powerpc/platforms/pseries/pci_dlpar.c:192: warning: unused variable 'b'
      
      This is one of the very few warnings left in a ppc64_defconfig build and
      getting rid of it will make it easier to see future introduced ones (in
      fact this was introduced very recently).
      Signed-off-by: default avatarStephen Rothwell <sfr@canb.auug.org.au>
      Signed-off-by: default avatarPaul Mackerras <paulus@samba.org>
      454666eb
    • Alexey Dobriyan's avatar
      powerpc/cell: Fix compile error in ras.c · 9c8b4aff
      Alexey Dobriyan authored
      This fixes this error on Cell when CONFIG_KEXEC = n:
      
      arch/powerpc/platforms/cell/ras.c:299: error: implicit declaration of function 'crash_shutdown_register'
      
      We have to include <asm/kexec.h> because it contains the dummy
      definition of crash_shutdown_register that is used when
      CONFIG_KEXEC=n, but <linux/kexec.h> doesn't include <asm/kexec.h> in
      that case.
      Signed-off-by: default avatarAlexey Dobriyan <adobriyan@gmail.com>
      Signed-off-by: default avatarPaul Mackerras <paulus@samba.org>
      9c8b4aff
    • Alexey Dobriyan's avatar
      powerpc/ps3: Fix compile error in ps3-lpm.c · fce4d583
      Alexey Dobriyan authored
      Compiling with CONFIG_SMP = n and CONFIG_PS3_LPM != n gives this error:
      
      drivers/ps3/ps3-lpm.c:838: error: implicit declaration of function 'get_hard_smp_processor_id'
      
      This fixes it.  We have to include <asm/smp.h> rather than
      <linux/smp.h> because the UP definition of get_hard_smp_processor_id()
      is in <asm/smp.h>, and <linux/smp.h> only includes <asm/smp.h> if
      CONFIG_SMP = y.
      Signed-off-by: default avatarAlexey Dobriyan <adobriyan@gmail.com>
      Acked-by: default avatarGeoff Levand <geoffrey.levand@am.sony.com>
      Signed-off-by: default avatarPaul Mackerras <paulus@samba.org>
      fce4d583
  2. 04 Nov, 2008 15 commits
  3. 03 Nov, 2008 1 commit
    • Lennert Buytenhek's avatar
      mv643xx_eth: fix SMI bus access timeouts · ee04448d
      Lennert Buytenhek authored
      The mv643xx_eth mii bus implementation uses wait_event_timeout() to
      wait for SMI completion interrupts.
      
      If wait_event_timeout() would return zero, mv643xx_eth would conclude
      that the SMI access timed out, but this is not necessarily true --
      wait_event_timeout() can also return zero in the case where the SMI
      completion interrupt did happen in time but where it took longer than
      the requested timeout for the process performing the SMI access to be
      scheduled again.  This would lead to occasional SMI access timeouts
      when the system would be under heavy load.
      
      The fix is to ignore the return value of wait_event_timeout(), and
      to re-check the SMI done bit after wait_event_timeout() returns to
      determine whether or not the SMI access timed out.
      Signed-off-by: default avatarLennert Buytenhek <buytenh@marvell.com>
      Signed-off-by: default avatarJeff Garzik <jgarzik@redhat.com>
      ee04448d