Commit 2854ab8d authored by Ben Skeggs's avatar Ben Skeggs

drm/nouveau/fb: finalise big page size selection in constructor

MMU will need to know this during its constructor, so we can't delay
deciding this until init-time.
Signed-off-by: default avatarBen Skeggs <bskeggs@redhat.com>
parent 0b11b30d
...@@ -135,8 +135,13 @@ nvkm_fb_init(struct nvkm_subdev *subdev) ...@@ -135,8 +135,13 @@ nvkm_fb_init(struct nvkm_subdev *subdev)
if (fb->func->init) if (fb->func->init)
fb->func->init(fb); fb->func->init(fb);
if (fb->func->init_page)
fb->func->init_page(fb); if (fb->func->init_page) {
ret = fb->func->init_page(fb);
if (WARN_ON(ret))
return ret;
}
if (fb->func->init_unkn) if (fb->func->init_unkn)
fb->func->init_unkn(fb); fb->func->init_unkn(fb);
return 0; return 0;
...@@ -176,7 +181,8 @@ nvkm_fb_ctor(const struct nvkm_fb_func *func, struct nvkm_device *device, ...@@ -176,7 +181,8 @@ nvkm_fb_ctor(const struct nvkm_fb_func *func, struct nvkm_device *device,
nvkm_subdev_ctor(&nvkm_fb, device, index, &fb->subdev); nvkm_subdev_ctor(&nvkm_fb, device, index, &fb->subdev);
fb->func = func; fb->func = func;
fb->tile.regions = fb->func->tile.regions; fb->tile.regions = fb->func->tile.regions;
fb->page = nvkm_longopt(device->cfgopt, "NvFbBigPage", 0); fb->page = nvkm_longopt(device->cfgopt, "NvFbBigPage",
fb->func->default_bigpage);
} }
int int
......
...@@ -80,20 +80,17 @@ gf100_fb_oneinit(struct nvkm_fb *base) ...@@ -80,20 +80,17 @@ gf100_fb_oneinit(struct nvkm_fb *base)
return 0; return 0;
} }
void int
gf100_fb_init_page(struct nvkm_fb *fb) gf100_fb_init_page(struct nvkm_fb *fb)
{ {
struct nvkm_device *device = fb->subdev.device; struct nvkm_device *device = fb->subdev.device;
switch (fb->page) { switch (fb->page) {
case 16: case 16: nvkm_mask(device, 0x100c80, 0x00000001, 0x00000001); break;
nvkm_mask(device, 0x100c80, 0x00000001, 0x00000001); case 17: nvkm_mask(device, 0x100c80, 0x00000001, 0x00000000); break;
break;
case 17:
default: default:
nvkm_mask(device, 0x100c80, 0x00000001, 0x00000000); return -EINVAL;
fb->page = 17;
break;
} }
return 0;
} }
void void
...@@ -144,6 +141,7 @@ gf100_fb = { ...@@ -144,6 +141,7 @@ gf100_fb = {
.intr = gf100_fb_intr, .intr = gf100_fb_intr,
.ram_new = gf100_ram_new, .ram_new = gf100_ram_new,
.memtype_valid = gf100_fb_memtype_valid, .memtype_valid = gf100_fb_memtype_valid,
.default_bigpage = 17,
}; };
int int
......
...@@ -17,7 +17,5 @@ void gf100_fb_intr(struct nvkm_fb *); ...@@ -17,7 +17,5 @@ void gf100_fb_intr(struct nvkm_fb *);
void gp100_fb_init(struct nvkm_fb *); void gp100_fb_init(struct nvkm_fb *);
void gm200_fb_init_page(struct nvkm_fb *fb);
void gm200_fb_init(struct nvkm_fb *base); void gm200_fb_init(struct nvkm_fb *base);
#endif #endif
...@@ -33,6 +33,7 @@ gf108_fb = { ...@@ -33,6 +33,7 @@ gf108_fb = {
.intr = gf100_fb_intr, .intr = gf100_fb_intr,
.ram_new = gf108_ram_new, .ram_new = gf108_ram_new,
.memtype_valid = gf100_fb_memtype_valid, .memtype_valid = gf100_fb_memtype_valid,
.default_bigpage = 17,
}; };
int int
......
...@@ -33,6 +33,7 @@ gk104_fb = { ...@@ -33,6 +33,7 @@ gk104_fb = {
.intr = gf100_fb_intr, .intr = gf100_fb_intr,
.ram_new = gk104_ram_new, .ram_new = gk104_ram_new,
.memtype_valid = gf100_fb_memtype_valid, .memtype_valid = gf100_fb_memtype_valid,
.default_bigpage = 17,
}; };
int int
......
...@@ -31,6 +31,7 @@ gk20a_fb = { ...@@ -31,6 +31,7 @@ gk20a_fb = {
.init_page = gf100_fb_init_page, .init_page = gf100_fb_init_page,
.intr = gf100_fb_intr, .intr = gf100_fb_intr,
.memtype_valid = gf100_fb_memtype_valid, .memtype_valid = gf100_fb_memtype_valid,
.default_bigpage = 17,
}; };
int int
......
...@@ -33,6 +33,7 @@ gm107_fb = { ...@@ -33,6 +33,7 @@ gm107_fb = {
.intr = gf100_fb_intr, .intr = gf100_fb_intr,
.ram_new = gm107_ram_new, .ram_new = gm107_ram_new,
.memtype_valid = gf100_fb_memtype_valid, .memtype_valid = gf100_fb_memtype_valid,
.default_bigpage = 17,
}; };
int int
......
...@@ -26,22 +26,18 @@ ...@@ -26,22 +26,18 @@
#include <core/memory.h> #include <core/memory.h>
void int
gm200_fb_init_page(struct nvkm_fb *fb) gm200_fb_init_page(struct nvkm_fb *fb)
{ {
struct nvkm_device *device = fb->subdev.device; struct nvkm_device *device = fb->subdev.device;
switch (fb->page) { switch (fb->page) {
case 16: case 16: nvkm_mask(device, 0x100c80, 0x00000801, 0x00000001); break;
nvkm_mask(device, 0x100c80, 0x00000801, 0x00000001); case 17: nvkm_mask(device, 0x100c80, 0x00000801, 0x00000000); break;
break; case 0: nvkm_mask(device, 0x100c80, 0x00000800, 0x00000800); break;
case 17:
nvkm_mask(device, 0x100c80, 0x00000801, 0x00000000);
break;
default: default:
nvkm_mask(device, 0x100c80, 0x00000800, 0x00000800); return -EINVAL;
fb->page = 0;
break;
} }
return 0;
} }
void void
...@@ -70,6 +66,7 @@ gm200_fb = { ...@@ -70,6 +66,7 @@ gm200_fb = {
.intr = gf100_fb_intr, .intr = gf100_fb_intr,
.ram_new = gm200_ram_new, .ram_new = gm200_ram_new,
.memtype_valid = gf100_fb_memtype_valid, .memtype_valid = gf100_fb_memtype_valid,
.default_bigpage = 0 /* per-instance. */,
}; };
int int
......
...@@ -31,6 +31,7 @@ gm20b_fb = { ...@@ -31,6 +31,7 @@ gm20b_fb = {
.init_page = gm200_fb_init_page, .init_page = gm200_fb_init_page,
.intr = gf100_fb_intr, .intr = gf100_fb_intr,
.memtype_valid = gf100_fb_memtype_valid, .memtype_valid = gf100_fb_memtype_valid,
.default_bigpage = 0 /* per-instance. */,
}; };
int int
......
...@@ -8,7 +8,7 @@ struct nvkm_fb_func { ...@@ -8,7 +8,7 @@ struct nvkm_fb_func {
void *(*dtor)(struct nvkm_fb *); void *(*dtor)(struct nvkm_fb *);
int (*oneinit)(struct nvkm_fb *); int (*oneinit)(struct nvkm_fb *);
void (*init)(struct nvkm_fb *); void (*init)(struct nvkm_fb *);
void (*init_page)(struct nvkm_fb *); int (*init_page)(struct nvkm_fb *);
void (*init_unkn)(struct nvkm_fb *); void (*init_unkn)(struct nvkm_fb *);
void (*intr)(struct nvkm_fb *); void (*intr)(struct nvkm_fb *);
...@@ -25,6 +25,8 @@ struct nvkm_fb_func { ...@@ -25,6 +25,8 @@ struct nvkm_fb_func {
int (*ram_new)(struct nvkm_fb *, struct nvkm_ram **); int (*ram_new)(struct nvkm_fb *, struct nvkm_ram **);
bool (*memtype_valid)(struct nvkm_fb *, u32 memtype); bool (*memtype_valid)(struct nvkm_fb *, u32 memtype);
u8 default_bigpage;
}; };
void nvkm_fb_ctor(const struct nvkm_fb_func *, struct nvkm_device *device, void nvkm_fb_ctor(const struct nvkm_fb_func *, struct nvkm_device *device,
...@@ -62,8 +64,8 @@ void nv46_fb_tile_init(struct nvkm_fb *, int i, u32 addr, u32 size, ...@@ -62,8 +64,8 @@ void nv46_fb_tile_init(struct nvkm_fb *, int i, u32 addr, u32 size,
u32 pitch, u32 flags, struct nvkm_fb_tile *); u32 pitch, u32 flags, struct nvkm_fb_tile *);
int gf100_fb_oneinit(struct nvkm_fb *); int gf100_fb_oneinit(struct nvkm_fb *);
void gf100_fb_init_page(struct nvkm_fb *); int gf100_fb_init_page(struct nvkm_fb *);
bool gf100_fb_memtype_valid(struct nvkm_fb *, u32); bool gf100_fb_memtype_valid(struct nvkm_fb *, u32);
void gm200_fb_init_page(struct nvkm_fb *); int gm200_fb_init_page(struct nvkm_fb *);
#endif #endif
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment