]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commitdiff
drm/nouveau/disp/nv50-: avoid creating ORs that aren't present on HW
authorBen Skeggs <bskeggs@redhat.com>
Sat, 17 Jun 2017 01:19:22 +0000 (11:19 +1000)
committerBen Skeggs <bskeggs@redhat.com>
Sat, 17 Jun 2017 01:23:44 +0000 (11:23 +1000)
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
14 files changed:
drivers/gpu/drm/nouveau/nvkm/engine/disp/dacgf119.c
drivers/gpu/drm/nouveau/nvkm/engine/disp/dacnv50.c
drivers/gpu/drm/nouveau/nvkm/engine/disp/ior.h
drivers/gpu/drm/nouveau/nvkm/engine/disp/piornv50.c
drivers/gpu/drm/nouveau/nvkm/engine/disp/sorg84.c
drivers/gpu/drm/nouveau/nvkm/engine/disp/sorg94.c
drivers/gpu/drm/nouveau/nvkm/engine/disp/sorgf119.c
drivers/gpu/drm/nouveau/nvkm/engine/disp/sorgk104.c
drivers/gpu/drm/nouveau/nvkm/engine/disp/sorgm107.c
drivers/gpu/drm/nouveau/nvkm/engine/disp/sorgm200.c
drivers/gpu/drm/nouveau/nvkm/engine/disp/sorgt215.c
drivers/gpu/drm/nouveau/nvkm/engine/disp/sormcp77.c
drivers/gpu/drm/nouveau/nvkm/engine/disp/sormcp89.c
drivers/gpu/drm/nouveau/nvkm/engine/disp/sornv50.c

