[Nouveau] [PATCH v2 1/6] make RAM device optional
Ilia Mirkin
imirkin at alum.mit.edu
Tue Feb 10 23:40:08 PST 2015
On Wed, Feb 11, 2015 at 2:21 AM, Alexandre Courbot <gnurou at gmail.com> wrote:
> @@ -150,7 +151,10 @@ gf100_ltc_init_tag_ram(struct nvkm_fb *pfb, struct nvkm_ltc_priv *priv)
> int ret;
>
> /* tags for 1/4 of VRAM should be enough (8192/4 per GiB of VRAM) */
> - priv->num_tags = (pfb->ram->size >> 17) / 4;
> + if (pfb->ram)
> + priv->num_tags = (pfb->ram->size >> 17) / 4;
> + else
> + priv->num_tags = (1 << 17);
> if (priv->num_tags > (1 << 17))
> priv->num_tags = 1 << 17; /* we have 17 bits in PTE */
> priv->num_tags = (priv->num_tags + 63) & ~63; /* round up to 64 */
> @@ -170,8 +174,11 @@ gf100_ltc_init_tag_ram(struct nvkm_fb *pfb, struct nvkm_ltc_priv *priv)
> tag_size += tag_align;
> tag_size = (tag_size + 0xfff) >> 12; /* round up */
>
> - ret = nvkm_mm_tail(&pfb->vram, 1, 1, tag_size, tag_size, 1,
> - &priv->tag_ram);
> + if (pfb->ram)
> + ret = nvkm_mm_tail(&pfb->vram, 1, 1, tag_size, tag_size, 1,
> + &priv->tag_ram);
> + else
> + ret = -1;
> if (ret) {
> priv->num_tags = 0;
> } else {
Seems like you could just avoid a lot of this and just start the
function out with
if (!pfb->ram) {
priv->num_tags = 0; (is that even necessary? the object is
probably kzalloc'd)
ret = nouveau_mm_init(&priv->tags, 0, 0, 1);
return ret;
}
That's essentially what happens, no? Perhaps you could go a step
further and teach the base code about uninitialized tags mm, but that
may not be worth it.
-ilia
More information about the Nouveau
mailing list