Re: [Nouveau] [PATCH v2 1/6] make RAM device optional

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Feb 11, 2015 at 2:21 AM, Alexandre Courbot <gnurou@xxxxxxxxx> 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
--
To unsubscribe from this list: send the line "unsubscribe linux-tegra" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [ARM Kernel]     [Linux ARM]     [Linux ARM MSM]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux