Commit b88aefc5 authored by Dave Airlie's avatar Dave Airlie

Merge branch 'linux-5.14' of git://github.com/skeggsb/linux into drm-fixes

- Ampere display fixes
- Fix longstanding MM race issue by removing unused code.
Signed-off-by: default avatarDave Airlie <airlied@redhat.com>
From: Ben Skeggs <skeggsb@gmail.com>
Link: https://patchwork.freedesktop.org/patch/msgid/CACAvsv5jtUFkHsGe-pf-=RceDOgKygjPnCi=6d5vCLM_f5aeMQ@mail.gmail.com
parents e213bd1e 59f216cf
...@@ -2237,6 +2237,33 @@ nv50_disp_atomic_commit_tail(struct drm_atomic_state *state) ...@@ -2237,6 +2237,33 @@ nv50_disp_atomic_commit_tail(struct drm_atomic_state *state)
interlock[NV50_DISP_INTERLOCK_CORE] = 0; interlock[NV50_DISP_INTERLOCK_CORE] = 0;
} }
/* Finish updating head(s)...
*
* NVD is rather picky about both where window assignments can change,
* *and* about certain core and window channel states matching.
*
* The EFI GOP driver on newer GPUs configures window channels with a
* different output format to what we do, and the core channel update
* in the assign_windows case above would result in a state mismatch.
*
* Delay some of the head update until after that point to workaround
* the issue. This only affects the initial modeset.
*
* TODO: handle this better when adding flexible window mapping
*/
for_each_oldnew_crtc_in_state(state, crtc, old_crtc_state, new_crtc_state, i) {
struct nv50_head_atom *asyh = nv50_head_atom(new_crtc_state);
struct nv50_head *head = nv50_head(crtc);
NV_ATOMIC(drm, "%s: set %04x (clr %04x)\n", crtc->name,
asyh->set.mask, asyh->clr.mask);
if (asyh->set.mask) {
nv50_head_flush_set_wndw(head, asyh);
interlock[NV50_DISP_INTERLOCK_CORE] = 1;
}
}
/* Update plane(s). */ /* Update plane(s). */
for_each_new_plane_in_state(state, plane, new_plane_state, i) { for_each_new_plane_in_state(state, plane, new_plane_state, i) {
struct nv50_wndw_atom *asyw = nv50_wndw_atom(new_plane_state); struct nv50_wndw_atom *asyw = nv50_wndw_atom(new_plane_state);
......
...@@ -50,11 +50,8 @@ nv50_head_flush_clr(struct nv50_head *head, ...@@ -50,11 +50,8 @@ nv50_head_flush_clr(struct nv50_head *head,
} }
void void
nv50_head_flush_set(struct nv50_head *head, struct nv50_head_atom *asyh) nv50_head_flush_set_wndw(struct nv50_head *head, struct nv50_head_atom *asyh)
{ {
if (asyh->set.view ) head->func->view (head, asyh);
if (asyh->set.mode ) head->func->mode (head, asyh);
if (asyh->set.core ) head->func->core_set(head, asyh);
if (asyh->set.olut ) { if (asyh->set.olut ) {
asyh->olut.offset = nv50_lut_load(&head->olut, asyh->olut.offset = nv50_lut_load(&head->olut,
asyh->olut.buffer, asyh->olut.buffer,
...@@ -62,6 +59,14 @@ nv50_head_flush_set(struct nv50_head *head, struct nv50_head_atom *asyh) ...@@ -62,6 +59,14 @@ nv50_head_flush_set(struct nv50_head *head, struct nv50_head_atom *asyh)
asyh->olut.load); asyh->olut.load);
head->func->olut_set(head, asyh); head->func->olut_set(head, asyh);
} }
}
void
nv50_head_flush_set(struct nv50_head *head, struct nv50_head_atom *asyh)
{
if (asyh->set.view ) head->func->view (head, asyh);
if (asyh->set.mode ) head->func->mode (head, asyh);
if (asyh->set.core ) head->func->core_set(head, asyh);
if (asyh->set.curs ) head->func->curs_set(head, asyh); if (asyh->set.curs ) head->func->curs_set(head, asyh);
if (asyh->set.base ) head->func->base (head, asyh); if (asyh->set.base ) head->func->base (head, asyh);
if (asyh->set.ovly ) head->func->ovly (head, asyh); if (asyh->set.ovly ) head->func->ovly (head, asyh);
......
...@@ -21,6 +21,7 @@ struct nv50_head { ...@@ -21,6 +21,7 @@ struct nv50_head {
struct nv50_head *nv50_head_create(struct drm_device *, int index); struct nv50_head *nv50_head_create(struct drm_device *, int index);
void nv50_head_flush_set(struct nv50_head *head, struct nv50_head_atom *asyh); void nv50_head_flush_set(struct nv50_head *head, struct nv50_head_atom *asyh);
void nv50_head_flush_set_wndw(struct nv50_head *head, struct nv50_head_atom *asyh);
void nv50_head_flush_clr(struct nv50_head *head, void nv50_head_flush_clr(struct nv50_head *head,
struct nv50_head_atom *asyh, bool flush); struct nv50_head_atom *asyh, bool flush);
......
...@@ -4,7 +4,8 @@ ...@@ -4,7 +4,8 @@
struct nv_device_v0 { struct nv_device_v0 {
__u8 version; __u8 version;
__u8 pad01[7]; __u8 priv;
__u8 pad02[6];
__u64 device; /* device identifier, ~0 for client default */ __u64 device; /* device identifier, ~0 for client default */
}; };
......
...@@ -61,8 +61,6 @@ ...@@ -61,8 +61,6 @@
#define NV10_CHANNEL_DMA /* cl506b.h */ 0x0000006e #define NV10_CHANNEL_DMA /* cl506b.h */ 0x0000006e
#define NV17_CHANNEL_DMA /* cl506b.h */ 0x0000176e #define NV17_CHANNEL_DMA /* cl506b.h */ 0x0000176e
#define NV40_CHANNEL_DMA /* cl506b.h */ 0x0000406e #define NV40_CHANNEL_DMA /* cl506b.h */ 0x0000406e
#define NV50_CHANNEL_DMA /* cl506e.h */ 0x0000506e
#define G82_CHANNEL_DMA /* cl826e.h */ 0x0000826e
#define NV50_CHANNEL_GPFIFO /* cl506f.h */ 0x0000506f #define NV50_CHANNEL_GPFIFO /* cl506f.h */ 0x0000506f
#define G82_CHANNEL_GPFIFO /* cl826f.h */ 0x0000826f #define G82_CHANNEL_GPFIFO /* cl826f.h */ 0x0000826f
......
...@@ -9,7 +9,6 @@ struct nvif_client { ...@@ -9,7 +9,6 @@ struct nvif_client {
const struct nvif_driver *driver; const struct nvif_driver *driver;
u64 version; u64 version;
u8 route; u8 route;
bool super;
}; };
int nvif_client_ctor(struct nvif_client *parent, const char *name, u64 device, int nvif_client_ctor(struct nvif_client *parent, const char *name, u64 device,
......
...@@ -11,7 +11,7 @@ struct nvif_driver { ...@@ -11,7 +11,7 @@ struct nvif_driver {
void (*fini)(void *priv); void (*fini)(void *priv);
int (*suspend)(void *priv); int (*suspend)(void *priv);
int (*resume)(void *priv); int (*resume)(void *priv);
int (*ioctl)(void *priv, bool super, void *data, u32 size, void **hack); int (*ioctl)(void *priv, void *data, u32 size, void **hack);
void __iomem *(*map)(void *priv, u64 handle, u32 size); void __iomem *(*map)(void *priv, u64 handle, u32 size);
void (*unmap)(void *priv, void __iomem *ptr, u32 size); void (*unmap)(void *priv, void __iomem *ptr, u32 size);
bool keep; bool keep;
......
...@@ -13,7 +13,6 @@ struct nvkm_client { ...@@ -13,7 +13,6 @@ struct nvkm_client {
struct nvkm_client_notify *notify[32]; struct nvkm_client_notify *notify[32];
struct rb_root objroot; struct rb_root objroot;
bool super;
void *data; void *data;
int (*ntfy)(const void *, u32, const void *, u32); int (*ntfy)(const void *, u32, const void *, u32);
......
...@@ -4,5 +4,5 @@ ...@@ -4,5 +4,5 @@
#include <core/os.h> #include <core/os.h>
struct nvkm_client; struct nvkm_client;
int nvkm_ioctl(struct nvkm_client *, bool, void *, u32, void **); int nvkm_ioctl(struct nvkm_client *, void *, u32, void **);
#endif #endif
...@@ -15,7 +15,6 @@ struct nvkm_vma { ...@@ -15,7 +15,6 @@ struct nvkm_vma {
u8 refd:3; /* Current page type (index, or NONE for unreferenced). */ u8 refd:3; /* Current page type (index, or NONE for unreferenced). */
bool used:1; /* Region allocated. */ bool used:1; /* Region allocated. */
bool part:1; /* Region was split from an allocated region by map(). */ bool part:1; /* Region was split from an allocated region by map(). */
bool user:1; /* Region user-allocated. */
bool busy:1; /* Region busy (for temporarily preventing user access). */ bool busy:1; /* Region busy (for temporarily preventing user access). */
bool mapped:1; /* Region contains valid pages. */ bool mapped:1; /* Region contains valid pages. */
struct nvkm_memory *memory; /* Memory currently mapped into VMA. */ struct nvkm_memory *memory; /* Memory currently mapped into VMA. */
......
...@@ -570,11 +570,9 @@ nouveau_abi16_ioctl_notifierobj_alloc(ABI16_IOCTL_ARGS) ...@@ -570,11 +570,9 @@ nouveau_abi16_ioctl_notifierobj_alloc(ABI16_IOCTL_ARGS)
} }
client->route = NVDRM_OBJECT_ABI16; client->route = NVDRM_OBJECT_ABI16;
client->super = true;
ret = nvif_object_ctor(&chan->chan->user, "abi16Ntfy", info->handle, ret = nvif_object_ctor(&chan->chan->user, "abi16Ntfy", info->handle,
NV_DMA_IN_MEMORY, &args, sizeof(args), NV_DMA_IN_MEMORY, &args, sizeof(args),
&ntfy->object); &ntfy->object);
client->super = false;
client->route = NVDRM_OBJECT_NVIF; client->route = NVDRM_OBJECT_NVIF;
if (ret) if (ret)
goto done; goto done;
......
...@@ -86,12 +86,6 @@ nouveau_channel_del(struct nouveau_channel **pchan) ...@@ -86,12 +86,6 @@ nouveau_channel_del(struct nouveau_channel **pchan)
struct nouveau_channel *chan = *pchan; struct nouveau_channel *chan = *pchan;
if (chan) { if (chan) {
struct nouveau_cli *cli = (void *)chan->user.client; struct nouveau_cli *cli = (void *)chan->user.client;
bool super;
if (cli) {
super = cli->base.super;
cli->base.super = true;
}
if (chan->fence) if (chan->fence)
nouveau_fence(chan->drm)->context_del(chan); nouveau_fence(chan->drm)->context_del(chan);
...@@ -111,9 +105,6 @@ nouveau_channel_del(struct nouveau_channel **pchan) ...@@ -111,9 +105,6 @@ nouveau_channel_del(struct nouveau_channel **pchan)
nouveau_bo_unpin(chan->push.buffer); nouveau_bo_unpin(chan->push.buffer);
nouveau_bo_ref(NULL, &chan->push.buffer); nouveau_bo_ref(NULL, &chan->push.buffer);
kfree(chan); kfree(chan);
if (cli)
cli->base.super = super;
} }
*pchan = NULL; *pchan = NULL;
} }
...@@ -512,20 +503,16 @@ nouveau_channel_new(struct nouveau_drm *drm, struct nvif_device *device, ...@@ -512,20 +503,16 @@ nouveau_channel_new(struct nouveau_drm *drm, struct nvif_device *device,
struct nouveau_channel **pchan) struct nouveau_channel **pchan)
{ {
struct nouveau_cli *cli = (void *)device->object.client; struct nouveau_cli *cli = (void *)device->object.client;
bool super;
int ret; int ret;
/* hack until fencenv50 is fixed, and agp access relaxed */ /* hack until fencenv50 is fixed, and agp access relaxed */
super = cli->base.super;
cli->base.super = true;
ret = nouveau_channel_ind(drm, device, arg0, priv, pchan); ret = nouveau_channel_ind(drm, device, arg0, priv, pchan);
if (ret) { if (ret) {
NV_PRINTK(dbg, cli, "ib channel create, %d\n", ret); NV_PRINTK(dbg, cli, "ib channel create, %d\n", ret);
ret = nouveau_channel_dma(drm, device, pchan); ret = nouveau_channel_dma(drm, device, pchan);
if (ret) { if (ret) {
NV_PRINTK(dbg, cli, "dma channel create, %d\n", ret); NV_PRINTK(dbg, cli, "dma channel create, %d\n", ret);
goto done; return ret;
} }
} }
...@@ -533,15 +520,13 @@ nouveau_channel_new(struct nouveau_drm *drm, struct nvif_device *device, ...@@ -533,15 +520,13 @@ nouveau_channel_new(struct nouveau_drm *drm, struct nvif_device *device,
if (ret) { if (ret) {
NV_PRINTK(err, cli, "channel failed to initialise, %d\n", ret); NV_PRINTK(err, cli, "channel failed to initialise, %d\n", ret);
nouveau_channel_del(pchan); nouveau_channel_del(pchan);
goto done; return ret;
} }
ret = nouveau_svmm_join((*pchan)->vmm->svmm, (*pchan)->inst); ret = nouveau_svmm_join((*pchan)->vmm->svmm, (*pchan)->inst);
if (ret) if (ret)
nouveau_channel_del(pchan); nouveau_channel_del(pchan);
done:
cli->base.super = super;
return ret; return ret;
} }
......
...@@ -244,6 +244,7 @@ nouveau_cli_init(struct nouveau_drm *drm, const char *sname, ...@@ -244,6 +244,7 @@ nouveau_cli_init(struct nouveau_drm *drm, const char *sname,
ret = nvif_device_ctor(&cli->base.object, "drmDevice", 0, NV_DEVICE, ret = nvif_device_ctor(&cli->base.object, "drmDevice", 0, NV_DEVICE,
&(struct nv_device_v0) { &(struct nv_device_v0) {
.device = ~0, .device = ~0,
.priv = true,
}, sizeof(struct nv_device_v0), }, sizeof(struct nv_device_v0),
&cli->device); &cli->device);
if (ret) { if (ret) {
...@@ -1086,8 +1087,6 @@ nouveau_drm_open(struct drm_device *dev, struct drm_file *fpriv) ...@@ -1086,8 +1087,6 @@ nouveau_drm_open(struct drm_device *dev, struct drm_file *fpriv)
if (ret) if (ret)
goto done; goto done;
cli->base.super = false;
fpriv->driver_priv = cli; fpriv->driver_priv = cli;
mutex_lock(&drm->client.mutex); mutex_lock(&drm->client.mutex);
......
...@@ -41,8 +41,6 @@ nouveau_mem_map(struct nouveau_mem *mem, ...@@ -41,8 +41,6 @@ nouveau_mem_map(struct nouveau_mem *mem,
struct gf100_vmm_map_v0 gf100; struct gf100_vmm_map_v0 gf100;
} args; } args;
u32 argc = 0; u32 argc = 0;
bool super;
int ret;
switch (vmm->object.oclass) { switch (vmm->object.oclass) {
case NVIF_CLASS_VMM_NV04: case NVIF_CLASS_VMM_NV04:
...@@ -73,12 +71,7 @@ nouveau_mem_map(struct nouveau_mem *mem, ...@@ -73,12 +71,7 @@ nouveau_mem_map(struct nouveau_mem *mem,
return -ENOSYS; return -ENOSYS;
} }
super = vmm->object.client->super; return nvif_vmm_map(vmm, vma->addr, mem->mem.size, &args, argc, &mem->mem, 0);
vmm->object.client->super = true;
ret = nvif_vmm_map(vmm, vma->addr, mem->mem.size, &args, argc,
&mem->mem, 0);
vmm->object.client->super = super;
return ret;
} }
void void
...@@ -99,7 +92,6 @@ nouveau_mem_host(struct ttm_resource *reg, struct ttm_tt *tt) ...@@ -99,7 +92,6 @@ nouveau_mem_host(struct ttm_resource *reg, struct ttm_tt *tt)
struct nouveau_drm *drm = cli->drm; struct nouveau_drm *drm = cli->drm;
struct nvif_mmu *mmu = &cli->mmu; struct nvif_mmu *mmu = &cli->mmu;
struct nvif_mem_ram_v0 args = {}; struct nvif_mem_ram_v0 args = {};
bool super = cli->base.super;
u8 type; u8 type;
int ret; int ret;
...@@ -122,11 +114,9 @@ nouveau_mem_host(struct ttm_resource *reg, struct ttm_tt *tt) ...@@ -122,11 +114,9 @@ nouveau_mem_host(struct ttm_resource *reg, struct ttm_tt *tt)
args.dma = tt->dma_address; args.dma = tt->dma_address;
mutex_lock(&drm->master.lock); mutex_lock(&drm->master.lock);
cli->base.super = true;
ret = nvif_mem_ctor_type(mmu, "ttmHostMem", cli->mem->oclass, type, PAGE_SHIFT, ret = nvif_mem_ctor_type(mmu, "ttmHostMem", cli->mem->oclass, type, PAGE_SHIFT,
reg->num_pages << PAGE_SHIFT, reg->num_pages << PAGE_SHIFT,
&args, sizeof(args), &mem->mem); &args, sizeof(args), &mem->mem);
cli->base.super = super;
mutex_unlock(&drm->master.lock); mutex_unlock(&drm->master.lock);
return ret; return ret;
} }
...@@ -138,12 +128,10 @@ nouveau_mem_vram(struct ttm_resource *reg, bool contig, u8 page) ...@@ -138,12 +128,10 @@ nouveau_mem_vram(struct ttm_resource *reg, bool contig, u8 page)
struct nouveau_cli *cli = mem->cli; struct nouveau_cli *cli = mem->cli;
struct nouveau_drm *drm = cli->drm; struct nouveau_drm *drm = cli->drm;
struct nvif_mmu *mmu = &cli->mmu; struct nvif_mmu *mmu = &cli->mmu;
bool super = cli->base.super;
u64 size = ALIGN(reg->num_pages << PAGE_SHIFT, 1 << page); u64 size = ALIGN(reg->num_pages << PAGE_SHIFT, 1 << page);
int ret; int ret;
mutex_lock(&drm->master.lock); mutex_lock(&drm->master.lock);
cli->base.super = true;
switch (cli->mem->oclass) { switch (cli->mem->oclass) {
case NVIF_CLASS_MEM_GF100: case NVIF_CLASS_MEM_GF100:
ret = nvif_mem_ctor_type(mmu, "ttmVram", cli->mem->oclass, ret = nvif_mem_ctor_type(mmu, "ttmVram", cli->mem->oclass,
...@@ -167,7 +155,6 @@ nouveau_mem_vram(struct ttm_resource *reg, bool contig, u8 page) ...@@ -167,7 +155,6 @@ nouveau_mem_vram(struct ttm_resource *reg, bool contig, u8 page)
WARN_ON(1); WARN_ON(1);
break; break;
} }
cli->base.super = super;
mutex_unlock(&drm->master.lock); mutex_unlock(&drm->master.lock);
reg->start = mem->mem.addr >> PAGE_SHIFT; reg->start = mem->mem.addr >> PAGE_SHIFT;
......
...@@ -52,9 +52,9 @@ nvkm_client_map(void *priv, u64 handle, u32 size) ...@@ -52,9 +52,9 @@ nvkm_client_map(void *priv, u64 handle, u32 size)
} }
static int static int
nvkm_client_ioctl(void *priv, bool super, void *data, u32 size, void **hack) nvkm_client_ioctl(void *priv, void *data, u32 size, void **hack)
{ {
return nvkm_ioctl(priv, super, data, size, hack); return nvkm_ioctl(priv, data, size, hack);
} }
static int static int
......
...@@ -237,14 +237,11 @@ void ...@@ -237,14 +237,11 @@ void
nouveau_svmm_invalidate(struct nouveau_svmm *svmm, u64 start, u64 limit) nouveau_svmm_invalidate(struct nouveau_svmm *svmm, u64 start, u64 limit)
{ {
if (limit > start) { if (limit > start) {
bool super = svmm->vmm->vmm.object.client->super;
svmm->vmm->vmm.object.client->super = true;
nvif_object_mthd(&svmm->vmm->vmm.object, NVIF_VMM_V0_PFNCLR, nvif_object_mthd(&svmm->vmm->vmm.object, NVIF_VMM_V0_PFNCLR,
&(struct nvif_vmm_pfnclr_v0) { &(struct nvif_vmm_pfnclr_v0) {
.addr = start, .addr = start,
.size = limit - start, .size = limit - start,
}, sizeof(struct nvif_vmm_pfnclr_v0)); }, sizeof(struct nvif_vmm_pfnclr_v0));
svmm->vmm->vmm.object.client->super = super;
} }
} }
...@@ -634,9 +631,7 @@ static int nouveau_atomic_range_fault(struct nouveau_svmm *svmm, ...@@ -634,9 +631,7 @@ static int nouveau_atomic_range_fault(struct nouveau_svmm *svmm,
NVIF_VMM_PFNMAP_V0_A | NVIF_VMM_PFNMAP_V0_A |
NVIF_VMM_PFNMAP_V0_HOST; NVIF_VMM_PFNMAP_V0_HOST;
svmm->vmm->vmm.object.client->super = true;
ret = nvif_object_ioctl(&svmm->vmm->vmm.object, args, size, NULL); ret = nvif_object_ioctl(&svmm->vmm->vmm.object, args, size, NULL);
svmm->vmm->vmm.object.client->super = false;
mutex_unlock(&svmm->mutex); mutex_unlock(&svmm->mutex);
unlock_page(page); unlock_page(page);
...@@ -702,9 +697,7 @@ static int nouveau_range_fault(struct nouveau_svmm *svmm, ...@@ -702,9 +697,7 @@ static int nouveau_range_fault(struct nouveau_svmm *svmm,
nouveau_hmm_convert_pfn(drm, &range, args); nouveau_hmm_convert_pfn(drm, &range, args);
svmm->vmm->vmm.object.client->super = true;
ret = nvif_object_ioctl(&svmm->vmm->vmm.object, args, size, NULL); ret = nvif_object_ioctl(&svmm->vmm->vmm.object, args, size, NULL);
svmm->vmm->vmm.object.client->super = false;
mutex_unlock(&svmm->mutex); mutex_unlock(&svmm->mutex);
out: out:
...@@ -928,10 +921,8 @@ nouveau_pfns_map(struct nouveau_svmm *svmm, struct mm_struct *mm, ...@@ -928,10 +921,8 @@ nouveau_pfns_map(struct nouveau_svmm *svmm, struct mm_struct *mm,
mutex_lock(&svmm->mutex); mutex_lock(&svmm->mutex);
svmm->vmm->vmm.object.client->super = true;
ret = nvif_object_ioctl(&svmm->vmm->vmm.object, args, sizeof(*args) + ret = nvif_object_ioctl(&svmm->vmm->vmm.object, args, sizeof(*args) +
npages * sizeof(args->p.phys[0]), NULL); npages * sizeof(args->p.phys[0]), NULL);
svmm->vmm->vmm.object.client->super = false;
mutex_unlock(&svmm->mutex); mutex_unlock(&svmm->mutex);
} }
......
...@@ -32,6 +32,9 @@ ...@@ -32,6 +32,9 @@
#include <nvif/event.h> #include <nvif/event.h>
#include <nvif/ioctl.h> #include <nvif/ioctl.h>
#include <nvif/class.h>
#include <nvif/cl0080.h>
struct usif_notify_p { struct usif_notify_p {
struct drm_pending_event base; struct drm_pending_event base;
struct { struct {
...@@ -261,7 +264,7 @@ usif_object_dtor(struct usif_object *object) ...@@ -261,7 +264,7 @@ usif_object_dtor(struct usif_object *object)
} }
static int static int
usif_object_new(struct drm_file *f, void *data, u32 size, void *argv, u32 argc) usif_object_new(struct drm_file *f, void *data, u32 size, void *argv, u32 argc, bool parent_abi16)
{ {
struct nouveau_cli *cli = nouveau_cli(f); struct nouveau_cli *cli = nouveau_cli(f);
struct nvif_client *client = &cli->base; struct nvif_client *client = &cli->base;
...@@ -271,23 +274,48 @@ usif_object_new(struct drm_file *f, void *data, u32 size, void *argv, u32 argc) ...@@ -271,23 +274,48 @@ usif_object_new(struct drm_file *f, void *data, u32 size, void *argv, u32 argc)
struct usif_object *object; struct usif_object *object;
int ret = -ENOSYS; int ret = -ENOSYS;
if ((ret = nvif_unpack(ret, &data, &size, args->v0, 0, 0, true)))
return ret;
switch (args->v0.oclass) {
case NV_DMA_FROM_MEMORY:
case NV_DMA_TO_MEMORY:
case NV_DMA_IN_MEMORY:
return -EINVAL;
case NV_DEVICE: {
union {
struct nv_device_v0 v0;
} *args = data;
if ((ret = nvif_unpack(ret, &data, &size, args->v0, 0, 0, false)))
return ret;
args->v0.priv = false;
break;
}
default:
if (!parent_abi16)
return -EINVAL;
break;
}
if (!(object = kmalloc(sizeof(*object), GFP_KERNEL))) if (!(object = kmalloc(sizeof(*object), GFP_KERNEL)))
return -ENOMEM; return -ENOMEM;
list_add(&object->head, &cli->objects); list_add(&object->head, &cli->objects);
if (!(ret = nvif_unpack(ret, &data, &size, args->v0, 0, 0, true))) {
object->route = args->v0.route; object->route = args->v0.route;
object->token = args->v0.token; object->token = args->v0.token;
args->v0.route = NVDRM_OBJECT_USIF; args->v0.route = NVDRM_OBJECT_USIF;
args->v0.token = (unsigned long)(void *)object; args->v0.token = (unsigned long)(void *)object;
ret = nvif_client_ioctl(client, argv, argc); ret = nvif_client_ioctl(client, argv, argc);
args->v0.token = object->token; if (ret) {
args->v0.route = object->route;
}
if (ret)
usif_object_dtor(object); usif_object_dtor(object);
return ret; return ret;
}
args->v0.token = object->token;
args->v0.route = object->route;
return 0;
} }
int int
...@@ -301,6 +329,7 @@ usif_ioctl(struct drm_file *filp, void __user *user, u32 argc) ...@@ -301,6 +329,7 @@ usif_ioctl(struct drm_file *filp, void __user *user, u32 argc)
struct nvif_ioctl_v0 v0; struct nvif_ioctl_v0 v0;
} *argv = data; } *argv = data;
struct usif_object *object; struct usif_object *object;
bool abi16 = false;
u8 owner; u8 owner;
int ret; int ret;
...@@ -331,11 +360,13 @@ usif_ioctl(struct drm_file *filp, void __user *user, u32 argc) ...@@ -331,11 +360,13 @@ usif_ioctl(struct drm_file *filp, void __user *user, u32 argc)
mutex_unlock(&cli->mutex); mutex_unlock(&cli->mutex);
goto done; goto done;
} }
abi16 = true;
} }
switch (argv->v0.type) { switch (argv->v0.type) {
case NVIF_IOCTL_V0_NEW: case NVIF_IOCTL_V0_NEW:
ret = usif_object_new(filp, data, size, argv, argc); ret = usif_object_new(filp, data, size, argv, argc, abi16);
break; break;
case NVIF_IOCTL_V0_NTFY_NEW: case NVIF_IOCTL_V0_NTFY_NEW:
ret = usif_notify_new(filp, data, size, argv, argc); ret = usif_notify_new(filp, data, size, argv, argc);
......
...@@ -32,7 +32,7 @@ ...@@ -32,7 +32,7 @@
int int
nvif_client_ioctl(struct nvif_client *client, void *data, u32 size) nvif_client_ioctl(struct nvif_client *client, void *data, u32 size)
{ {
return client->driver->ioctl(client->object.priv, client->super, data, size, NULL); return client->driver->ioctl(client->object.priv, data, size, NULL);
} }
int int
...@@ -80,7 +80,6 @@ nvif_client_ctor(struct nvif_client *parent, const char *name, u64 device, ...@@ -80,7 +80,6 @@ nvif_client_ctor(struct nvif_client *parent, const char *name, u64 device,
client->object.client = client; client->object.client = client;
client->object.handle = ~0; client->object.handle = ~0;
client->route = NVIF_IOCTL_V0_ROUTE_NVIF; client->route = NVIF_IOCTL_V0_ROUTE_NVIF;
client->super = true;
client->driver = parent->driver; client->driver = parent->driver;
if (ret == 0) { if (ret == 0) {
......
...@@ -44,8 +44,7 @@ nvif_object_ioctl(struct nvif_object *object, void *data, u32 size, void **hack) ...@@ -44,8 +44,7 @@ nvif_object_ioctl(struct nvif_object *object, void *data, u32 size, void **hack)
} else } else
return -ENOSYS; return -ENOSYS;
return client->driver->ioctl(client->object.priv, client->super, return client->driver->ioctl(client->object.priv, data, size, hack);
data, size, hack);
} }
void void
......
...@@ -426,8 +426,7 @@ nvkm_ioctl_path(struct nvkm_client *client, u64 handle, u32 type, ...@@ -426,8 +426,7 @@ nvkm_ioctl_path(struct nvkm_client *client, u64 handle, u32 type,
} }
int int
nvkm_ioctl(struct nvkm_client *client, bool supervisor, nvkm_ioctl(struct nvkm_client *client, void *data, u32 size, void **hack)
void *data, u32 size, void **hack)
{ {
struct nvkm_object *object = &client->object; struct nvkm_object *object = &client->object;
union { union {
...@@ -435,7 +434,6 @@ nvkm_ioctl(struct nvkm_client *client, bool supervisor, ...@@ -435,7 +434,6 @@ nvkm_ioctl(struct nvkm_client *client, bool supervisor,
} *args = data; } *args = data;
int ret = -ENOSYS; int ret = -ENOSYS;
client->super = supervisor;
nvif_ioctl(object, "size %d\n", size); nvif_ioctl(object, "size %d\n", size);
if (!(ret = nvif_unpack(ret, &data, &size, args->v0, 0, 0, true))) { if (!(ret = nvif_unpack(ret, &data, &size, args->v0, 0, 0, true))) {
......
...@@ -2624,6 +2624,26 @@ nv174_chipset = { ...@@ -2624,6 +2624,26 @@ nv174_chipset = {
.dma = { 0x00000001, gv100_dma_new }, .dma = { 0x00000001, gv100_dma_new },
}; };
static const struct nvkm_device_chip
nv177_chipset = {
.name = "GA107",
.bar = { 0x00000001, tu102_bar_new },
.bios = { 0x00000001, nvkm_bios_new },
.devinit = { 0x00000001, ga100_devinit_new },
.fb = { 0x00000001, ga102_fb_new },
.gpio = { 0x00000001, ga102_gpio_new },
.i2c = { 0x00000001, gm200_i2c_new },
.imem = { 0x00000001, nv50_instmem_new },
.mc = { 0x00000001, ga100_mc_new },
.mmu = { 0x00000001, tu102_mmu_new },
.pci = { 0x00000001, gp100_pci_new },
.privring = { 0x00000001, gm200_privring_new },
.timer = { 0x00000001, gk20a_timer_new },
.top = { 0x00000001, ga100_top_new },
.disp = { 0x00000001, ga102_disp_new },
.dma = { 0x00000001, gv100_dma_new },
};
static int static int
nvkm_device_event_ctor(struct nvkm_object *object, void *data, u32 size, nvkm_device_event_ctor(struct nvkm_object *object, void *data, u32 size,
struct nvkm_notify *notify) struct nvkm_notify *notify)
...@@ -3049,6 +3069,7 @@ nvkm_device_ctor(const struct nvkm_device_func *func, ...@@ -3049,6 +3069,7 @@ nvkm_device_ctor(const struct nvkm_device_func *func,
case 0x168: device->chip = &nv168_chipset; break; case 0x168: device->chip = &nv168_chipset; break;
case 0x172: device->chip = &nv172_chipset; break; case 0x172: device->chip = &nv172_chipset; break;
case 0x174: device->chip = &nv174_chipset; break; case 0x174: device->chip = &nv174_chipset; break;
case 0x177: device->chip = &nv177_chipset; break;
default: default:
if (nvkm_boolopt(device->cfgopt, "NvEnableUnsupportedChipsets", false)) { if (nvkm_boolopt(device->cfgopt, "NvEnableUnsupportedChipsets", false)) {
switch (device->chipset) { switch (device->chipset) {
......
...@@ -397,7 +397,7 @@ nvkm_udevice_new(const struct nvkm_oclass *oclass, void *data, u32 size, ...@@ -397,7 +397,7 @@ nvkm_udevice_new(const struct nvkm_oclass *oclass, void *data, u32 size,
return ret; return ret;
/* give priviledged clients register access */ /* give priviledged clients register access */
if (client->super) if (args->v0.priv)
func = &nvkm_udevice_super; func = &nvkm_udevice_super;
else else
func = &nvkm_udevice; func = &nvkm_udevice;
......
...@@ -440,7 +440,7 @@ nvkm_dp_train(struct nvkm_dp *dp, u32 dataKBps) ...@@ -440,7 +440,7 @@ nvkm_dp_train(struct nvkm_dp *dp, u32 dataKBps)
return ret; return ret;
} }
static void void
nvkm_dp_disable(struct nvkm_outp *outp, struct nvkm_ior *ior) nvkm_dp_disable(struct nvkm_outp *outp, struct nvkm_ior *ior)
{ {
struct nvkm_dp *dp = nvkm_dp(outp); struct nvkm_dp *dp = nvkm_dp(outp);
......
...@@ -32,6 +32,7 @@ struct nvkm_dp { ...@@ -32,6 +32,7 @@ struct nvkm_dp {
int nvkm_dp_new(struct nvkm_disp *, int index, struct dcb_output *, int nvkm_dp_new(struct nvkm_disp *, int index, struct dcb_output *,
struct nvkm_outp **); struct nvkm_outp **);
void nvkm_dp_disable(struct nvkm_outp *, struct nvkm_ior *);
/* DPCD Receiver Capabilities */ /* DPCD Receiver Capabilities */
#define DPCD_RC00_DPCD_REV 0x00000 #define DPCD_RC00_DPCD_REV 0x00000
......
...@@ -22,6 +22,7 @@ ...@@ -22,6 +22,7 @@
* Authors: Ben Skeggs * Authors: Ben Skeggs
*/ */
#include "outp.h" #include "outp.h"
#include "dp.h"
#include "ior.h" #include "ior.h"
#include <subdev/bios.h> #include <subdev/bios.h>
...@@ -257,6 +258,14 @@ nvkm_outp_init_route(struct nvkm_outp *outp) ...@@ -257,6 +258,14 @@ nvkm_outp_init_route(struct nvkm_outp *outp)
if (!ior->arm.head || ior->arm.proto != proto) { if (!ior->arm.head || ior->arm.proto != proto) {
OUTP_DBG(outp, "no heads (%x %d %d)", ior->arm.head, OUTP_DBG(outp, "no heads (%x %d %d)", ior->arm.head,
ior->arm.proto, proto); ior->arm.proto, proto);
/* The EFI GOP driver on Ampere can leave unused DP links routed,
* which we don't expect. The DisableLT IED script *should* get
* us back to where we need to be.
*/
if (ior->func->route.get && !ior->arm.head && outp->info.type == DCB_OUTPUT_DP)
nvkm_dp_disable(outp, ior);
return; return;
} }
......
...@@ -26,7 +26,6 @@ ...@@ -26,7 +26,6 @@
#include <core/client.h> #include <core/client.h>
#include <core/gpuobj.h> #include <core/gpuobj.h>
#include <subdev/fb.h> #include <subdev/fb.h>
#include <subdev/instmem.h>
#include <nvif/cl0002.h> #include <nvif/cl0002.h>
#include <nvif/unpack.h> #include <nvif/unpack.h>
...@@ -72,11 +71,7 @@ nvkm_dmaobj_ctor(const struct nvkm_dmaobj_func *func, struct nvkm_dma *dma, ...@@ -72,11 +71,7 @@ nvkm_dmaobj_ctor(const struct nvkm_dmaobj_func *func, struct nvkm_dma *dma,
union { union {
struct nv_dma_v0 v0; struct nv_dma_v0 v0;
} *args = *pdata; } *args = *pdata;
struct nvkm_device *device = dma->engine.subdev.device;
struct nvkm_client *client = oclass->client;
struct nvkm_object *parent = oclass->parent; struct nvkm_object *parent = oclass->parent;
struct nvkm_instmem *instmem = device->imem;
struct nvkm_fb *fb = device->fb;
void *data = *pdata; void *data = *pdata;
u32 size = *psize; u32 size = *psize;
int ret = -ENOSYS; int ret = -ENOSYS;
...@@ -109,23 +104,13 @@ nvkm_dmaobj_ctor(const struct nvkm_dmaobj_func *func, struct nvkm_dma *dma, ...@@ -109,23 +104,13 @@ nvkm_dmaobj_ctor(const struct nvkm_dmaobj_func *func, struct nvkm_dma *dma,
dmaobj->target = NV_MEM_TARGET_VM; dmaobj->target = NV_MEM_TARGET_VM;
break; break;
case NV_DMA_V0_TARGET_VRAM: case NV_DMA_V0_TARGET_VRAM:
if (!client->super) {
if (dmaobj->limit >= fb->ram->size - instmem->reserved)
return -EACCES;
if (device->card_type >= NV_50)
return -EACCES;
}
dmaobj->target = NV_MEM_TARGET_VRAM; dmaobj->target = NV_MEM_TARGET_VRAM;
break; break;
case NV_DMA_V0_TARGET_PCI: case NV_DMA_V0_TARGET_PCI:
if (!client->super)
return -EACCES;
dmaobj->target = NV_MEM_TARGET_PCI; dmaobj->target = NV_MEM_TARGET_PCI;
break; break;
case NV_DMA_V0_TARGET_PCI_US: case NV_DMA_V0_TARGET_PCI_US:
case NV_DMA_V0_TARGET_AGP: case NV_DMA_V0_TARGET_AGP:
if (!client->super)
return -EACCES;
dmaobj->target = NV_MEM_TARGET_PCI_NOSNOOP; dmaobj->target = NV_MEM_TARGET_PCI_NOSNOOP;
break; break;
default: default:
......
...@@ -27,8 +27,6 @@ nvkm-y += nvkm/engine/fifo/dmanv04.o ...@@ -27,8 +27,6 @@ nvkm-y += nvkm/engine/fifo/dmanv04.o
nvkm-y += nvkm/engine/fifo/dmanv10.o nvkm-y += nvkm/engine/fifo/dmanv10.o
nvkm-y += nvkm/engine/fifo/dmanv17.o nvkm-y += nvkm/engine/fifo/dmanv17.o
nvkm-y += nvkm/engine/fifo/dmanv40.o nvkm-y += nvkm/engine/fifo/dmanv40.o
nvkm-y += nvkm/engine/fifo/dmanv50.o
nvkm-y += nvkm/engine/fifo/dmag84.o
nvkm-y += nvkm/engine/fifo/gpfifonv50.o nvkm-y += nvkm/engine/fifo/gpfifonv50.o
nvkm-y += nvkm/engine/fifo/gpfifog84.o nvkm-y += nvkm/engine/fifo/gpfifog84.o
......
...@@ -48,8 +48,6 @@ void nv50_fifo_chan_object_dtor(struct nvkm_fifo_chan *, int); ...@@ -48,8 +48,6 @@ void nv50_fifo_chan_object_dtor(struct nvkm_fifo_chan *, int);
int g84_fifo_chan_ctor(struct nv50_fifo *, u64 vmm, u64 push, int g84_fifo_chan_ctor(struct nv50_fifo *, u64 vmm, u64 push,
const struct nvkm_oclass *, struct nv50_fifo_chan *); const struct nvkm_oclass *, struct nv50_fifo_chan *);
extern const struct nvkm_fifo_chan_oclass nv50_fifo_dma_oclass;
extern const struct nvkm_fifo_chan_oclass nv50_fifo_gpfifo_oclass; extern const struct nvkm_fifo_chan_oclass nv50_fifo_gpfifo_oclass;
extern const struct nvkm_fifo_chan_oclass g84_fifo_dma_oclass;
extern const struct nvkm_fifo_chan_oclass g84_fifo_gpfifo_oclass; extern const struct nvkm_fifo_chan_oclass g84_fifo_gpfifo_oclass;
#endif #endif
/*
* Copyright 2012 Red Hat Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
*
* Authors: Ben Skeggs
*/
#include "channv50.h"
#include <core/client.h>
#include <core/ramht.h>
#include <nvif/class.h>
#include <nvif/cl826e.h>
#include <nvif/unpack.h>
static int
g84_fifo_dma_new(struct nvkm_fifo *base, const struct nvkm_oclass *oclass,
void *data, u32 size, struct nvkm_object **pobject)
{
struct nvkm_object *parent = oclass->parent;
union {
struct g82_channel_dma_v0 v0;
} *args = data;
struct nv50_fifo *fifo = nv50_fifo(base);
struct nv50_fifo_chan *chan;
int ret = -ENOSYS;
nvif_ioctl(parent, "create channel dma size %d\n", size);
if (!(ret = nvif_unpack(ret, &data, &size, args->v0, 0, 0, false))) {
nvif_ioctl(parent, "create channel dma vers %d vmm %llx "
"pushbuf %llx offset %016llx\n",
args->v0.version, args->v0.vmm, args->v0.pushbuf,
args->v0.offset);
if (!args->v0.pushbuf)
return -EINVAL;
} else
return ret;
if (!(chan = kzalloc(sizeof(*chan), GFP_KERNEL)))
return -ENOMEM;
*pobject = &chan->base.object;
ret = g84_fifo_chan_ctor(fifo, args->v0.vmm, args->v0.pushbuf,
oclass, chan);
if (ret)
return ret;
args->v0.chid = chan->base.chid;
nvkm_kmap(chan->ramfc);
nvkm_wo32(chan->ramfc, 0x08, lower_32_bits(args->v0.offset));
nvkm_wo32(chan->ramfc, 0x0c, upper_32_bits(args->v0.offset));
nvkm_wo32(chan->ramfc, 0x10, lower_32_bits(args->v0.offset));
nvkm_wo32(chan->ramfc, 0x14, upper_32_bits(args->v0.offset));
nvkm_wo32(chan->ramfc, 0x3c, 0x003f6078);
nvkm_wo32(chan->ramfc, 0x44, 0x01003fff);
nvkm_wo32(chan->ramfc, 0x48, chan->base.push->node->offset >> 4);
nvkm_wo32(chan->ramfc, 0x4c, 0xffffffff);
nvkm_wo32(chan->ramfc, 0x60, 0x7fffffff);
nvkm_wo32(chan->ramfc, 0x78, 0x00000000);
nvkm_wo32(chan->ramfc, 0x7c, 0x30000001);
nvkm_wo32(chan->ramfc, 0x80, ((chan->ramht->bits - 9) << 27) |
(4 << 24) /* SEARCH_FULL */ |
(chan->ramht->gpuobj->node->offset >> 4));
nvkm_wo32(chan->ramfc, 0x88, chan->cache->addr >> 10);
nvkm_wo32(chan->ramfc, 0x98, chan->base.inst->addr >> 12);
nvkm_done(chan->ramfc);
return 0;
}
const struct nvkm_fifo_chan_oclass
g84_fifo_dma_oclass = {
.base.oclass = G82_CHANNEL_DMA,
.base.minver = 0,
.base.maxver = 0,
.ctor = g84_fifo_dma_new,
};
/*
* Copyright 2012 Red Hat Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
*
* Authors: Ben Skeggs
*/
#include "channv50.h"
#include <core/client.h>
#include <core/ramht.h>
#include <nvif/class.h>
#include <nvif/cl506e.h>
#include <nvif/unpack.h>
static int
nv50_fifo_dma_new(struct nvkm_fifo *base, const struct nvkm_oclass *oclass,
void *data, u32 size, struct nvkm_object **pobject)
{
struct nvkm_object *parent = oclass->parent;
union {
struct nv50_channel_dma_v0 v0;
} *args = data;
struct nv50_fifo *fifo = nv50_fifo(base);
struct nv50_fifo_chan *chan;
int ret = -ENOSYS;
nvif_ioctl(parent, "create channel dma size %d\n", size);
if (!(ret = nvif_unpack(ret, &data, &size, args->v0, 0, 0, false))) {
nvif_ioctl(parent, "create channel dma vers %d vmm %llx "
"pushbuf %llx offset %016llx\n",
args->v0.version, args->v0.vmm, args->v0.pushbuf,
args->v0.offset);
if (!args->v0.pushbuf)
return -EINVAL;
} else
return ret;
if (!(chan = kzalloc(sizeof(*chan), GFP_KERNEL)))
return -ENOMEM;
*pobject = &chan->base.object;
ret = nv50_fifo_chan_ctor(fifo, args->v0.vmm, args->v0.pushbuf,
oclass, chan);
if (ret)
return ret;
args->v0.chid = chan->base.chid;
nvkm_kmap(chan->ramfc);
nvkm_wo32(chan->ramfc, 0x08, lower_32_bits(args->v0.offset));
nvkm_wo32(chan->ramfc, 0x0c, upper_32_bits(args->v0.offset));
nvkm_wo32(chan->ramfc, 0x10, lower_32_bits(args->v0.offset));
nvkm_wo32(chan->ramfc, 0x14, upper_32_bits(args->v0.offset));
nvkm_wo32(chan->ramfc, 0x3c, 0x003f6078);
nvkm_wo32(chan->ramfc, 0x44, 0x01003fff);
nvkm_wo32(chan->ramfc, 0x48, chan->base.push->node->offset >> 4);
nvkm_wo32(chan->ramfc, 0x4c, 0xffffffff);
nvkm_wo32(chan->ramfc, 0x60, 0x7fffffff);
nvkm_wo32(chan->ramfc, 0x78, 0x00000000);
nvkm_wo32(chan->ramfc, 0x7c, 0x30000001);
nvkm_wo32(chan->ramfc, 0x80, ((chan->ramht->bits - 9) << 27) |
(4 << 24) /* SEARCH_FULL */ |
(chan->ramht->gpuobj->node->offset >> 4));
nvkm_done(chan->ramfc);
return 0;
}
const struct nvkm_fifo_chan_oclass
nv50_fifo_dma_oclass = {
.base.oclass = NV50_CHANNEL_DMA,
.base.minver = 0,
.base.maxver = 0,
.ctor = nv50_fifo_dma_new,
};
...@@ -119,7 +119,6 @@ g84_fifo = { ...@@ -119,7 +119,6 @@ g84_fifo = {
.uevent_init = g84_fifo_uevent_init, .uevent_init = g84_fifo_uevent_init,
.uevent_fini = g84_fifo_uevent_fini, .uevent_fini = g84_fifo_uevent_fini,
.chan = { .chan = {
&g84_fifo_dma_oclass,
&g84_fifo_gpfifo_oclass, &g84_fifo_gpfifo_oclass,
NULL NULL
}, },
......
...@@ -341,8 +341,6 @@ gk104_fifo_gpfifo_new(struct gk104_fifo *fifo, const struct nvkm_oclass *oclass, ...@@ -341,8 +341,6 @@ gk104_fifo_gpfifo_new(struct gk104_fifo *fifo, const struct nvkm_oclass *oclass,
"runlist %016llx priv %d\n", "runlist %016llx priv %d\n",
args->v0.version, args->v0.vmm, args->v0.ioffset, args->v0.version, args->v0.vmm, args->v0.ioffset,
args->v0.ilength, args->v0.runlist, args->v0.priv); args->v0.ilength, args->v0.runlist, args->v0.priv);
if (args->v0.priv && !oclass->client->super)
return -EINVAL;
return gk104_fifo_gpfifo_new_(fifo, return gk104_fifo_gpfifo_new_(fifo,
&args->v0.runlist, &args->v0.runlist,
&args->v0.chid, &args->v0.chid,
......
...@@ -226,8 +226,6 @@ gv100_fifo_gpfifo_new(struct gk104_fifo *fifo, const struct nvkm_oclass *oclass, ...@@ -226,8 +226,6 @@ gv100_fifo_gpfifo_new(struct gk104_fifo *fifo, const struct nvkm_oclass *oclass,
"runlist %016llx priv %d\n", "runlist %016llx priv %d\n",
args->v0.version, args->v0.vmm, args->v0.ioffset, args->v0.version, args->v0.vmm, args->v0.ioffset,
args->v0.ilength, args->v0.runlist, args->v0.priv); args->v0.ilength, args->v0.runlist, args->v0.priv);
if (args->v0.priv && !oclass->client->super)
return -EINVAL;
return gv100_fifo_gpfifo_new_(&gv100_fifo_gpfifo, fifo, return gv100_fifo_gpfifo_new_(&gv100_fifo_gpfifo, fifo,
&args->v0.runlist, &args->v0.runlist,
&args->v0.chid, &args->v0.chid,
......
...@@ -65,8 +65,6 @@ tu102_fifo_gpfifo_new(struct gk104_fifo *fifo, const struct nvkm_oclass *oclass, ...@@ -65,8 +65,6 @@ tu102_fifo_gpfifo_new(struct gk104_fifo *fifo, const struct nvkm_oclass *oclass,
"runlist %016llx priv %d\n", "runlist %016llx priv %d\n",
args->v0.version, args->v0.vmm, args->v0.ioffset, args->v0.version, args->v0.vmm, args->v0.ioffset,
args->v0.ilength, args->v0.runlist, args->v0.priv); args->v0.ilength, args->v0.runlist, args->v0.priv);
if (args->v0.priv && !oclass->client->super)
return -EINVAL;
return gv100_fifo_gpfifo_new_(&tu102_fifo_gpfifo, fifo, return gv100_fifo_gpfifo_new_(&tu102_fifo_gpfifo, fifo,
&args->v0.runlist, &args->v0.runlist,
&args->v0.chid, &args->v0.chid,
......
...@@ -136,7 +136,6 @@ nv50_fifo = { ...@@ -136,7 +136,6 @@ nv50_fifo = {
.pause = nv04_fifo_pause, .pause = nv04_fifo_pause,
.start = nv04_fifo_start, .start = nv04_fifo_start,
.chan = { .chan = {
&nv50_fifo_dma_oclass,
&nv50_fifo_gpfifo_oclass, &nv50_fifo_gpfifo_oclass,
NULL NULL
}, },
......
...@@ -41,7 +41,7 @@ nvkm_umem_search(struct nvkm_client *client, u64 handle) ...@@ -41,7 +41,7 @@ nvkm_umem_search(struct nvkm_client *client, u64 handle)
object = nvkm_object_search(client, handle, &nvkm_umem); object = nvkm_object_search(client, handle, &nvkm_umem);
if (IS_ERR(object)) { if (IS_ERR(object)) {
if (client->super && client != master) { if (client != master) {
spin_lock(&master->lock); spin_lock(&master->lock);
list_for_each_entry(umem, &master->umem, head) { list_for_each_entry(umem, &master->umem, head) {
if (umem->object.object == handle) { if (umem->object.object == handle) {
...@@ -53,7 +53,6 @@ nvkm_umem_search(struct nvkm_client *client, u64 handle) ...@@ -53,7 +53,6 @@ nvkm_umem_search(struct nvkm_client *client, u64 handle)
} }
} else { } else {
umem = nvkm_umem(object); umem = nvkm_umem(object);
if (!umem->priv || client->super)
memory = nvkm_memory_ref(umem->memory); memory = nvkm_memory_ref(umem->memory);
} }
...@@ -167,7 +166,6 @@ nvkm_umem_new(const struct nvkm_oclass *oclass, void *argv, u32 argc, ...@@ -167,7 +166,6 @@ nvkm_umem_new(const struct nvkm_oclass *oclass, void *argv, u32 argc,
nvkm_object_ctor(&nvkm_umem, oclass, &umem->object); nvkm_object_ctor(&nvkm_umem, oclass, &umem->object);
umem->mmu = mmu; umem->mmu = mmu;
umem->type = mmu->type[type].type; umem->type = mmu->type[type].type;
umem->priv = oclass->client->super;
INIT_LIST_HEAD(&umem->head); INIT_LIST_HEAD(&umem->head);
*pobject = &umem->object; *pobject = &umem->object;
......
...@@ -8,7 +8,6 @@ struct nvkm_umem { ...@@ -8,7 +8,6 @@ struct nvkm_umem {
struct nvkm_object object; struct nvkm_object object;
struct nvkm_mmu *mmu; struct nvkm_mmu *mmu;
u8 type:8; u8 type:8;
bool priv:1;
bool mappable:1; bool mappable:1;
bool io:1; bool io:1;
......
...@@ -34,7 +34,7 @@ nvkm_ummu_sclass(struct nvkm_object *object, int index, ...@@ -34,7 +34,7 @@ nvkm_ummu_sclass(struct nvkm_object *object, int index,
{ {
struct nvkm_mmu *mmu = nvkm_ummu(object)->mmu; struct nvkm_mmu *mmu = nvkm_ummu(object)->mmu;
if (mmu->func->mem.user.oclass && oclass->client->super) { if (mmu->func->mem.user.oclass) {
if (index-- == 0) { if (index-- == 0) {
oclass->base = mmu->func->mem.user; oclass->base = mmu->func->mem.user;
oclass->ctor = nvkm_umem_new; oclass->ctor = nvkm_umem_new;
......
...@@ -45,7 +45,6 @@ nvkm_uvmm_search(struct nvkm_client *client, u64 handle) ...@@ -45,7 +45,6 @@ nvkm_uvmm_search(struct nvkm_client *client, u64 handle)
static int static int
nvkm_uvmm_mthd_pfnclr(struct nvkm_uvmm *uvmm, void *argv, u32 argc) nvkm_uvmm_mthd_pfnclr(struct nvkm_uvmm *uvmm, void *argv, u32 argc)
{ {
struct nvkm_client *client = uvmm->object.client;
union { union {
struct nvif_vmm_pfnclr_v0 v0; struct nvif_vmm_pfnclr_v0 v0;
} *args = argv; } *args = argv;
...@@ -59,9 +58,6 @@ nvkm_uvmm_mthd_pfnclr(struct nvkm_uvmm *uvmm, void *argv, u32 argc) ...@@ -59,9 +58,6 @@ nvkm_uvmm_mthd_pfnclr(struct nvkm_uvmm *uvmm, void *argv, u32 argc)
} else } else
return ret; return ret;
if (!client->super)
return -ENOENT;
if (size) { if (size) {
mutex_lock(&vmm->mutex); mutex_lock(&vmm->mutex);
ret = nvkm_vmm_pfn_unmap(vmm, addr, size); ret = nvkm_vmm_pfn_unmap(vmm, addr, size);
...@@ -74,7 +70,6 @@ nvkm_uvmm_mthd_pfnclr(struct nvkm_uvmm *uvmm, void *argv, u32 argc) ...@@ -74,7 +70,6 @@ nvkm_uvmm_mthd_pfnclr(struct nvkm_uvmm *uvmm, void *argv, u32 argc)
static int static int
nvkm_uvmm_mthd_pfnmap(struct nvkm_uvmm *uvmm, void *argv, u32 argc) nvkm_uvmm_mthd_pfnmap(struct nvkm_uvmm *uvmm, void *argv, u32 argc)
{ {
struct nvkm_client *client = uvmm->object.client;
union { union {
struct nvif_vmm_pfnmap_v0 v0; struct nvif_vmm_pfnmap_v0 v0;
} *args = argv; } *args = argv;
...@@ -93,9 +88,6 @@ nvkm_uvmm_mthd_pfnmap(struct nvkm_uvmm *uvmm, void *argv, u32 argc) ...@@ -93,9 +88,6 @@ nvkm_uvmm_mthd_pfnmap(struct nvkm_uvmm *uvmm, void *argv, u32 argc)
} else } else
return ret; return ret;
if (!client->super)
return -ENOENT;
if (size) { if (size) {
mutex_lock(&vmm->mutex); mutex_lock(&vmm->mutex);
ret = nvkm_vmm_pfn_map(vmm, page, addr, size, phys); ret = nvkm_vmm_pfn_map(vmm, page, addr, size, phys);
...@@ -108,7 +100,6 @@ nvkm_uvmm_mthd_pfnmap(struct nvkm_uvmm *uvmm, void *argv, u32 argc) ...@@ -108,7 +100,6 @@ nvkm_uvmm_mthd_pfnmap(struct nvkm_uvmm *uvmm, void *argv, u32 argc)
static int static int
nvkm_uvmm_mthd_unmap(struct nvkm_uvmm *uvmm, void *argv, u32 argc) nvkm_uvmm_mthd_unmap(struct nvkm_uvmm *uvmm, void *argv, u32 argc)
{ {
struct nvkm_client *client = uvmm->object.client;
union { union {
struct nvif_vmm_unmap_v0 v0; struct nvif_vmm_unmap_v0 v0;
} *args = argv; } *args = argv;
...@@ -130,9 +121,8 @@ nvkm_uvmm_mthd_unmap(struct nvkm_uvmm *uvmm, void *argv, u32 argc) ...@@ -130,9 +121,8 @@ nvkm_uvmm_mthd_unmap(struct nvkm_uvmm *uvmm, void *argv, u32 argc)
goto done; goto done;
} }
if (ret = -ENOENT, (!vma->user && !client->super) || vma->busy) { if (ret = -ENOENT, vma->busy) {
VMM_DEBUG(vmm, "denied %016llx: %d %d %d", addr, VMM_DEBUG(vmm, "denied %016llx: %d", addr, vma->busy);
vma->user, !client->super, vma->busy);
goto done; goto done;
} }
...@@ -181,9 +171,8 @@ nvkm_uvmm_mthd_map(struct nvkm_uvmm *uvmm, void *argv, u32 argc) ...@@ -181,9 +171,8 @@ nvkm_uvmm_mthd_map(struct nvkm_uvmm *uvmm, void *argv, u32 argc)
goto fail; goto fail;
} }
if (ret = -ENOENT, (!vma->user && !client->super) || vma->busy) { if (ret = -ENOENT, vma->busy) {
VMM_DEBUG(vmm, "denied %016llx: %d %d %d", addr, VMM_DEBUG(vmm, "denied %016llx: %d", addr, vma->busy);
vma->user, !client->super, vma->busy);
goto fail; goto fail;
} }
...@@ -230,7 +219,6 @@ nvkm_uvmm_mthd_map(struct nvkm_uvmm *uvmm, void *argv, u32 argc) ...@@ -230,7 +219,6 @@ nvkm_uvmm_mthd_map(struct nvkm_uvmm *uvmm, void *argv, u32 argc)
static int static int
nvkm_uvmm_mthd_put(struct nvkm_uvmm *uvmm, void *argv, u32 argc) nvkm_uvmm_mthd_put(struct nvkm_uvmm *uvmm, void *argv, u32 argc)
{ {
struct nvkm_client *client = uvmm->object.client;
union { union {
struct nvif_vmm_put_v0 v0; struct nvif_vmm_put_v0 v0;
} *args = argv; } *args = argv;
...@@ -252,9 +240,8 @@ nvkm_uvmm_mthd_put(struct nvkm_uvmm *uvmm, void *argv, u32 argc) ...@@ -252,9 +240,8 @@ nvkm_uvmm_mthd_put(struct nvkm_uvmm *uvmm, void *argv, u32 argc)
goto done; goto done;
} }
if (ret = -ENOENT, (!vma->user && !client->super) || vma->busy) { if (ret = -ENOENT, vma->busy) {
VMM_DEBUG(vmm, "denied %016llx: %d %d %d", addr, VMM_DEBUG(vmm, "denied %016llx: %d", addr, vma->busy);
vma->user, !client->super, vma->busy);
goto done; goto done;
} }
...@@ -268,7 +255,6 @@ nvkm_uvmm_mthd_put(struct nvkm_uvmm *uvmm, void *argv, u32 argc) ...@@ -268,7 +255,6 @@ nvkm_uvmm_mthd_put(struct nvkm_uvmm *uvmm, void *argv, u32 argc)
static int static int
nvkm_uvmm_mthd_get(struct nvkm_uvmm *uvmm, void *argv, u32 argc) nvkm_uvmm_mthd_get(struct nvkm_uvmm *uvmm, void *argv, u32 argc)
{ {
struct nvkm_client *client = uvmm->object.client;
union { union {
struct nvif_vmm_get_v0 v0; struct nvif_vmm_get_v0 v0;
} *args = argv; } *args = argv;
...@@ -297,7 +283,6 @@ nvkm_uvmm_mthd_get(struct nvkm_uvmm *uvmm, void *argv, u32 argc) ...@@ -297,7 +283,6 @@ nvkm_uvmm_mthd_get(struct nvkm_uvmm *uvmm, void *argv, u32 argc)
return ret; return ret;
args->v0.addr = vma->addr; args->v0.addr = vma->addr;
vma->user = !client->super;
return ret; return ret;
} }
......
...@@ -774,7 +774,6 @@ nvkm_vma_tail(struct nvkm_vma *vma, u64 tail) ...@@ -774,7 +774,6 @@ nvkm_vma_tail(struct nvkm_vma *vma, u64 tail)
new->refd = vma->refd; new->refd = vma->refd;
new->used = vma->used; new->used = vma->used;
new->part = vma->part; new->part = vma->part;
new->user = vma->user;
new->busy = vma->busy; new->busy = vma->busy;
new->mapped = vma->mapped; new->mapped = vma->mapped;
list_add(&new->head, &vma->head); list_add(&new->head, &vma->head);
...@@ -951,7 +950,7 @@ nvkm_vmm_node_split(struct nvkm_vmm *vmm, ...@@ -951,7 +950,7 @@ nvkm_vmm_node_split(struct nvkm_vmm *vmm,
static void static void
nvkm_vma_dump(struct nvkm_vma *vma) nvkm_vma_dump(struct nvkm_vma *vma)
{ {
printk(KERN_ERR "%016llx %016llx %c%c%c%c%c%c%c%c%c %p\n", printk(KERN_ERR "%016llx %016llx %c%c%c%c%c%c%c%c %p\n",
vma->addr, (u64)vma->size, vma->addr, (u64)vma->size,
vma->used ? '-' : 'F', vma->used ? '-' : 'F',
vma->mapref ? 'R' : '-', vma->mapref ? 'R' : '-',
...@@ -959,7 +958,6 @@ nvkm_vma_dump(struct nvkm_vma *vma) ...@@ -959,7 +958,6 @@ nvkm_vma_dump(struct nvkm_vma *vma)
vma->page != NVKM_VMA_PAGE_NONE ? '0' + vma->page : '-', vma->page != NVKM_VMA_PAGE_NONE ? '0' + vma->page : '-',
vma->refd != NVKM_VMA_PAGE_NONE ? '0' + vma->refd : '-', vma->refd != NVKM_VMA_PAGE_NONE ? '0' + vma->refd : '-',
vma->part ? 'P' : '-', vma->part ? 'P' : '-',
vma->user ? 'U' : '-',
vma->busy ? 'B' : '-', vma->busy ? 'B' : '-',
vma->mapped ? 'M' : '-', vma->mapped ? 'M' : '-',
vma->memory); vma->memory);
...@@ -1024,7 +1022,6 @@ nvkm_vmm_ctor_managed(struct nvkm_vmm *vmm, u64 addr, u64 size) ...@@ -1024,7 +1022,6 @@ nvkm_vmm_ctor_managed(struct nvkm_vmm *vmm, u64 addr, u64 size)
vma->mapref = true; vma->mapref = true;
vma->sparse = false; vma->sparse = false;
vma->used = true; vma->used = true;
vma->user = true;
nvkm_vmm_node_insert(vmm, vma); nvkm_vmm_node_insert(vmm, vma);
list_add_tail(&vma->head, &vmm->list); list_add_tail(&vma->head, &vmm->list);
return 0; return 0;
...@@ -1615,7 +1612,6 @@ nvkm_vmm_put_locked(struct nvkm_vmm *vmm, struct nvkm_vma *vma) ...@@ -1615,7 +1612,6 @@ nvkm_vmm_put_locked(struct nvkm_vmm *vmm, struct nvkm_vma *vma)
vma->page = NVKM_VMA_PAGE_NONE; vma->page = NVKM_VMA_PAGE_NONE;
vma->refd = NVKM_VMA_PAGE_NONE; vma->refd = NVKM_VMA_PAGE_NONE;
vma->used = false; vma->used = false;
vma->user = false;
nvkm_vmm_put_region(vmm, vma); nvkm_vmm_put_region(vmm, vma);
} }
......
...@@ -534,7 +534,6 @@ int ...@@ -534,7 +534,6 @@ int
gp100_vmm_mthd(struct nvkm_vmm *vmm, gp100_vmm_mthd(struct nvkm_vmm *vmm,
struct nvkm_client *client, u32 mthd, void *argv, u32 argc) struct nvkm_client *client, u32 mthd, void *argv, u32 argc)
{ {
if (client->super) {
switch (mthd) { switch (mthd) {
case GP100_VMM_VN_FAULT_REPLAY: case GP100_VMM_VN_FAULT_REPLAY:
return gp100_vmm_fault_replay(vmm, argv, argc); return gp100_vmm_fault_replay(vmm, argv, argc);
...@@ -543,7 +542,6 @@ gp100_vmm_mthd(struct nvkm_vmm *vmm, ...@@ -543,7 +542,6 @@ gp100_vmm_mthd(struct nvkm_vmm *vmm,
default: default:
break; break;
} }
}
return -EINVAL; return -EINVAL;
} }
......
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