Commit 658c71f4 authored by Ben Skeggs's avatar Ben Skeggs

drm/nouveau: fetch memory type indices that we care about for ttm

Signed-off-by: default avatarBen Skeggs <bskeggs@redhat.com>
parent 325a7282
...@@ -140,6 +140,9 @@ struct nouveau_drm { ...@@ -140,6 +140,9 @@ struct nouveau_drm {
struct nouveau_channel *chan; struct nouveau_channel *chan;
struct nvif_object copy; struct nvif_object copy;
int mtrr; int mtrr;
int type_vram;
int type_host;
int type_ncoh;
} ttm; } ttm;
/* GEM interface support */ /* GEM interface support */
......
...@@ -252,8 +252,36 @@ nouveau_ttm_init(struct nouveau_drm *drm) ...@@ -252,8 +252,36 @@ nouveau_ttm_init(struct nouveau_drm *drm)
{ {
struct nvkm_device *device = nvxx_device(&drm->client.device); struct nvkm_device *device = nvxx_device(&drm->client.device);
struct nvkm_pci *pci = device->pci; struct nvkm_pci *pci = device->pci;
struct nvif_mmu *mmu = &drm->client.mmu;
struct drm_device *dev = drm->dev; struct drm_device *dev = drm->dev;
int ret; int typei, ret;
typei = nvif_mmu_type(mmu, NVIF_MEM_HOST | NVIF_MEM_MAPPABLE |
NVIF_MEM_COHERENT);
if (typei < 0)
return -ENOSYS;
drm->ttm.type_host = typei;
typei = nvif_mmu_type(mmu, NVIF_MEM_HOST | NVIF_MEM_MAPPABLE);
if (typei < 0)
return -ENOSYS;
drm->ttm.type_ncoh = typei;
if (drm->client.device.info.platform != NV_DEVICE_INFO_V0_SOC &&
drm->client.device.info.family >= NV_DEVICE_INFO_V0_TESLA) {
typei = nvif_mmu_type(mmu, NVIF_MEM_VRAM | NVIF_MEM_MAPPABLE |
NVIF_MEM_KIND |
NVIF_MEM_COMP |
NVIF_MEM_DISP);
if (typei < 0)
return -ENOSYS;
drm->ttm.type_vram = typei;
} else {
drm->ttm.type_vram = -1;
}
if (pci && pci->agp.bridge) { if (pci && pci->agp.bridge) {
drm->agp.bridge = pci->agp.bridge; drm->agp.bridge = pci->agp.bridge;
......
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