Skip to content

Commit de96355

Browse files
committed
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: (55 commits) Revert "drm/i915: Try enabling RC6 by default (again)" drm/radeon: Extended DDC Probing for ECS A740GM-M DVI-D Connector drm/radeon: Log Subsystem Vendor and Device Information drm/radeon: Extended DDC Probing for Connectors with Improperly Wired DDC Lines (here: Asus M2A-VM HDMI) drm: Separate EDID Header Check from EDID Block Check drm: Add NULL check about irq functions drm: Fix irq install error handling drm/radeon: fix potential NULL dereference in drivers/gpu/drm/radeon/atom.c drm/radeon: clean reg header files drm/debugfs: Initialise empty variable drm/radeon/kms: add thermal chip quirk for asus 9600xt drm/radeon: off by one in check_reg() functions drm/radeon/kms: fix version comment due to merge timing drm/i915: allow cache sharing policy control drm/i915/hdmi: HDMI source product description infoframe support drm/i915/hdmi: split infoframe setting from infoframe type code drm: track CEA version number if present drm/i915: Try enabling RC6 by default (again) Revert "drm/i915/dp: Zero the DPCD data before connection probe" drm/i915/dp: wait for previous AUX channel activity to clear ...
2 parents 8cd290a + 39060a0 commit de96355

30 files changed

+753
-139
lines changed

