Commit 1446e04c authored by Dave Airlie's avatar Dave Airlie

Merge branch 'drm-fixes-3.15' of git://people.freedesktop.org/~deathsimple/linux into drm-fixes

this is the next pull request for stashed up radeon fixes for 3.15. This is finally calming down with only four patches in this pull request.

* 'drm-fixes-3.15' of git://people.freedesktop.org/~deathsimple/linux:
  drm/radeon: only allocate necessary size for vm bo list
  drm/radeon: don't allow RADEON_GEM_DOMAIN_CPU for command submission
  drm/radeon: avoid crash if VM command submission isn't available
  drm/radeon: lower the ref * post PLL maximum once more
parents efb27e73 7d95f6cc
...@@ -152,6 +152,12 @@ static int radeon_cs_parser_relocs(struct radeon_cs_parser *p) ...@@ -152,6 +152,12 @@ static int radeon_cs_parser_relocs(struct radeon_cs_parser *p)
uint32_t domain = r->write_domain ? uint32_t domain = r->write_domain ?
r->write_domain : r->read_domains; r->write_domain : r->read_domains;
if (domain & RADEON_GEM_DOMAIN_CPU) {
DRM_ERROR("RADEON_GEM_DOMAIN_CPU is not valid "
"for command submission\n");
return -EINVAL;
}
p->relocs[i].domain = domain; p->relocs[i].domain = domain;
if (domain == RADEON_GEM_DOMAIN_VRAM) if (domain == RADEON_GEM_DOMAIN_VRAM)
domain |= RADEON_GEM_DOMAIN_GTT; domain |= RADEON_GEM_DOMAIN_GTT;
...@@ -342,11 +348,18 @@ int radeon_cs_parser_init(struct radeon_cs_parser *p, void *data) ...@@ -342,11 +348,18 @@ int radeon_cs_parser_init(struct radeon_cs_parser *p, void *data)
return -EINVAL; return -EINVAL;
/* we only support VM on some SI+ rings */ /* we only support VM on some SI+ rings */
if ((p->rdev->asic->ring[p->ring]->cs_parse == NULL) && if ((p->cs_flags & RADEON_CS_USE_VM) == 0) {
((p->cs_flags & RADEON_CS_USE_VM) == 0)) { if (p->rdev->asic->ring[p->ring]->cs_parse == NULL) {
DRM_ERROR("Ring %d requires VM!\n", p->ring); DRM_ERROR("Ring %d requires VM!\n", p->ring);
return -EINVAL; return -EINVAL;
} }
} else {
if (p->rdev->asic->ring[p->ring]->ib_parse == NULL) {
DRM_ERROR("VM not supported on ring %d!\n",
p->ring);
return -EINVAL;
}
}
} }
return 0; return 0;
......
...@@ -862,7 +862,7 @@ static void avivo_get_fb_ref_div(unsigned nom, unsigned den, unsigned post_div, ...@@ -862,7 +862,7 @@ static void avivo_get_fb_ref_div(unsigned nom, unsigned den, unsigned post_div,
unsigned *fb_div, unsigned *ref_div) unsigned *fb_div, unsigned *ref_div)
{ {
/* limit reference * post divider to a maximum */ /* limit reference * post divider to a maximum */
ref_div_max = min(128 / post_div, ref_div_max); ref_div_max = max(min(100 / post_div, ref_div_max), 1u);
/* get matching reference and feedback divider */ /* get matching reference and feedback divider */
*ref_div = min(max(DIV_ROUND_CLOSEST(den, post_div), 1u), ref_div_max); *ref_div = min(max(DIV_ROUND_CLOSEST(den, post_div), 1u), ref_div_max);
......
...@@ -130,10 +130,10 @@ struct radeon_cs_reloc *radeon_vm_get_bos(struct radeon_device *rdev, ...@@ -130,10 +130,10 @@ struct radeon_cs_reloc *radeon_vm_get_bos(struct radeon_device *rdev,
struct list_head *head) struct list_head *head)
{ {
struct radeon_cs_reloc *list; struct radeon_cs_reloc *list;
unsigned i, idx, size; unsigned i, idx;
size = (radeon_vm_num_pdes(rdev) + 1) * sizeof(struct radeon_cs_reloc); list = kmalloc_array(vm->max_pde_used + 1,
list = kmalloc(size, GFP_KERNEL); sizeof(struct radeon_cs_reloc), GFP_KERNEL);
if (!list) if (!list)
return NULL; return NULL;
......
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