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: Ben Skeggs <bskeggs@redhat.com>
This commit is contained in:
parent
0b11b30de9
commit
2854ab8dd8
@ -135,8 +135,13 @@ nvkm_fb_init(struct nvkm_subdev *subdev)
|
||||
|
||||
if (fb->func->init)
|
||||
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)
|
||||
fb->func->init_unkn(fb);
|
||||
return 0;
|
||||
@ -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);
|
||||
fb->func = func;
|
||||
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
|
||||
|
@ -80,20 +80,17 @@ gf100_fb_oneinit(struct nvkm_fb *base)
|
||||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
int
|
||||
gf100_fb_init_page(struct nvkm_fb *fb)
|
||||
{
|
||||
struct nvkm_device *device = fb->subdev.device;
|
||||
switch (fb->page) {
|
||||
case 16:
|
||||
nvkm_mask(device, 0x100c80, 0x00000001, 0x00000001);
|
||||
break;
|
||||
case 17:
|
||||
case 16: nvkm_mask(device, 0x100c80, 0x00000001, 0x00000001); break;
|
||||
case 17: nvkm_mask(device, 0x100c80, 0x00000001, 0x00000000); break;
|
||||
default:
|
||||
nvkm_mask(device, 0x100c80, 0x00000001, 0x00000000);
|
||||
fb->page = 17;
|
||||
break;
|
||||
return -EINVAL;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
@ -144,6 +141,7 @@ gf100_fb = {
|
||||
.intr = gf100_fb_intr,
|
||||
.ram_new = gf100_ram_new,
|
||||
.memtype_valid = gf100_fb_memtype_valid,
|
||||
.default_bigpage = 17,
|
||||
};
|
||||
|
||||
int
|
||||
|
@ -17,7 +17,5 @@ void gf100_fb_intr(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);
|
||||
|
||||
#endif
|
||||
|
@ -33,6 +33,7 @@ gf108_fb = {
|
||||
.intr = gf100_fb_intr,
|
||||
.ram_new = gf108_ram_new,
|
||||
.memtype_valid = gf100_fb_memtype_valid,
|
||||
.default_bigpage = 17,
|
||||
};
|
||||
|
||||
int
|
||||
|
@ -33,6 +33,7 @@ gk104_fb = {
|
||||
.intr = gf100_fb_intr,
|
||||
.ram_new = gk104_ram_new,
|
||||
.memtype_valid = gf100_fb_memtype_valid,
|
||||
.default_bigpage = 17,
|
||||
};
|
||||
|
||||
int
|
||||
|
@ -31,6 +31,7 @@ gk20a_fb = {
|
||||
.init_page = gf100_fb_init_page,
|
||||
.intr = gf100_fb_intr,
|
||||
.memtype_valid = gf100_fb_memtype_valid,
|
||||
.default_bigpage = 17,
|
||||
};
|
||||
|
||||
int
|
||||
|
@ -33,6 +33,7 @@ gm107_fb = {
|
||||
.intr = gf100_fb_intr,
|
||||
.ram_new = gm107_ram_new,
|
||||
.memtype_valid = gf100_fb_memtype_valid,
|
||||
.default_bigpage = 17,
|
||||
};
|
||||
|
||||
int
|
||||
|
@ -26,22 +26,18 @@
|
||||
|
||||
#include <core/memory.h>
|
||||
|
||||
void
|
||||
int
|
||||
gm200_fb_init_page(struct nvkm_fb *fb)
|
||||
{
|
||||
struct nvkm_device *device = fb->subdev.device;
|
||||
switch (fb->page) {
|
||||
case 16:
|
||||
nvkm_mask(device, 0x100c80, 0x00000801, 0x00000001);
|
||||
break;
|
||||
case 17:
|
||||
nvkm_mask(device, 0x100c80, 0x00000801, 0x00000000);
|
||||
break;
|
||||
case 16: nvkm_mask(device, 0x100c80, 0x00000801, 0x00000001); break;
|
||||
case 17: nvkm_mask(device, 0x100c80, 0x00000801, 0x00000000); break;
|
||||
case 0: nvkm_mask(device, 0x100c80, 0x00000800, 0x00000800); break;
|
||||
default:
|
||||
nvkm_mask(device, 0x100c80, 0x00000800, 0x00000800);
|
||||
fb->page = 0;
|
||||
break;
|
||||
return -EINVAL;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
@ -70,6 +66,7 @@ gm200_fb = {
|
||||
.intr = gf100_fb_intr,
|
||||
.ram_new = gm200_ram_new,
|
||||
.memtype_valid = gf100_fb_memtype_valid,
|
||||
.default_bigpage = 0 /* per-instance. */,
|
||||
};
|
||||
|
||||
int
|
||||
|
@ -31,6 +31,7 @@ gm20b_fb = {
|
||||
.init_page = gm200_fb_init_page,
|
||||
.intr = gf100_fb_intr,
|
||||
.memtype_valid = gf100_fb_memtype_valid,
|
||||
.default_bigpage = 0 /* per-instance. */,
|
||||
};
|
||||
|
||||
int
|
||||
|
@ -8,7 +8,7 @@ struct nvkm_fb_func {
|
||||
void *(*dtor)(struct nvkm_fb *);
|
||||
int (*oneinit)(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 (*intr)(struct nvkm_fb *);
|
||||
|
||||
@ -25,6 +25,8 @@ struct nvkm_fb_func {
|
||||
int (*ram_new)(struct nvkm_fb *, struct nvkm_ram **);
|
||||
|
||||
bool (*memtype_valid)(struct nvkm_fb *, u32 memtype);
|
||||
|
||||
u8 default_bigpage;
|
||||
};
|
||||
|
||||
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,
|
||||
u32 pitch, u32 flags, struct nvkm_fb_tile *);
|
||||
|
||||
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);
|
||||
|
||||
void gm200_fb_init_page(struct nvkm_fb *);
|
||||
int gm200_fb_init_page(struct nvkm_fb *);
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user