OSDN Git Service

drm/nouveau/gr/gm200: load external firmware and bundles
authorAlexandre Courbot <acourbot@nvidia.com>
Wed, 24 Feb 2016 05:42:19 +0000 (14:42 +0900)
committerBen Skeggs <bskeggs@redhat.com>
Mon, 14 Mar 2016 00:13:21 +0000 (10:13 +1000)
Load firmware and bundles in GM200's constructor. The previously called
GF100 function did not care about the bundles.

Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
drivers/gpu/drm/nouveau/nvkm/engine/gr/gf100.h
drivers/gpu/drm/nouveau/nvkm/engine/gr/gk20a.c
drivers/gpu/drm/nouveau/nvkm/engine/gr/gm200.c
drivers/gpu/drm/nouveau/nvkm/engine/gr/gm206.c
drivers/gpu/drm/nouveau/nvkm/engine/gr/gm20b.c

index ea8d283..5626cae 100644 (file)
@@ -138,8 +138,6 @@ int gf100_gr_init(struct gf100_gr *);
 
 int gk104_gr_init(struct gf100_gr *);
 
-int gk20a_gr_new_(const struct gf100_gr_func *, struct nvkm_device *,
-                 int, struct nvkm_gr **);
 int gk20a_gr_init(struct gf100_gr *);
 
 int gm200_gr_init(struct gf100_gr *);
@@ -211,6 +209,9 @@ int gk20a_gr_aiv_to_init(struct gf100_gr *, const char *,
 int gk20a_gr_av_to_method(struct gf100_gr *, const char *,
                          struct gf100_gr_pack **);
 
+int gm200_gr_new_(const struct gf100_gr_func *, struct nvkm_device *, int,
+                 struct nvkm_gr **);
+
 /* register init value lists */
 
 extern const struct gf100_gr_init gf100_gr_init_main_0[];
index 297a4d2..7ffb8a6 100644 (file)
@@ -309,9 +309,23 @@ gk20a_gr_init(struct gf100_gr *gr)
        return gf100_gr_init_ctxctl(gr);
 }
 
+static const struct gf100_gr_func
+gk20a_gr = {
+       .init = gk20a_gr_init,
+       .set_hww_esr_report_mask = gk20a_gr_set_hww_esr_report_mask,
+       .ppc_nr = 1,
+       .grctx = &gk20a_grctx,
+       .sclass = {
+               { -1, -1, FERMI_TWOD_A },
+               { -1, -1, KEPLER_INLINE_TO_MEMORY_A },
+               { -1, -1, KEPLER_C, &gf100_fermi },
+               { -1, -1, KEPLER_COMPUTE_A },
+               {}
+       }
+};
+
 int
-gk20a_gr_new_(const struct gf100_gr_func *func, struct nvkm_device *device,
-             int index, struct nvkm_gr **pgr)
+gk20a_gr_new(struct nvkm_device *device, int index, struct nvkm_gr **pgr)
 {
        struct gf100_gr *gr;
        int ret;
@@ -320,7 +334,7 @@ gk20a_gr_new_(const struct gf100_gr_func *func, struct nvkm_device *device,
                return -ENOMEM;
        *pgr = &gr->base;
 
-       ret = gf100_gr_ctor(func, device, index, gr);
+       ret = gf100_gr_ctor(&gk20a_gr, device, index, gr);
        if (ret)
                return ret;
 
@@ -349,24 +363,3 @@ gk20a_gr_new_(const struct gf100_gr_func *func, struct nvkm_device *device,
 
        return 0;
 }
-
-static const struct gf100_gr_func
-gk20a_gr = {
-       .init = gk20a_gr_init,
-       .set_hww_esr_report_mask = gk20a_gr_set_hww_esr_report_mask,
-       .ppc_nr = 1,
-       .grctx = &gk20a_grctx,
-       .sclass = {
-               { -1, -1, FERMI_TWOD_A },
-               { -1, -1, KEPLER_INLINE_TO_MEMORY_A },
-               { -1, -1, KEPLER_C, &gf100_fermi },
-               { -1, -1, KEPLER_COMPUTE_A },
-               {}
-       }
-};
-
-int
-gk20a_gr_new(struct nvkm_device *device, int index, struct nvkm_gr **pgr)
-{
-       return gk20a_gr_new_(&gk20a_gr, device, index, pgr);
-}
index c76dc67..24c0c45 100644 (file)
@@ -351,6 +351,37 @@ gm200_gr_init(struct gf100_gr *gr)
        return gm200_gr_init_ctxctl(gr);
 }
 
+int
+gm200_gr_new_(const struct gf100_gr_func *func, struct nvkm_device *device,
+             int index, struct nvkm_gr **pgr)
+{
+       struct gf100_gr *gr;
+       int ret;
+
+       if (!(gr = kzalloc(sizeof(*gr), GFP_KERNEL)))
+               return -ENOMEM;
+       *pgr = &gr->base;
+
+       ret = gf100_gr_ctor(func, device, index, gr);
+       if (ret)
+               return ret;
+
+       if ((ret = gf100_gr_ctor_fw(gr, "gr/fecs_inst", &gr->fuc409c)) ||
+           (ret = gf100_gr_ctor_fw(gr, "gr/fecs_data", &gr->fuc409d)))
+               return ret;
+       if ((ret = gf100_gr_ctor_fw(gr, "gr/gpccs_inst", &gr->fuc41ac)) ||
+           (ret = gf100_gr_ctor_fw(gr, "gr/gpccs_data", &gr->fuc41ad)))
+               return ret;
+
+       if ((ret = gk20a_gr_av_to_init(gr, "gr/sw_nonctx", &gr->fuc_sw_nonctx)) ||
+           (ret = gk20a_gr_aiv_to_init(gr, "gr/sw_ctx", &gr->fuc_sw_ctx)) ||
+           (ret = gk20a_gr_av_to_init(gr, "gr/sw_bundle_init", &gr->fuc_bundle)) ||
+           (ret = gk20a_gr_av_to_method(gr, "gr/sw_method_init", &gr->fuc_method)))
+               return ret;
+
+       return 0;
+}
+
 static const struct gf100_gr_func
 gm200_gr = {
        .init = gm200_gr_init,
@@ -369,5 +400,5 @@ gm200_gr = {
 int
 gm200_gr_new(struct nvkm_device *device, int index, struct nvkm_gr **pgr)
 {
-       return gf100_gr_new_(&gm200_gr, device, index, pgr);
+       return gm200_gr_new_(&gm200_gr, device, index, pgr);
 }
index 398e3f5..74c4f73 100644 (file)
@@ -44,5 +44,5 @@ gm206_gr = {
 int
 gm206_gr_new(struct nvkm_device *device, int index, struct nvkm_gr **pgr)
 {
-       return gf100_gr_new_(&gm206_gr, device, index, pgr);
+       return gm200_gr_new_(&gm206_gr, device, index, pgr);
 }
index 443922e..a440772 100644 (file)
@@ -78,5 +78,5 @@ gm20b_gr = {
 int
 gm20b_gr_new(struct nvkm_device *device, int index, struct nvkm_gr **pgr)
 {
-       return gk20a_gr_new_(&gm20b_gr, device, index, pgr);
+       return gm200_gr_new_(&gm20b_gr, device, index, pgr);
 }