Merge branch 'linux-4.12' of git://github.com/skeggsb/linux into drm-next
authorDave Airlie <airlied@redhat.com>
Mon, 1 May 2017 18:46:01 +0000 (04:46 +1000)
committerDave Airlie <airlied@redhat.com>
Mon, 1 May 2017 18:46:01 +0000 (04:46 +1000)
Some nouveau regression fixes.

* 'linux-4.12' of git://github.com/skeggsb/linux:
  drm/nouveau/fb/gf100-: Fix 32 bit wraparound in new ram detection
  drm/nouveau/secboot/gm20b: fix the error return code in gm20b_secboot_tegra_read_wpr()
  drm/nouveau/kms: Increase max retries in scanout position queries.
  drm/nouveau/bios/bitP: check that table is long enough for optional pointers
  drm/nouveau/fifo/nv40: no ctxsw for pre-nv44 mpeg engine

drivers/gpu/drm/nouveau/nouveau_display.c
drivers/gpu/drm/nouveau/nvkm/engine/fifo/dmanv40.c
drivers/gpu/drm/nouveau/nvkm/subdev/bios/boost.c
drivers/gpu/drm/nouveau/nvkm/subdev/bios/cstep.c
drivers/gpu/drm/nouveau/nvkm/subdev/bios/fan.c
drivers/gpu/drm/nouveau/nvkm/subdev/bios/power_budget.c
drivers/gpu/drm/nouveau/nvkm/subdev/bios/vpstate.c
drivers/gpu/drm/nouveau/nvkm/subdev/fb/ramgf100.c
drivers/gpu/drm/nouveau/nvkm/subdev/secboot/gm20b.c

index 6104f61b00fcb02d6cb18b68dba54dcea3f16045..21b10f9840c95e29cd177e9e36d93b8d6155b48d 100644 (file)
@@ -111,7 +111,7 @@ nouveau_display_scanoutpos_head(struct drm_crtc *crtc, int *vpos, int *hpos,
        };
        struct nouveau_display *disp = nouveau_display(crtc->dev);
        struct drm_vblank_crtc *vblank = &crtc->dev->vblank[drm_crtc_index(crtc)];
-       int ret, retry = 1;
+       int ret, retry = 20;
 
        do {
                ret = nvif_mthd(&disp->disp, 0, &args, sizeof(args));
index 0ec179fc40a1f366ac2891aa306d7d1c6107af44..5f722c6e8a2f4652eec5dde550d0a4792cd86c8b 100644 (file)
@@ -44,6 +44,8 @@ nv40_fifo_dma_engine(struct nvkm_engine *engine, u32 *reg, u32 *ctx)
                *ctx = 0x38;
                return true;
        case NVKM_ENGINE_MPEG:
+               if (engine->subdev.device->chipset < 0x44)
+                       return false;
                *reg = 0x00330c;
                *ctx = 0x54;
                return true;
index eaf74eb7298386ec0d41cc96dada6b7f774b4d4d..8ab896dd4e926a28da6a7185254a022312222638 100644 (file)
@@ -33,7 +33,7 @@ nvbios_boostTe(struct nvkm_bios *bios,
        u32 boost = 0;
 
        if (!bit_entry(bios, 'P', &bit_P)) {
-               if (bit_P.version == 2)
+               if (bit_P.version == 2 && bit_P.length >= 0x34)
                        boost = nvbios_rd32(bios, bit_P.offset + 0x30);
 
                if (boost) {
index 5063382d8a6c5f988deec4d6dd5474bcc4cbde3d..7c8c36054f71d5d12327ce957b98469973e1b471 100644 (file)
@@ -33,7 +33,7 @@ nvbios_cstepTe(struct nvkm_bios *bios,
        u32 cstep = 0;
 
        if (!bit_entry(bios, 'P', &bit_P)) {
-               if (bit_P.version == 2)
+               if (bit_P.version == 2 && bit_P.length >= 0x38)
                        cstep = nvbios_rd32(bios, bit_P.offset + 0x34);
 
                if (cstep) {
index 456f9ea920dcf83478e0e9f25518cc887fc78fc4..0dfb15a27e4ef83f29b4dc3f43c279088dab9cf2 100644 (file)
@@ -32,7 +32,7 @@ nvbios_fan_table(struct nvkm_bios *bios, u8 *ver, u8 *hdr, u8 *cnt, u8 *len)
        u32 fan = 0;
 
        if (!bit_entry(bios, 'P', &bit_P)) {
-               if (bit_P.version == 2 && bit_P.length >= 0x5a)
+               if (bit_P.version == 2 && bit_P.length >= 0x5c)
                        fan = nvbios_rd32(bios, bit_P.offset + 0x58);
 
                if (fan) {
index 617bfffce4ad5e1dd35ac8259d7b23552ca55a04..03d2f970a29ff23096a1cef960d46db320abf6cd 100644 (file)
@@ -33,7 +33,7 @@ nvbios_power_budget_table(struct nvkm_bios *bios, u8 *ver, u8 *hdr, u8 *cnt,
        u32 power_budget;
 
        if (bit_entry(bios, 'P', &bit_P) || bit_P.version != 2 ||
-           bit_P.length < 0x2c)
+           bit_P.length < 0x30)
                return 0;
 
        power_budget = nvbios_rd32(bios, bit_P.offset + 0x2c);
index f199270163d2c17aa938c3fc0792de2813f3d89c..20b6fc8243e0aa1a9d3e8b9228c952617e908745 100644 (file)
@@ -31,7 +31,7 @@ nvbios_vpstate_offset(struct nvkm_bios *b)
        struct bit_entry bit_P;
 
        if (!bit_entry(b, 'P', &bit_P)) {
-               if (bit_P.version == 2)
+               if (bit_P.version == 2 && bit_P.length >= 0x3c)
                        return nvbios_rd32(b, bit_P.offset + 0x38);
        }
 
index 53c32fc694e949b1e1d3bb461704f2beb3366827..c63975907c907da7afc433398d49c99137fca04d 100644 (file)
@@ -589,7 +589,7 @@ gf100_ram_ctor(const struct nvkm_ram_func *func, struct nvkm_fb *fb,
                        nvkm_debug(subdev, "FBP %d: %4d MiB, %d LTC(s)\n",
                                   fbp, size, ltcs);
                        lcomm  = min(lcomm, (u64)(size / ltcs) << 20);
-                       total += size << 20;
+                       total += (u64) size << 20;
                        ltcn  += ltcs;
                } else {
                        nvkm_debug(subdev, "FBP %d: disabled\n", fbp);
index b10ed59a49116a70e27c7d62f0ebdd16c717ca64..30491d132d59c08cf6defd83c0169c1b83b227c7 100644 (file)
@@ -48,7 +48,7 @@ gm20b_secboot_tegra_read_wpr(struct gm200_secboot *gsb, u32 mc_base)
        mc = ioremap(mc_base, 0xd00);
        if (!mc) {
                nvkm_error(&sb->subdev, "Cannot map Tegra MC registers\n");
-               return PTR_ERR(mc);
+               return -ENOMEM;
        }
        sb->wpr_addr = ioread32_native(mc + MC_SECURITY_CARVEOUT2_BOM_0) |
              ((u64)ioread32_native(mc + MC_SECURITY_CARVEOUT2_BOM_HI_0) << 32);