index 8392303b77ed4e83a93050c63d8c19fdc216afc3..dbd032ef352ae6865b4f9edeaf098da534e03578 100644 (file)
@@ -58,5 +58,8 @@ gf119_dac = {
 int
 gf119_dac_new(struct nvkm_disp *disp, int id)
 {
+       struct nvkm_device *device = disp->engine.subdev.device;
+       if (!(nvkm_rd32(device, 0x612004) & (0x00000010 << id)))
+               return 0;
        return nvkm_ior_new_(&gf119_dac, disp, DAC, id);
 }
index 119cd02a2000202e93a7c1e92d74991cb1c148ae..85e692b122602956db896c85985a4cdf9fef16b3 100644 (file)
@@ -109,5 +109,8 @@ nv50_dac = {
 int
 nv50_dac_new(struct nvkm_disp *disp, int id)
 {
+       struct nvkm_device *device = disp->engine.subdev.device;
+       if (!(nvkm_rd32(device, 0x610184) & (0x00100000 << id)))
+               return 0;
        return nvkm_ior_new_(&nv50_dac, disp, DAC, id);
 }
index 1e11e25a41f1ae35b4c123995e2ccd5077acb869..a24312fb0228ff1f1053bca27f33c5702d2dc2ac 100644 (file)
@@ -104,6 +104,7 @@ nv50_sor_link(struct nvkm_ior *ior)
        return nv50_ior_base(ior) + ((ior->asy.link == 2) * 0x80);
 }
 
+int nv50_sor_new_(const struct nvkm_ior_func *, struct nvkm_disp *, int id);
 void nv50_sor_state(struct nvkm_ior *, struct nvkm_ior_state *);
 void nv50_sor_power(struct nvkm_ior *, bool, bool, bool, bool, bool);
 void nv50_sor_clock(struct nvkm_ior *);
@@ -119,6 +120,7 @@ void g94_sor_dp_watermark(struct nvkm_ior *, int, u8);
 
 void gt215_sor_dp_audio(struct nvkm_ior *, int, bool);
 
+int gf119_sor_new_(const struct nvkm_ior_func *, struct nvkm_disp *, int id);
 void gf119_sor_state(struct nvkm_ior *, struct nvkm_ior_state *);
 void gf119_sor_clock(struct nvkm_ior *);
 int gf119_sor_dp_links(struct nvkm_ior *, struct nvkm_i2c_aux *);
index a1f24ef222c13c1b7b3784487c77b29058c14420..99b3b9050635a808cca2a1cea4ab405918eb6be3 100644 (file)
@@ -127,5 +127,8 @@ nv50_pior = {
 int
 nv50_pior_new(struct nvkm_disp *disp, int id)
 {
+       struct nvkm_device *device = disp->engine.subdev.device;
+       if (!(nvkm_rd32(device, 0x610184) & (0x10000000 << id)))
+               return 0;
        return nvkm_ior_new_(&nv50_pior, disp, PIOR, id);
 }
index ec3a7db081188d6b46d206995ac08695d43af712..f40b909b4ca2dc9f97f894c6841b6bdf3cf76f88 100644 (file)
@@ -34,5 +34,5 @@ g84_sor = {
 int
 g84_sor_new(struct nvkm_disp *disp, int id)
 {
-       return nvkm_ior_new_(&g84_sor, disp, SOR, id);
+       return nv50_sor_new_(&g84_sor, disp, id);
 }
index 771a1abbdf15aa2d1bdf75d206ee318de5b2ce9c..49aeafde0031efbc6c4f1bb9c475d9530ad3618b 100644 (file)
@@ -279,5 +279,5 @@ g94_sor = {
 int
 g94_sor_new(struct nvkm_disp *disp, int id)
 {
-       return nvkm_ior_new_(&g94_sor, disp, SOR, id);
+       return nv50_sor_new_(&g94_sor, disp, id);
 }
index 5f8306b00f715c259538327b34837c726e4dadbc..a2978a37b4f3c72ef4e6f03b1fb7f2c0c7500478 100644 (file)
@@ -152,6 +152,15 @@ gf119_sor_state(struct nvkm_ior *sor, struct nvkm_ior_state *state)
        state->head = ctrl & 0x0000000f;
 }
 
+int
+gf119_sor_new_(const struct nvkm_ior_func *func, struct nvkm_disp *disp, int id)
+{
+       struct nvkm_device *device = disp->engine.subdev.device;
+       if (!(nvkm_rd32(device, 0x612004) & (0x00000100 << id)))
+               return 0;
+       return nvkm_ior_new_(func, disp, SOR, id);
+}
+
 static const struct nvkm_ior_func
 gf119_sor = {
        .state = gf119_sor_state,
@@ -179,5 +188,5 @@ gf119_sor = {
 int
 gf119_sor_new(struct nvkm_disp *disp, int id)
 {
-       return nvkm_ior_new_(&gf119_sor, disp, SOR, id);
+       return gf119_sor_new_(&gf119_sor, disp, id);
 }
index b94090edaebff2b7462499c18339790d01dbde91..a1547bdf490b865d846962abd4d5e5780c17254b 100644 (file)
@@ -49,5 +49,5 @@ gk104_sor = {
 int
 gk104_sor_new(struct nvkm_disp *disp, int id)
 {
-       return nvkm_ior_new_(&gk104_sor, disp, SOR, id);
+       return gf119_sor_new_(&gk104_sor, disp, id);
 }
index e6965dec09c968f6257649990c0eb78abec02b02..60230957d82bd224c6264961cb57fa4a179c832f 100644 (file)
@@ -63,5 +63,5 @@ gm107_sor = {
 int
 gm107_sor_new(struct nvkm_disp *disp, int id)
 {
-       return nvkm_ior_new_(&gm107_sor, disp, SOR, id);
+       return gf119_sor_new_(&gm107_sor, disp, id);
 }
index 8bc019b6ffabaedd67126d0d120e528bedeb65bb..f9b8107aa2a293a83397b3118c9ff47ba15a4260 100644 (file)
@@ -120,5 +120,5 @@ gm200_sor = {
 int
 gm200_sor_new(struct nvkm_disp *disp, int id)
 {
-       return nvkm_ior_new_(&gm200_sor, disp, SOR, id);
+       return gf119_sor_new_(&gm200_sor, disp, id);
 }
index 54d134d4ca1d129e8035006a192e1916545b2509..da228b54b43e40b2ba0e059772389d8b311e6fe7 100644 (file)
@@ -65,5 +65,5 @@ gt215_sor = {
 int
 gt215_sor_new(struct nvkm_disp *disp, int id)
 {
-       return nvkm_ior_new_(&gt215_sor, disp, SOR, id);
+       return nv50_sor_new_(&gt215_sor, disp, id);
 }
index 8a70dd25b13a9f1ddbeeb8de570dcd26579f43e0..c0179ccb956d19225b170039e3f9cc16b22abde4 100644 (file)
@@ -44,5 +44,5 @@ mcp77_sor = {
 int
 mcp77_sor_new(struct nvkm_disp *disp, int id)
 {
-       return nvkm_ior_new_(&mcp77_sor, disp, SOR, id);
+       return nv50_sor_new_(&mcp77_sor, disp, id);
 }
index eac9c5be9166dd7e41d1cb9cf7cb3440567a884c..9bb01cd96697123ce330adc9d310971b15cc8412 100644 (file)
@@ -49,5 +49,5 @@ mcp89_sor = {
 int
 mcp89_sor_new(struct nvkm_disp *disp, int id)
 {
-       return nvkm_ior_new_(&mcp89_sor, disp, SOR, id);
+       return nv50_sor_new_(&mcp89_sor, disp, id);
 }
index dbb303db3178253f595bda542d18f9e012d28c0b..f3ebd0c22e7d4569c4827a711ed26b6451cd12df 100644 (file)
@@ -84,6 +84,15 @@ nv50_sor_state(struct nvkm_ior *sor, struct nvkm_ior_state *state)
        state->head = ctrl & 0x00000003;
 }
 
+int
+nv50_sor_new_(const struct nvkm_ior_func *func, struct nvkm_disp *disp, int id)
+{
+       struct nvkm_device *device = disp->engine.subdev.device;
+       if (!(nvkm_rd32(device, 0x610184) & (0x01000000 << id)))
+               return 0;
+       return nvkm_ior_new_(func, disp, SOR, id);
+}
+
 static const struct nvkm_ior_func
 nv50_sor = {
        .state = nv50_sor_state,
@@ -94,5 +103,5 @@ nv50_sor = {
 int
 nv50_sor_new(struct nvkm_disp *disp, int id)
 {
-       return nvkm_ior_new_(&nv50_sor, disp, SOR, id);
+       return nv50_sor_new_(&nv50_sor, disp, id);
 }