Commit f39e8409 authored by Linus Torvalds's avatar Linus Torvalds

Merge branch 'drm-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/airlied/drm-2.6

* 'drm-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/airlied/drm-2.6:
  drm: Compare only lower 32 bits of framebuffer map offsets
  drm/i915: Don't leak in i915_gem_shmem_pread_slow()
  drm/radeon/kms: do bounds checking for 3D_LOAD_VBPNTR and bump array limit
  drm/radeon/kms: fix mac g5 quirk
  x86/uv/x2apic: update for change in pci bridge handling.
  alpha, drm: Remove obsolete Alpha support in MGA DRM code
  alpha/drm: Cleanup Alpha support in DRM generic code
  savage: remove unnecessary if statement
  drm/radeon: fix GUI idle IH debug statements
  drm/radeon/kms: check modes against max pixel clock
  drm: fix fbs in DRM_IOCTL_MODE_GETRESOURCES ioctl
parents 6211b3e1 66aa6962
...@@ -632,14 +632,14 @@ late_initcall(uv_init_heartbeat); ...@@ -632,14 +632,14 @@ late_initcall(uv_init_heartbeat);
/* Direct Legacy VGA I/O traffic to designated IOH */ /* Direct Legacy VGA I/O traffic to designated IOH */
int uv_set_vga_state(struct pci_dev *pdev, bool decode, int uv_set_vga_state(struct pci_dev *pdev, bool decode,
unsigned int command_bits, bool change_bridge) unsigned int command_bits, u32 flags)
{ {
int domain, bus, rc; int domain, bus, rc;
PR_DEVEL("devfn %x decode %d cmd %x chg_brdg %d\n", PR_DEVEL("devfn %x decode %d cmd %x flags %d\n",
pdev->devfn, decode, command_bits, change_bridge); pdev->devfn, decode, command_bits, flags);
if (!change_bridge) if (!(flags & PCI_VGA_STATE_CHANGE_BRIDGE))
return 0; return 0;
if ((command_bits & PCI_COMMAND_IO) == 0) if ((command_bits & PCI_COMMAND_IO) == 0)
......
...@@ -46,10 +46,11 @@ static struct drm_map_list *drm_find_matching_map(struct drm_device *dev, ...@@ -46,10 +46,11 @@ static struct drm_map_list *drm_find_matching_map(struct drm_device *dev,
list_for_each_entry(entry, &dev->maplist, head) { list_for_each_entry(entry, &dev->maplist, head) {
/* /*
* Because the kernel-userspace ABI is fixed at a 32-bit offset * Because the kernel-userspace ABI is fixed at a 32-bit offset
* while PCI resources may live above that, we ignore the map * while PCI resources may live above that, we only compare the
* offset for maps of type _DRM_FRAMEBUFFER or _DRM_REGISTERS. * lower 32 bits of the map offset for maps of type
* It is assumed that each driver will have only one resource of * _DRM_FRAMEBUFFER or _DRM_REGISTERS.
* each type. * It is assumed that if a driver have more than one resource
* of each type, the lower 32 bits are different.
*/ */
if (!entry->map || if (!entry->map ||
map->type != entry->map->type || map->type != entry->map->type ||
...@@ -59,9 +60,12 @@ static struct drm_map_list *drm_find_matching_map(struct drm_device *dev, ...@@ -59,9 +60,12 @@ static struct drm_map_list *drm_find_matching_map(struct drm_device *dev,
case _DRM_SHM: case _DRM_SHM:
if (map->flags != _DRM_CONTAINS_LOCK) if (map->flags != _DRM_CONTAINS_LOCK)
break; break;
return entry;
case _DRM_REGISTERS: case _DRM_REGISTERS:
case _DRM_FRAME_BUFFER: case _DRM_FRAME_BUFFER:
return entry; if ((entry->map->offset & 0xffffffff) ==
(map->offset & 0xffffffff))
return entry;
default: /* Make gcc happy */ default: /* Make gcc happy */
; ;
} }
...@@ -182,9 +186,6 @@ static int drm_addmap_core(struct drm_device * dev, resource_size_t offset, ...@@ -182,9 +186,6 @@ static int drm_addmap_core(struct drm_device * dev, resource_size_t offset,
kfree(map); kfree(map);
return -EINVAL; return -EINVAL;
} }
#endif
#ifdef __alpha__
map->offset += dev->hose->mem_space->start;
#endif #endif
/* Some drivers preinitialize some maps, without the X Server /* Some drivers preinitialize some maps, without the X Server
* needing to be aware of it. Therefore, we just return success * needing to be aware of it. Therefore, we just return success
......
...@@ -1113,7 +1113,7 @@ int drm_mode_getresources(struct drm_device *dev, void *data, ...@@ -1113,7 +1113,7 @@ int drm_mode_getresources(struct drm_device *dev, void *data,
if (card_res->count_fbs >= fb_count) { if (card_res->count_fbs >= fb_count) {
copied = 0; copied = 0;
fb_id = (uint32_t __user *)(unsigned long)card_res->fb_id_ptr; fb_id = (uint32_t __user *)(unsigned long)card_res->fb_id_ptr;
list_for_each_entry(fb, &file_priv->fbs, head) { list_for_each_entry(fb, &file_priv->fbs, filp_head) {
if (put_user(fb->base.id, fb_id + copied)) { if (put_user(fb->base.id, fb_id + copied)) {
ret = -EFAULT; ret = -EFAULT;
goto out; goto out;
......
...@@ -526,7 +526,7 @@ static int drm_mmap_dma(struct file *filp, struct vm_area_struct *vma) ...@@ -526,7 +526,7 @@ static int drm_mmap_dma(struct file *filp, struct vm_area_struct *vma)
static resource_size_t drm_core_get_reg_ofs(struct drm_device *dev) static resource_size_t drm_core_get_reg_ofs(struct drm_device *dev)
{ {
#ifdef __alpha__ #ifdef __alpha__
return dev->hose->dense_mem_base - dev->hose->mem_space->start; return dev->hose->dense_mem_base;
#else #else
return 0; return 0;
#endif #endif
......
...@@ -465,8 +465,10 @@ i915_gem_shmem_pread_slow(struct drm_device *dev, ...@@ -465,8 +465,10 @@ i915_gem_shmem_pread_slow(struct drm_device *dev,
page = read_cache_page_gfp(mapping, offset >> PAGE_SHIFT, page = read_cache_page_gfp(mapping, offset >> PAGE_SHIFT,
GFP_HIGHUSER | __GFP_RECLAIMABLE); GFP_HIGHUSER | __GFP_RECLAIMABLE);
if (IS_ERR(page)) if (IS_ERR(page)) {
return PTR_ERR(page); ret = PTR_ERR(page);
goto out;
}
if (do_bit17_swizzling) { if (do_bit17_swizzling) {
slow_shmem_bit17_copy(page, slow_shmem_bit17_copy(page,
......
...@@ -195,29 +195,10 @@ extern long mga_compat_ioctl(struct file *filp, unsigned int cmd, ...@@ -195,29 +195,10 @@ extern long mga_compat_ioctl(struct file *filp, unsigned int cmd,
#define mga_flush_write_combine() DRM_WRITEMEMORYBARRIER() #define mga_flush_write_combine() DRM_WRITEMEMORYBARRIER()
#if defined(__linux__) && defined(__alpha__)
#define MGA_BASE(reg) ((unsigned long)(dev_priv->mmio->handle))
#define MGA_ADDR(reg) (MGA_BASE(reg) + reg)
#define MGA_DEREF(reg) (*(volatile u32 *)MGA_ADDR(reg))
#define MGA_DEREF8(reg) (*(volatile u8 *)MGA_ADDR(reg))
#define MGA_READ(reg) (_MGA_READ((u32 *)MGA_ADDR(reg)))
#define MGA_READ8(reg) (_MGA_READ((u8 *)MGA_ADDR(reg)))
#define MGA_WRITE(reg, val) do { DRM_WRITEMEMORYBARRIER(); MGA_DEREF(reg) = val; } while (0)
#define MGA_WRITE8(reg, val) do { DRM_WRITEMEMORYBARRIER(); MGA_DEREF8(reg) = val; } while (0)
static inline u32 _MGA_READ(u32 *addr)
{
DRM_MEMORYBARRIER();
return *(volatile u32 *)addr;
}
#else
#define MGA_READ8(reg) DRM_READ8(dev_priv->mmio, (reg)) #define MGA_READ8(reg) DRM_READ8(dev_priv->mmio, (reg))
#define MGA_READ(reg) DRM_READ32(dev_priv->mmio, (reg)) #define MGA_READ(reg) DRM_READ32(dev_priv->mmio, (reg))
#define MGA_WRITE8(reg, val) DRM_WRITE8(dev_priv->mmio, (reg), (val)) #define MGA_WRITE8(reg, val) DRM_WRITE8(dev_priv->mmio, (reg), (val))
#define MGA_WRITE(reg, val) DRM_WRITE32(dev_priv->mmio, (reg), (val)) #define MGA_WRITE(reg, val) DRM_WRITE32(dev_priv->mmio, (reg), (val))
#endif
#define DWGREG0 0x1c00 #define DWGREG0 0x1c00
#define DWGREG0_END 0x1dff #define DWGREG0_END 0x1dff
......
...@@ -2944,7 +2944,7 @@ int evergreen_irq_process(struct radeon_device *rdev) ...@@ -2944,7 +2944,7 @@ int evergreen_irq_process(struct radeon_device *rdev)
radeon_fence_process(rdev); radeon_fence_process(rdev);
break; break;
case 233: /* GUI IDLE */ case 233: /* GUI IDLE */
DRM_DEBUG("IH: CP EOP\n"); DRM_DEBUG("IH: GUI idle\n");
rdev->pm.gui_idle = true; rdev->pm.gui_idle = true;
wake_up(&rdev->irq.idle_queue); wake_up(&rdev->irq.idle_queue);
break; break;
......
...@@ -63,7 +63,7 @@ struct r100_cs_track { ...@@ -63,7 +63,7 @@ struct r100_cs_track {
unsigned num_arrays; unsigned num_arrays;
unsigned max_indx; unsigned max_indx;
unsigned color_channel_mask; unsigned color_channel_mask;
struct r100_cs_track_array arrays[11]; struct r100_cs_track_array arrays[16];
struct r100_cs_track_cb cb[R300_MAX_CB]; struct r100_cs_track_cb cb[R300_MAX_CB];
struct r100_cs_track_cb zb; struct r100_cs_track_cb zb;
struct r100_cs_track_cb aa; struct r100_cs_track_cb aa;
...@@ -146,6 +146,12 @@ static inline int r100_packet3_load_vbpntr(struct radeon_cs_parser *p, ...@@ -146,6 +146,12 @@ static inline int r100_packet3_load_vbpntr(struct radeon_cs_parser *p,
ib = p->ib->ptr; ib = p->ib->ptr;
track = (struct r100_cs_track *)p->track; track = (struct r100_cs_track *)p->track;
c = radeon_get_ib_value(p, idx++) & 0x1F; c = radeon_get_ib_value(p, idx++) & 0x1F;
if (c > 16) {
DRM_ERROR("Only 16 vertex buffers are allowed %d\n",
pkt->opcode);
r100_cs_dump_packet(p, pkt);
return -EINVAL;
}
track->num_arrays = c; track->num_arrays = c;
for (i = 0; i < (c - 1); i+=2, idx+=3) { for (i = 0; i < (c - 1); i+=2, idx+=3) {
r = r100_cs_packet_next_reloc(p, &reloc); r = r100_cs_packet_next_reloc(p, &reloc);
......
...@@ -3444,7 +3444,7 @@ int r600_irq_process(struct radeon_device *rdev) ...@@ -3444,7 +3444,7 @@ int r600_irq_process(struct radeon_device *rdev)
radeon_fence_process(rdev); radeon_fence_process(rdev);
break; break;
case 233: /* GUI IDLE */ case 233: /* GUI IDLE */
DRM_DEBUG("IH: CP EOP\n"); DRM_DEBUG("IH: GUI idle\n");
rdev->pm.gui_idle = true; rdev->pm.gui_idle = true;
wake_up(&rdev->irq.idle_queue); wake_up(&rdev->irq.idle_queue);
break; break;
......
...@@ -165,6 +165,7 @@ struct radeon_clock { ...@@ -165,6 +165,7 @@ struct radeon_clock {
uint32_t default_sclk; uint32_t default_sclk;
uint32_t default_dispclk; uint32_t default_dispclk;
uint32_t dp_extclk; uint32_t dp_extclk;
uint32_t max_pixel_clock;
}; };
/* /*
......
...@@ -1246,6 +1246,10 @@ bool radeon_atom_get_clock_info(struct drm_device *dev) ...@@ -1246,6 +1246,10 @@ bool radeon_atom_get_clock_info(struct drm_device *dev)
} }
*dcpll = *p1pll; *dcpll = *p1pll;
rdev->clock.max_pixel_clock = le16_to_cpu(firmware_info->info.usMaxPixelClock);
if (rdev->clock.max_pixel_clock == 0)
rdev->clock.max_pixel_clock = 40000;
return true; return true;
} }
......
...@@ -117,7 +117,7 @@ static bool __devinit radeon_read_clocks_OF(struct drm_device *dev) ...@@ -117,7 +117,7 @@ static bool __devinit radeon_read_clocks_OF(struct drm_device *dev)
p1pll->reference_div = RREG32_PLL(RADEON_PPLL_REF_DIV) & 0x3ff; p1pll->reference_div = RREG32_PLL(RADEON_PPLL_REF_DIV) & 0x3ff;
if (p1pll->reference_div < 2) if (p1pll->reference_div < 2)
p1pll->reference_div = 12; p1pll->reference_div = 12;
p2pll->reference_div = p1pll->reference_div; p2pll->reference_div = p1pll->reference_div;
/* These aren't in the device-tree */ /* These aren't in the device-tree */
if (rdev->family >= CHIP_R420) { if (rdev->family >= CHIP_R420) {
...@@ -139,6 +139,8 @@ static bool __devinit radeon_read_clocks_OF(struct drm_device *dev) ...@@ -139,6 +139,8 @@ static bool __devinit radeon_read_clocks_OF(struct drm_device *dev)
p2pll->pll_out_min = 12500; p2pll->pll_out_min = 12500;
p2pll->pll_out_max = 35000; p2pll->pll_out_max = 35000;
} }
/* not sure what the max should be in all cases */
rdev->clock.max_pixel_clock = 35000;
spll->reference_freq = mpll->reference_freq = p1pll->reference_freq; spll->reference_freq = mpll->reference_freq = p1pll->reference_freq;
spll->reference_div = mpll->reference_div = spll->reference_div = mpll->reference_div =
...@@ -151,7 +153,7 @@ static bool __devinit radeon_read_clocks_OF(struct drm_device *dev) ...@@ -151,7 +153,7 @@ static bool __devinit radeon_read_clocks_OF(struct drm_device *dev)
else else
rdev->clock.default_sclk = rdev->clock.default_sclk =
radeon_legacy_get_engine_clock(rdev); radeon_legacy_get_engine_clock(rdev);
val = of_get_property(dp, "ATY,MCLK", NULL); val = of_get_property(dp, "ATY,MCLK", NULL);
if (val && *val) if (val && *val)
rdev->clock.default_mclk = (*val) / 10; rdev->clock.default_mclk = (*val) / 10;
...@@ -160,7 +162,7 @@ static bool __devinit radeon_read_clocks_OF(struct drm_device *dev) ...@@ -160,7 +162,7 @@ static bool __devinit radeon_read_clocks_OF(struct drm_device *dev)
radeon_legacy_get_memory_clock(rdev); radeon_legacy_get_memory_clock(rdev);
DRM_INFO("Using device-tree clock info\n"); DRM_INFO("Using device-tree clock info\n");
return true; return true;
} }
#else #else
......
...@@ -866,6 +866,11 @@ bool radeon_combios_get_clock_info(struct drm_device *dev) ...@@ -866,6 +866,11 @@ bool radeon_combios_get_clock_info(struct drm_device *dev)
rdev->clock.default_sclk = sclk; rdev->clock.default_sclk = sclk;
rdev->clock.default_mclk = mclk; rdev->clock.default_mclk = mclk;
if (RBIOS32(pll_info + 0x16))
rdev->clock.max_pixel_clock = RBIOS32(pll_info + 0x16);
else
rdev->clock.max_pixel_clock = 35000; /* might need something asic specific */
return true; return true;
} }
return false; return false;
...@@ -1548,9 +1553,8 @@ bool radeon_get_legacy_connector_info_from_table(struct drm_device *dev) ...@@ -1548,9 +1553,8 @@ bool radeon_get_legacy_connector_info_from_table(struct drm_device *dev)
(rdev->pdev->subsystem_device == 0x4a48)) { (rdev->pdev->subsystem_device == 0x4a48)) {
/* Mac X800 */ /* Mac X800 */
rdev->mode_info.connector_table = CT_MAC_X800; rdev->mode_info.connector_table = CT_MAC_X800;
} else if ((rdev->pdev->device == 0x4150) && } else if (of_machine_is_compatible("PowerMac7,2") ||
(rdev->pdev->subsystem_vendor == 0x1002) && of_machine_is_compatible("PowerMac7,3")) {
(rdev->pdev->subsystem_device == 0x4150)) {
/* Mac G5 9600 */ /* Mac G5 9600 */
rdev->mode_info.connector_table = CT_MAC_G5_9600; rdev->mode_info.connector_table = CT_MAC_G5_9600;
} else } else
......
...@@ -626,8 +626,14 @@ static int radeon_vga_get_modes(struct drm_connector *connector) ...@@ -626,8 +626,14 @@ static int radeon_vga_get_modes(struct drm_connector *connector)
static int radeon_vga_mode_valid(struct drm_connector *connector, static int radeon_vga_mode_valid(struct drm_connector *connector,
struct drm_display_mode *mode) struct drm_display_mode *mode)
{ {
struct drm_device *dev = connector->dev;
struct radeon_device *rdev = dev->dev_private;
/* XXX check mode bandwidth */ /* XXX check mode bandwidth */
/* XXX verify against max DAC output frequency */
if ((mode->clock / 10) > rdev->clock.max_pixel_clock)
return MODE_CLOCK_HIGH;
return MODE_OK; return MODE_OK;
} }
...@@ -1015,6 +1021,11 @@ static int radeon_dvi_mode_valid(struct drm_connector *connector, ...@@ -1015,6 +1021,11 @@ static int radeon_dvi_mode_valid(struct drm_connector *connector,
} else } else
return MODE_CLOCK_HIGH; return MODE_CLOCK_HIGH;
} }
/* check against the max pixel clock */
if ((mode->clock / 10) > rdev->clock.max_pixel_clock)
return MODE_CLOCK_HIGH;
return MODE_OK; return MODE_OK;
} }
......
...@@ -647,9 +647,6 @@ int savage_driver_firstopen(struct drm_device *dev) ...@@ -647,9 +647,6 @@ int savage_driver_firstopen(struct drm_device *dev)
ret = drm_addmap(dev, aperture_base, SAVAGE_APERTURE_SIZE, ret = drm_addmap(dev, aperture_base, SAVAGE_APERTURE_SIZE,
_DRM_FRAME_BUFFER, _DRM_WRITE_COMBINING, _DRM_FRAME_BUFFER, _DRM_WRITE_COMBINING,
&dev_priv->aperture); &dev_priv->aperture);
if (ret)
return ret;
return ret; return ret;
} }
......
...@@ -3271,11 +3271,11 @@ void __init pci_register_set_vga_state(arch_set_vga_state_t func) ...@@ -3271,11 +3271,11 @@ void __init pci_register_set_vga_state(arch_set_vga_state_t func)
} }
static int pci_set_vga_state_arch(struct pci_dev *dev, bool decode, static int pci_set_vga_state_arch(struct pci_dev *dev, bool decode,
unsigned int command_bits, bool change_bridge) unsigned int command_bits, u32 flags)
{ {
if (arch_set_vga_state) if (arch_set_vga_state)
return arch_set_vga_state(dev, decode, command_bits, return arch_set_vga_state(dev, decode, command_bits,
change_bridge); flags);
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment