Commit 485c2c91 authored by Ben Skeggs's avatar Ben Skeggs

drm/nouveau/bar/gf100: add config option to limit BAR2 to 16MiB

Useful for testing, and for the userspace build where we can't kick
a framebuffer driver off the device.
Signed-off-by: default avatarBen Skeggs <bskeggs@redhat.com>
parent 2659b4ce
...@@ -24,6 +24,7 @@ ...@@ -24,6 +24,7 @@
#include "gf100.h" #include "gf100.h"
#include <core/gpuobj.h> #include <core/gpuobj.h>
#include <core/option.h>
#include <subdev/fb.h> #include <subdev/fb.h>
#include <subdev/mmu.h> #include <subdev/mmu.h>
...@@ -59,6 +60,8 @@ gf100_bar_ctor_vm(struct gf100_bar *bar, struct gf100_bar_vm *bar_vm, ...@@ -59,6 +60,8 @@ gf100_bar_ctor_vm(struct gf100_bar *bar, struct gf100_bar_vm *bar_vm,
return ret; return ret;
bar_len = device->func->resource_size(device, bar_nr); bar_len = device->func->resource_size(device, bar_nr);
if (bar_nr == 3 && bar->bar2_halve)
bar_len >>= 1;
ret = nvkm_vm_new(device, 0, bar_len, 0, key, &vm); ret = nvkm_vm_new(device, 0, bar_len, 0, key, &vm);
if (ret) if (ret)
...@@ -129,6 +132,8 @@ gf100_bar_init(struct nvkm_bar *base) ...@@ -129,6 +132,8 @@ gf100_bar_init(struct nvkm_bar *base)
if (bar->bar[0].mem) { if (bar->bar[0].mem) {
addr = nvkm_memory_addr(bar->bar[0].mem) >> 12; addr = nvkm_memory_addr(bar->bar[0].mem) >> 12;
if (bar->bar2_halve)
addr |= 0x40000000;
nvkm_wr32(device, 0x001714, 0x80000000 | addr); nvkm_wr32(device, 0x001714, 0x80000000 | addr);
} }
...@@ -161,6 +166,7 @@ gf100_bar_new_(const struct nvkm_bar_func *func, struct nvkm_device *device, ...@@ -161,6 +166,7 @@ gf100_bar_new_(const struct nvkm_bar_func *func, struct nvkm_device *device,
if (!(bar = kzalloc(sizeof(*bar), GFP_KERNEL))) if (!(bar = kzalloc(sizeof(*bar), GFP_KERNEL)))
return -ENOMEM; return -ENOMEM;
nvkm_bar_ctor(func, device, index, &bar->base); nvkm_bar_ctor(func, device, index, &bar->base);
bar->bar2_halve = nvkm_boolopt(device->cfgopt, "NvBar2Halve", false);
*pbar = &bar->base; *pbar = &bar->base;
return 0; return 0;
} }
......
...@@ -11,6 +11,7 @@ struct gf100_bar_vm { ...@@ -11,6 +11,7 @@ struct gf100_bar_vm {
struct gf100_bar { struct gf100_bar {
struct nvkm_bar base; struct nvkm_bar base;
bool bar2_halve;
struct gf100_bar_vm bar[2]; struct gf100_bar_vm bar[2];
}; };
......
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