Skip to content

Commit

Permalink
drm/nouveau: store supported dma mask in vmmgr
Browse files Browse the repository at this point in the history
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
  • Loading branch information
Ben Skeggs committed Oct 3, 2012
1 parent c0abf5c commit dc73b45
Show file tree
Hide file tree
Showing 7 changed files with 9 additions and 7 deletions.
1 change: 1 addition & 0 deletions drivers/gpu/drm/nouveau/core/include/subdev/vm.h
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ struct nouveau_vmmgr {
struct nouveau_subdev base;

u64 limit;
u8 dma_bits;
u32 pgt_bits;
u8 spg_shift;
u8 lpg_shift;
Expand Down
1 change: 1 addition & 0 deletions drivers/gpu/drm/nouveau/core/subdev/vm/nv04.c
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ nv04_vmmgr_ctor(struct nouveau_object *parent, struct nouveau_object *engine,

priv->base.create = nv04_vm_create;
priv->base.limit = NV04_PDMA_SIZE;
priv->base.dma_bits = 32;
priv->base.pgt_bits = 32 - 12;
priv->base.spg_shift = 12;
priv->base.lpg_shift = 12;
Expand Down
1 change: 1 addition & 0 deletions drivers/gpu/drm/nouveau/core/subdev/vm/nv41.c
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ nv41_vmmgr_ctor(struct nouveau_object *parent, struct nouveau_object *engine,

priv->base.create = nv04_vm_create;
priv->base.limit = NV41_GART_SIZE;
priv->base.dma_bits = 39;
priv->base.pgt_bits = 32 - 12;
priv->base.spg_shift = 12;
priv->base.lpg_shift = 12;
Expand Down
1 change: 1 addition & 0 deletions drivers/gpu/drm/nouveau/core/subdev/vm/nv44.c
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,7 @@ nv44_vmmgr_ctor(struct nouveau_object *parent, struct nouveau_object *engine,

priv->base.create = nv04_vm_create;
priv->base.limit = NV44_GART_SIZE;
priv->base.dma_bits = 39;
priv->base.pgt_bits = 32 - 12;
priv->base.spg_shift = 12;
priv->base.lpg_shift = 12;
Expand Down
1 change: 1 addition & 0 deletions drivers/gpu/drm/nouveau/core/subdev/vm/nv50.c
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,7 @@ nv50_vmmgr_ctor(struct nouveau_object *parent, struct nouveau_object *engine,
return ret;

priv->base.limit = 1ULL << 40;
priv->base.dma_bits = 40;
priv->base.pgt_bits = 29 - 12;
priv->base.spg_shift = 12;
priv->base.lpg_shift = 16;
Expand Down
1 change: 1 addition & 0 deletions drivers/gpu/drm/nouveau/core/subdev/vm/nvc0.c
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,7 @@ nvc0_vmmgr_ctor(struct nouveau_object *parent, struct nouveau_object *engine,
return ret;

priv->base.limit = 1ULL << 40;
priv->base.dma_bits = 40;
priv->base.pgt_bits = 27 - 12;
priv->base.spg_shift = 12;
priv->base.lpg_shift = 17;
Expand Down
10 changes: 3 additions & 7 deletions drivers/gpu/drm/nouveau/nouveau_ttm.c
Original file line number Diff line number Diff line change
Expand Up @@ -340,14 +340,10 @@ nouveau_ttm_init(struct nouveau_drm *drm)
u32 bits;
int ret;

if (nv_device(drm->device)->card_type >= NV_50) {
if (pci_dma_supported(dev->pdev, DMA_BIT_MASK(40)))
bits = 40;
else
bits = 32;
} else {
bits = nouveau_vmmgr(drm->device)->dma_bits;
if ( drm->agp.stat == ENABLED ||
!pci_dma_supported(dev->pdev, DMA_BIT_MASK(bits)))
bits = 32;
}

ret = pci_set_dma_mask(dev->pdev, DMA_BIT_MASK(bits));
if (ret)
Expand Down

0 comments on commit dc73b45

Please sign in to comment.