Commit fd70b6cd authored by Francisco Jerez's avatar Francisco Jerez Committed by Ben Skeggs

drm/nv04-nv40: Fix up PCI(E) GART DMA object bus address calculation.

Signed-off-by: default avatarFrancisco Jerez <currojerez@riseup.net>
Signed-off-by: default avatarBen Skeggs <bskeggs@redhat.com>
parent 60d2a88a
...@@ -934,8 +934,8 @@ extern void nouveau_irq_uninstall(struct drm_device *); ...@@ -934,8 +934,8 @@ extern void nouveau_irq_uninstall(struct drm_device *);
/* nouveau_sgdma.c */ /* nouveau_sgdma.c */
extern int nouveau_sgdma_init(struct drm_device *); extern int nouveau_sgdma_init(struct drm_device *);
extern void nouveau_sgdma_takedown(struct drm_device *); extern void nouveau_sgdma_takedown(struct drm_device *);
extern int nouveau_sgdma_get_page(struct drm_device *, uint32_t offset, extern uint32_t nouveau_sgdma_get_physical(struct drm_device *,
uint32_t *page); uint32_t offset);
extern struct ttm_backend *nouveau_sgdma_init_ttm(struct drm_device *); extern struct ttm_backend *nouveau_sgdma_init_ttm(struct drm_device *);
/* nouveau_debugfs.c */ /* nouveau_debugfs.c */
......
...@@ -478,7 +478,7 @@ nouveau_gpuobj_dma_new(struct nouveau_channel *chan, int class, u64 base, ...@@ -478,7 +478,7 @@ nouveau_gpuobj_dma_new(struct nouveau_channel *chan, int class, u64 base,
struct drm_nouveau_private *dev_priv = chan->dev->dev_private; struct drm_nouveau_private *dev_priv = chan->dev->dev_private;
struct drm_device *dev = chan->dev; struct drm_device *dev = chan->dev;
struct nouveau_gpuobj *obj; struct nouveau_gpuobj *obj;
u32 page_addr, flags0, flags2; u32 flags0, flags2;
int ret; int ret;
if (dev_priv->card_type >= NV_50) { if (dev_priv->card_type >= NV_50) {
...@@ -495,12 +495,8 @@ nouveau_gpuobj_dma_new(struct nouveau_channel *chan, int class, u64 base, ...@@ -495,12 +495,8 @@ nouveau_gpuobj_dma_new(struct nouveau_channel *chan, int class, u64 base,
base += dev_priv->gart_info.aper_base; base += dev_priv->gart_info.aper_base;
} else } else
if (base != 0) { if (base != 0) {
ret = nouveau_sgdma_get_page(dev, base, &page_addr); base = nouveau_sgdma_get_physical(dev, base);
if (ret)
return ret;
target = NV_MEM_TARGET_PCI; target = NV_MEM_TARGET_PCI;
base = page_addr;
} else { } else {
nouveau_gpuobj_ref(dev_priv->gart_info.sg_ctxdma, pobj); nouveau_gpuobj_ref(dev_priv->gart_info.sg_ctxdma, pobj);
return 0; return 0;
......
...@@ -267,19 +267,15 @@ nouveau_sgdma_takedown(struct drm_device *dev) ...@@ -267,19 +267,15 @@ nouveau_sgdma_takedown(struct drm_device *dev)
nouveau_vm_put(&dev_priv->gart_info.vma); nouveau_vm_put(&dev_priv->gart_info.vma);
} }
int uint32_t
nouveau_sgdma_get_page(struct drm_device *dev, uint32_t offset, uint32_t *page) nouveau_sgdma_get_physical(struct drm_device *dev, uint32_t offset)
{ {
struct drm_nouveau_private *dev_priv = dev->dev_private; struct drm_nouveau_private *dev_priv = dev->dev_private;
struct nouveau_gpuobj *gpuobj = dev_priv->gart_info.sg_ctxdma; struct nouveau_gpuobj *gpuobj = dev_priv->gart_info.sg_ctxdma;
int pte; int pte = (offset >> NV_CTXDMA_PAGE_SHIFT) + 2;
pte = (offset >> NV_CTXDMA_PAGE_SHIFT) << 2; BUG_ON(dev_priv->card_type >= NV_50);
if (dev_priv->card_type < NV_50) {
*page = nv_ro32(gpuobj, (pte + 8)) & ~NV_CTXDMA_PAGE_MASK;
return 0;
}
NV_ERROR(dev, "Unimplemented on NV50\n"); return (nv_ro32(gpuobj, 4 * pte) & ~NV_CTXDMA_PAGE_MASK) |
return -EINVAL; (offset & NV_CTXDMA_PAGE_MASK);
} }
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