drivers/gpu/drm/drm_debugfs.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,6 @@ int drm_debugfs_create_files(struct drm_info_list *files, int count,
9090
struct drm_device *dev = minor->dev;
9191
struct dentry *ent;
9292
struct drm_info_node *tmp;
93-
char name[64];
9493
int i, ret;
9594

9695
for (i = 0; i < count; i++) {
@@ -108,6 +107,9 @@ int drm_debugfs_create_files(struct drm_info_list *files, int count,
108107
ent = debugfs_create_file(files[i].name, S_IFREG | S_IRUGO,
109108
root, tmp, &drm_debugfs_fops);
110109
if (!ent) {
110+
char name[64];
111+
strncpy(name, root->d_name.name,
112+
min(root->d_name.len, 64U));
111113
DRM_ERROR("Cannot create /sys/kernel/debug/dri/%s/%s\n",
112114
name, files[i].name);
113115
kfree(tmp);

drivers/gpu/drm/drm_edid.c

Lines changed: 27 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,23 @@ static const u8 edid_header[] = {
127127
0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00
128128
};
129129

130+
/*
131+
* Sanity check the header of the base EDID block. Return 8 if the header
132+
* is perfect, down to 0 if it's totally wrong.
133+
*/
134+
int drm_edid_header_is_valid(const u8 *raw_edid)
135+
{
136+
int i, score = 0;
137+
138+
for (i = 0; i < sizeof(edid_header); i++)
139+
if (raw_edid[i] == edid_header[i])
140+
score++;
141+
142+
return score;
143+
}
144+
EXPORT_SYMBOL(drm_edid_header_is_valid);
145+
146+
130147
/*
131148
* Sanity check the EDID block (base or extension). Return 0 if the block
132149
* doesn't check out, or 1 if it's valid.
@@ -139,12 +156,7 @@ drm_edid_block_valid(u8 *raw_edid)
139156
struct edid *edid = (struct edid *)raw_edid;
140157

141158
if (raw_edid[0] == 0x00) {
142-
int score = 0;
143-
144-
for (i = 0; i < sizeof(edid_header); i++)
145-
if (raw_edid[i] == edid_header[i])
146-
score++;
147-
159+
int score = drm_edid_header_is_valid(raw_edid);
148160
if (score == 8) ;
149161
else if (score >= 6) {
150162
DRM_DEBUG("Fixing EDID header, your hardware may be failing\n");
@@ -1439,6 +1451,8 @@ EXPORT_SYMBOL(drm_detect_monitor_audio);
14391451
static void drm_add_display_info(struct edid *edid,
14401452
struct drm_display_info *info)
14411453
{
1454+
u8 *edid_ext;
1455+
14421456
info->width_mm = edid->width_cm * 10;
14431457
info->height_mm = edid->height_cm * 10;
14441458

@@ -1483,6 +1497,13 @@ static void drm_add_display_info(struct edid *edid,
14831497
info->color_formats = DRM_COLOR_FORMAT_YCRCB444;
14841498
if (info->color_formats & DRM_EDID_FEATURE_RGB_YCRCB422)
14851499
info->color_formats = DRM_COLOR_FORMAT_YCRCB422;
1500+
1501+
/* Get data from CEA blocks if present */
1502+
edid_ext = drm_find_cea_extension(edid);
1503+
if (!edid_ext)
1504+
return;
1505+
1506+
info->cea_rev = edid_ext[1];
14861507
}
14871508

14881509
/**

drivers/gpu/drm/drm_irq.c

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -291,11 +291,14 @@ static void drm_irq_vgaarb_nokms(void *cookie, bool state)
291291
if (!dev->irq_enabled)
292292
return;
293293

294-
if (state)
295-
dev->driver->irq_uninstall(dev);
296-
else {
297-
dev->driver->irq_preinstall(dev);
298-
dev->driver->irq_postinstall(dev);
294+
if (state) {
295+
if (dev->driver->irq_uninstall)
296+
dev->driver->irq_uninstall(dev);
297+
} else {
298+
if (dev->driver->irq_preinstall)
299+
dev->driver->irq_preinstall(dev);
300+
if (dev->driver->irq_postinstall)
301+
dev->driver->irq_postinstall(dev);
299302
}
300303
}
301304

@@ -338,7 +341,8 @@ int drm_irq_install(struct drm_device *dev)
338341
DRM_DEBUG("irq=%d\n", drm_dev_to_irq(dev));
339342

340343
/* Before installing handler */
341-
dev->driver->irq_preinstall(dev);
344+
if (dev->driver->irq_preinstall)
345+
dev->driver->irq_preinstall(dev);
342346

343347
/* Install handler */
344348
if (drm_core_check_feature(dev, DRIVER_IRQ_SHARED))
@@ -363,11 +367,16 @@ int drm_irq_install(struct drm_device *dev)
363367
vga_client_register(dev->pdev, (void *)dev, drm_irq_vgaarb_nokms, NULL);
364368

365369
/* After installing handler */
366-
ret = dev->driver->irq_postinstall(dev);
370+
if (dev->driver->irq_postinstall)
371+
ret = dev->driver->irq_postinstall(dev);
372+
367373
if (ret < 0) {
368374
mutex_lock(&dev->struct_mutex);
369375
dev->irq_enabled = 0;
370376
mutex_unlock(&dev->struct_mutex);
377+
if (!drm_core_check_feature(dev, DRIVER_MODESET))
378+
vga_client_register(dev->pdev, NULL, NULL, NULL);
379+
free_irq(drm_dev_to_irq(dev), dev);
371380
}
372381

373382
return ret;
@@ -413,7 +422,8 @@ int drm_irq_uninstall(struct drm_device *dev)
413422
if (!drm_core_check_feature(dev, DRIVER_MODESET))
414423
vga_client_register(dev->pdev, NULL, NULL, NULL);
415424

416-
dev->driver->irq_uninstall(dev);
425+
if (dev->driver->irq_uninstall)
426+
dev->driver->irq_uninstall(dev);
417427

418428
free_irq(drm_dev_to_irq(dev), dev);
419429

drivers/gpu/drm/i915/i915_debugfs.c

Lines changed: 189 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1338,6 +1338,155 @@ static const struct file_operations i915_wedged_fops = {
13381338
.llseek = default_llseek,
13391339
};
13401340

1341+
static int
1342+
i915_max_freq_open(struct inode *inode,
1343+
struct file *filp)
1344+
{
1345+
filp->private_data = inode->i_private;
1346+
return 0;
1347+
}
1348+
1349+
static ssize_t
1350+
i915_max_freq_read(struct file *filp,
1351+
char __user *ubuf,
1352+
size_t max,
1353+
loff_t *ppos)
1354+
{
1355+
struct drm_device *dev = filp->private_data;
1356+
drm_i915_private_t *dev_priv = dev->dev_private;
1357+
char buf[80];
1358+
int len;
1359+
1360+
len = snprintf(buf, sizeof (buf),
1361+
"max freq: %d\n", dev_priv->max_delay * 50);
1362+
1363+
if (len > sizeof (buf))
1364+
len = sizeof (buf);
1365+
1366+
return simple_read_from_buffer(ubuf, max, ppos, buf, len);
1367+
}
1368+
1369+
static ssize_t
1370+
i915_max_freq_write(struct file *filp,
1371+
const char __user *ubuf,
1372+
size_t cnt,
1373+
loff_t *ppos)
1374+
{
1375+
struct drm_device *dev = filp->private_data;
1376+
struct drm_i915_private *dev_priv = dev->dev_private;
1377+
char buf[20];
1378+
int val = 1;
1379+
1380+
if (cnt > 0) {
1381+
if (cnt > sizeof (buf) - 1)
1382+
return -EINVAL;
1383+
1384+
if (copy_from_user(buf, ubuf, cnt))
1385+
return -EFAULT;
1386+
buf[cnt] = 0;
1387+
1388+
val = simple_strtoul(buf, NULL, 0);
1389+
}
1390+
1391+
DRM_DEBUG_DRIVER("Manually setting max freq to %d\n", val);
1392+
1393+
/*
1394+
* Turbo will still be enabled, but won't go above the set value.
1395+
*/
1396+
dev_priv->max_delay = val / 50;
1397+
1398+
gen6_set_rps(dev, val / 50);
1399+
1400+
return cnt;
1401+
}
1402+
1403+
static const struct file_operations i915_max_freq_fops = {
1404+
.owner = THIS_MODULE,
1405+
.open = i915_max_freq_open,
1406+
.read = i915_max_freq_read,
1407+
.write = i915_max_freq_write,
1408+
.llseek = default_llseek,
1409+
};
1410+
1411+
static int
1412+
i915_cache_sharing_open(struct inode *inode,
1413+
struct file *filp)
1414+
{
1415+
filp->private_data = inode->i_private;
1416+
return 0;
1417+
}
1418+
1419+
static ssize_t
1420+
i915_cache_sharing_read(struct file *filp,
1421+
char __user *ubuf,
1422+
size_t max,
1423+
loff_t *ppos)
1424+
{
1425+
struct drm_device *dev = filp->private_data;
1426+
drm_i915_private_t *dev_priv = dev->dev_private;
1427+
char buf[80];
1428+
u32 snpcr;
1429+
int len;
1430+
1431+
mutex_lock(&dev_priv->dev->struct_mutex);
1432+
snpcr = I915_READ(GEN6_MBCUNIT_SNPCR);
1433+
mutex_unlock(&dev_priv->dev->struct_mutex);
1434+
1435+
len = snprintf(buf, sizeof (buf),
1436+
"%d\n", (snpcr & GEN6_MBC_SNPCR_MASK) >>
1437+
GEN6_MBC_SNPCR_SHIFT);
1438+
1439+
if (len > sizeof (buf))
1440+
len = sizeof (buf);
1441+
1442+
return simple_read_from_buffer(ubuf, max, ppos, buf, len);
1443+
}
1444+
1445+
static ssize_t
1446+
i915_cache_sharing_write(struct file *filp,
1447+
const char __user *ubuf,
1448+
size_t cnt,
1449+
loff_t *ppos)
1450+
{
1451+
struct drm_device *dev = filp->private_data;
1452+
struct drm_i915_private *dev_priv = dev->dev_private;
1453+
char buf[20];
1454+
u32 snpcr;
1455+
int val = 1;
1456+
1457+
if (cnt > 0) {
1458+
if (cnt > sizeof (buf) - 1)
1459+
return -EINVAL;
1460+
1461+
if (copy_from_user(buf, ubuf, cnt))
1462+
return -EFAULT;
1463+
buf[cnt] = 0;
1464+
1465+
val = simple_strtoul(buf, NULL, 0);
1466+
}
1467+
1468+
if (val < 0 || val > 3)
1469+
return -EINVAL;
1470+
1471+
DRM_DEBUG_DRIVER("Manually setting uncore sharing to %d\n", val);
1472+
1473+
/* Update the cache sharing policy here as well */
1474+
snpcr = I915_READ(GEN6_MBCUNIT_SNPCR);
1475+
snpcr &= ~GEN6_MBC_SNPCR_MASK;
1476+
snpcr |= (val << GEN6_MBC_SNPCR_SHIFT);
1477+
I915_WRITE(GEN6_MBCUNIT_SNPCR, snpcr);
1478+
1479+
return cnt;
1480+
}
1481+
1482+
static const struct file_operations i915_cache_sharing_fops = {
1483+
.owner = THIS_MODULE,
1484+
.open = i915_cache_sharing_open,
1485+
.read = i915_cache_sharing_read,
1486+
.write = i915_cache_sharing_write,
1487+
.llseek = default_llseek,
1488+
};
1489+
13411490
/* As the drm_debugfs_init() routines are called before dev->dev_private is
13421491
* allocated we need to hook into the minor for release. */
13431492
static int
@@ -1437,6 +1586,36 @@ static int i915_forcewake_create(struct dentry *root, struct drm_minor *minor)
14371586
return drm_add_fake_info_node(minor, ent, &i915_forcewake_fops);
14381587
}
14391588

1589+
static int i915_max_freq_create(struct dentry *root, struct drm_minor *minor)
1590+
{
1591+
struct drm_device *dev = minor->dev;
1592+
struct dentry *ent;
1593+
1594+
ent = debugfs_create_file("i915_max_freq",
1595+
S_IRUGO | S_IWUSR,
1596+
root, dev,
1597+
&i915_max_freq_fops);
1598+
if (IS_ERR(ent))
1599+
return PTR_ERR(ent);
1600+
1601+
return drm_add_fake_info_node(minor, ent, &i915_max_freq_fops);
1602+
}
1603+
1604+
static int i915_cache_sharing_create(struct dentry *root, struct drm_minor *minor)
1605+
{
1606+
struct drm_device *dev = minor->dev;
1607+
struct dentry *ent;
1608+
1609+
ent = debugfs_create_file("i915_cache_sharing",
1610+
S_IRUGO | S_IWUSR,
1611+
root, dev,
1612+
&i915_cache_sharing_fops);
1613+
if (IS_ERR(ent))
1614+
return PTR_ERR(ent);
1615+
1616+
return drm_add_fake_info_node(minor, ent, &i915_cache_sharing_fops);
1617+
}
1618+
14401619
static struct drm_info_list i915_debugfs_list[] = {
14411620
{"i915_capabilities", i915_capabilities, 0},
14421621
{"i915_gem_objects", i915_gem_object_info, 0},
@@ -1488,6 +1667,12 @@ int i915_debugfs_init(struct drm_minor *minor)
14881667
return ret;
14891668

14901669
ret = i915_forcewake_create(minor->debugfs_root, minor);
1670+
if (ret)
1671+
return ret;
1672+
ret = i915_max_freq_create(minor->debugfs_root, minor);
1673+
if (ret)
1674+
return ret;
1675+
ret = i915_cache_sharing_create(minor->debugfs_root, minor);
14911676
if (ret)
14921677
return ret;
14931678

@@ -1504,6 +1689,10 @@ void i915_debugfs_cleanup(struct drm_minor *minor)
15041689
1, minor);
15051690
drm_debugfs_remove_files((struct drm_info_list *) &i915_wedged_fops,
15061691
1, minor);
1692+
drm_debugfs_remove_files((struct drm_info_list *) &i915_max_freq_fops,
1693+
1, minor);
1694+
drm_debugfs_remove_files((struct drm_info_list *) &i915_cache_sharing_fops,
1695+
1, minor);
15071696
}
15081697

15091698
#endif /* CONFIG_DEBUG_FS */

drivers/gpu/drm/i915/i915_dma.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,6 @@ static void i915_write_hws_pga(struct drm_device *dev)
6161
static int i915_init_phys_hws(struct drm_device *dev)
6262
{
6363
drm_i915_private_t *dev_priv = dev->dev_private;
64-
struct intel_ring_buffer *ring = LP_RING(dev_priv);
6564

6665
/* Program Hardware Status Page */
6766
dev_priv->status_page_dmah =
@@ -71,10 +70,9 @@ static int i915_init_phys_hws(struct drm_device *dev)
7170
DRM_ERROR("Can not allocate hardware status page\n");
7271
return -ENOMEM;
7372
}
74-
ring->status_page.page_addr =
75-
(void __force __iomem *)dev_priv->status_page_dmah->vaddr;
7673

77-
memset_io(ring->status_page.page_addr, 0, PAGE_SIZE);
74+
memset_io((void __force __iomem *)dev_priv->status_page_dmah->vaddr,
75+
0, PAGE_SIZE);
7876

7977
i915_write_hws_pga(dev);
8078

drivers/gpu/drm/i915/i915_drv.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -544,6 +544,7 @@ typedef struct drm_i915_private {
544544
u32 savePIPEB_LINK_M1;
545545
u32 savePIPEB_LINK_N1;
546546
u32 saveMCHBAR_RENDER_STANDBY;
547+
u32 savePCH_PORT_HOTPLUG;
547548

548549
struct {
549550
/** Bridge to intel-gtt-ko */

drivers/gpu/drm/i915/i915_gem.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3112,7 +3112,7 @@ i915_gem_object_pin_to_display_plane(struct drm_i915_gem_object *obj,
31123112

31133113
if (pipelined != obj->ring) {
31143114
ret = i915_gem_object_wait_rendering(obj);
3115-
if (ret)
3115+
if (ret == -ERESTARTSYS)
31163116
return ret;
31173117
}
31183118

0 commit comments

Comments
 (0)