1. 13 Mar, 2009 9 commits
    • David Miller's avatar
      drm: ati_pcigart: Need to use PCI_DMA_BIDIRECTIONAL. · 296c6ae0
      David Miller authored
      The buffers mapped by the PCI GART can be written to by the device,
      not just read.
      
      For example, this happens via the RB_RPTR writeback on Radeon.
      
      So we can't use PCI_DMA_TODEVICE else we'll get protection faults
      on IOMMU platforms.
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarDave Airlie <airlied@linux.ie>
      296c6ae0
    • David Miller's avatar
      drm: ati_pcigart: Do not access I/O MEM space using pointer derefs. · 5a7aad9a
      David Miller authored
      The PCI GART table initialization code treats the GART table mapping
      unconditionally as a kernel virtual address.
      
      But it could be in the framebuffer, for example, and thus we're
      dealing with a PCI MEM space ioremap() cookie.  Treating that as a
      virtual address is illegal and will crash some system types (such as
      sparc64 where the ioremap() return value is actually a physical I/O
      address).
      
      So access the area correctly, using gart_info->gart_table_location as
      our guide.
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarDave Airlie <airlied@linux.ie>
      5a7aad9a
    • Kristian Høgsberg's avatar
      drm: Drop unused and broken dri_library_name sysfs attribute. · 8e100458
      Kristian Høgsberg authored
      The kernel shouldn't be in the business of telling user space which
      driver to load.  The kernel defers mapping PCI IDs to module names
      to user space and we should do the same for DRI drivers.
      
      And in fact, that's how it does work today.  Nothing uses the
      dri_library_name attribute, and the attribute is in fact broken.
      For intel devices, it falls back to the default behaviour of returning
      the kernel module name as the DRI driver name, which doesn't work for
      i965 devices.  Nobody has ever hit this problem or filed a bug about this.
      Signed-off-by: default avatarKristian Høgsberg <krh@redhat.com>
      Signed-off-by: default avatarDave Airlie <airlied@linux.ie>
      8e100458
    • Kristian Høgsberg's avatar
      drm: claim PCI device when running in modesetting mode. · 112b715e
      Kristian Høgsberg authored
      Under kernel modesetting, we manage the device at all times, regardless
      of VT switching and X servers, so the only decent thing to do is to
      claim the PCI device.  In that case, we call the suspend/resume hooks
      directly from the pci driver hooks instead of the current class device detour.
      Signed-off-by: default avatarKristian Høgsberg <krh@redhat.com>
      Signed-off-by: default avatarDave Airlie <airlied@linux.ie>
      112b715e
    • Benjamin Herrenschmidt's avatar
      drm: Make drm_local_map use a resource_size_t offset · 41c2e75e
      Benjamin Herrenschmidt authored
      This changes drm_local_map to use a resource_size for its "offset"
      member instead of an unsigned long, thus allowing 32-bit machines
      with a >32-bit physical address space to be able to store there
      their register or framebuffer addresses when those are above 4G,
      such as when using a PCI video card on a recent AMCC 440 SoC.
      
      This patch isn't as "trivial" as it sounds: A few functions needed
      to have some unsigned long/int changed to resource_size_t and a few
      printk's had to be adjusted.
      
      But also, because userspace isn't capable of passing such offsets,
      I had to modify drm_find_matching_map() to ignore the offset passed
      in for maps of type _DRM_FRAMEBUFFER or _DRM_REGISTERS.
      
      If we ever support multiple _DRM_FRAMEBUFFER or _DRM_REGISTERS maps
      for a given device, we might have to change that trick, but I don't
      think that happens on any current driver.
      Signed-off-by: default avatarBenjamin Herrenschmidt <benh@kernel.crashing.org>
      Signed-off-by: default avatarDave Airlie <airlied@linux.ie>
      41c2e75e
    • Benjamin Herrenschmidt's avatar
      drm: Split drm_map and drm_local_map · f77d390c
      Benjamin Herrenschmidt authored
      Once upon a time, the DRM made the distinction between the drm_map
      data structure exchanged with user space and the drm_local_map used
      in the kernel.
      
      For some reasons, while the BSD port still has that "feature", the
      linux part abused drm_map for kernel internal usage as the local
      map only existed as a typedef of the struct drm_map.
      
      This patch fixes it by declaring struct drm_local_map separately
      (though its content is currently identical to the userspace variant),
      and changing the kernel code to only use that, except when it's a
      user<->kernel interface (ie. ioctl).
      
      This allows subsequent changes to the in-kernel format
      
      I've also replaced the use of drm_local_map_t with struct drm_local_map
      in a couple of places. Mostly by accident but they are the same (the
      former is a typedef of the later) and I have some remote plans and
      half finished patch to completely kill the drm_local_map_t typedef
      so I left those bits in.
      Signed-off-by: default avatarBenjamin Herrenschmidt <benh@kernel.crashing.org>
      Acked-by: default avatarEric Anholt <eric@anholt.net>
      Signed-off-by: default avatarDave Airlie <airlied@linux.ie>
      f77d390c
    • Benjamin Herrenschmidt's avatar
      drm: Use resource_size_t for drm_get_resource_{start, len} · d883f7f1
      Benjamin Herrenschmidt authored
      The DRM uses its own wrappers to obtain resources from PCI devices,
      which currently convert the resource_size_t into an unsigned long.
      
      This is broken on 32-bit platforms with >32-bit physical address
      space.
      
      This fixes them, along with a few occurences of unsigned long used
      to store such a resource in drivers.
      Signed-off-by: default avatarBenjamin Herrenschmidt <benh@kernel.crashing.org>
      Signed-off-by: default avatarDave Airlie <airlied@linux.ie>
      d883f7f1
    • Linus Torvalds's avatar
      Linus 2.6.29-rc8 · 041b6237
      Linus Torvalds authored
      041b6237
    • Linus Torvalds's avatar
      bitmap: fix end condition in bitmap_find_free_region · aa8e4fc6
      Linus Torvalds authored
      Guennadi Liakhovetski noticed that the end condition for the loop in
      bitmap_find_free_region() is wrong, and the "return if error" was also
      using the wrong conditional that would only trigger if the bitmap was an
      exact multiple of the allocation size, which is not necessarily the case
      with dma_alloc_from_coherent().
      
      Such a failure would end up in bitmap_find_free_region() accessing
      beyond the end of the bitmap.
      Reported-by: default avatarGuennadi Liakhovetski <lg@denx.de>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      aa8e4fc6
  2. 12 Mar, 2009 31 commits