Commit 71e741ad authored by Ben Skeggs's avatar Ben Skeggs

drm/nouveau/svm: convert migrate_copy to new push macros

Signed-off-by: default avatarBen Skeggs <bskeggs@redhat.com>
Reviewed-by: default avatarLyude Paul <lyude@redhat.com>
parent fe4249af
...@@ -29,6 +29,7 @@ ...@@ -29,6 +29,7 @@
#include <nvif/class.h> #include <nvif/class.h>
#include <nvif/object.h> #include <nvif/object.h>
#include <nvif/push906f.h>
#include <nvif/if000c.h> #include <nvif/if000c.h>
#include <nvif/if500b.h> #include <nvif/if500b.h>
#include <nvif/if900b.h> #include <nvif/if900b.h>
...@@ -385,7 +386,7 @@ nvc0b5_migrate_copy(struct nouveau_drm *drm, u64 npages, ...@@ -385,7 +386,7 @@ nvc0b5_migrate_copy(struct nouveau_drm *drm, u64 npages,
enum nouveau_aper dst_aper, u64 dst_addr, enum nouveau_aper dst_aper, u64 dst_addr,
enum nouveau_aper src_aper, u64 src_addr) enum nouveau_aper src_aper, u64 src_addr)
{ {
struct nouveau_channel *chan = drm->dmem->migrate.chan; struct nvif_push *push = drm->dmem->migrate.chan->chan.push;
u32 launch_dma = (1 << 9) /* MULTI_LINE_ENABLE. */ | u32 launch_dma = (1 << 9) /* MULTI_LINE_ENABLE. */ |
(1 << 8) /* DST_MEMORY_LAYOUT_PITCH. */ | (1 << 8) /* DST_MEMORY_LAYOUT_PITCH. */ |
(1 << 7) /* SRC_MEMORY_LAYOUT_PITCH. */ | (1 << 7) /* SRC_MEMORY_LAYOUT_PITCH. */ |
...@@ -393,17 +394,17 @@ nvc0b5_migrate_copy(struct nouveau_drm *drm, u64 npages, ...@@ -393,17 +394,17 @@ nvc0b5_migrate_copy(struct nouveau_drm *drm, u64 npages,
(2 << 0) /* DATA_TRANSFER_TYPE_NON_PIPELINED. */; (2 << 0) /* DATA_TRANSFER_TYPE_NON_PIPELINED. */;
int ret; int ret;
ret = RING_SPACE(chan, 13); ret = PUSH_WAIT(push, 13);
if (ret) if (ret)
return ret; return ret;
if (src_aper != NOUVEAU_APER_VIRT) { if (src_aper != NOUVEAU_APER_VIRT) {
switch (src_aper) { switch (src_aper) {
case NOUVEAU_APER_VRAM: case NOUVEAU_APER_VRAM:
BEGIN_IMC0(chan, NvSubCopy, 0x0260, 0); PUSH_NVIM(push, NVA0B5, 0x0260, 0);
break; break;
case NOUVEAU_APER_HOST: case NOUVEAU_APER_HOST:
BEGIN_IMC0(chan, NvSubCopy, 0x0260, 1); PUSH_NVIM(push, NVA0B5, 0x0260, 1);
break; break;
default: default:
return -EINVAL; return -EINVAL;
...@@ -414,10 +415,10 @@ nvc0b5_migrate_copy(struct nouveau_drm *drm, u64 npages, ...@@ -414,10 +415,10 @@ nvc0b5_migrate_copy(struct nouveau_drm *drm, u64 npages,
if (dst_aper != NOUVEAU_APER_VIRT) { if (dst_aper != NOUVEAU_APER_VIRT) {
switch (dst_aper) { switch (dst_aper) {
case NOUVEAU_APER_VRAM: case NOUVEAU_APER_VRAM:
BEGIN_IMC0(chan, NvSubCopy, 0x0264, 0); PUSH_NVIM(push, NVA0B5, 0x0264, 0);
break; break;
case NOUVEAU_APER_HOST: case NOUVEAU_APER_HOST:
BEGIN_IMC0(chan, NvSubCopy, 0x0264, 1); PUSH_NVIM(push, NVA0B5, 0x0264, 1);
break; break;
default: default:
return -EINVAL; return -EINVAL;
...@@ -425,17 +426,15 @@ nvc0b5_migrate_copy(struct nouveau_drm *drm, u64 npages, ...@@ -425,17 +426,15 @@ nvc0b5_migrate_copy(struct nouveau_drm *drm, u64 npages,
launch_dma |= 0x00002000; /* DST_TYPE_PHYSICAL. */ launch_dma |= 0x00002000; /* DST_TYPE_PHYSICAL. */
} }
BEGIN_NVC0(chan, NvSubCopy, 0x0400, 8); PUSH_NVSQ(push, NVA0B5, 0x0400, upper_32_bits(src_addr),
OUT_RING (chan, upper_32_bits(src_addr)); 0x0404, lower_32_bits(src_addr),
OUT_RING (chan, lower_32_bits(src_addr)); 0x0408, upper_32_bits(dst_addr),
OUT_RING (chan, upper_32_bits(dst_addr)); 0x040c, lower_32_bits(dst_addr),
OUT_RING (chan, lower_32_bits(dst_addr)); 0x0410, PAGE_SIZE,
OUT_RING (chan, PAGE_SIZE); 0x0414, PAGE_SIZE,
OUT_RING (chan, PAGE_SIZE); 0x0418, PAGE_SIZE,
OUT_RING (chan, PAGE_SIZE); 0x041c, npages);
OUT_RING (chan, npages); PUSH_NVSQ(push, NVA0B5, 0x0300, launch_dma);
BEGIN_NVC0(chan, NvSubCopy, 0x0300, 1);
OUT_RING (chan, launch_dma);
return 0; return 0;
} }
......
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