linux/drivers/gpu/drm/nouveau/nouveau_dmem.c

/*
 * Copyright 2018 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.
 */
#include "nouveau_dmem.h"
#include "nouveau_drv.h"
#include "nouveau_chan.h"
#include "nouveau_dma.h"
#include "nouveau_mem.h"
#include "nouveau_bo.h"
#include "nouveau_svm.h"

#include <nvif/class.h>
#include <nvif/object.h>
#include <nvif/push906f.h>
#include <nvif/if000c.h>
#include <nvif/if500b.h>
#include <nvif/if900b.h>

#include <nvhw/class/cla0b5.h>

#include <linux/sched/mm.h>
#include <linux/hmm.h>
#include <linux/memremap.h>
#include <linux/migrate.h>

/*
 * FIXME: this is ugly right now we are using TTM to allocate vram and we pin
 * it in vram while in use. We likely want to overhaul memory management for
 * nouveau to be more page like (not necessarily with system page size but a
 * bigger page size) at lowest level and have some shim layer on top that would
 * provide the same functionality as TTM.
 */
#define DMEM_CHUNK_SIZE
#define DMEM_CHUNK_NPAGES

enum nouveau_aper {};

nouveau_migrate_copy_t;
nouveau_clear_page_t;

struct nouveau_dmem_chunk {};

struct nouveau_dmem_migrate {};

struct nouveau_dmem {};

static struct nouveau_dmem_chunk *nouveau_page_to_chunk(struct page *page)
{}

static struct nouveau_drm *page_to_drm(struct page *page)
{}

unsigned long nouveau_dmem_page_addr(struct page *page)
{}

static void nouveau_dmem_page_free(struct page *page)
{}

static void nouveau_dmem_fence_done(struct nouveau_fence **fence)
{}

static int nouveau_dmem_copy_one(struct nouveau_drm *drm, struct page *spage,
				struct page *dpage, dma_addr_t *dma_addr)
{}

static vm_fault_t nouveau_dmem_migrate_to_ram(struct vm_fault *vmf)
{}

static const struct dev_pagemap_ops nouveau_dmem_pagemap_ops =;

static int
nouveau_dmem_chunk_alloc(struct nouveau_drm *drm, struct page **ppage)
{}

static struct page *
nouveau_dmem_page_alloc_locked(struct nouveau_drm *drm)
{}

static void
nouveau_dmem_page_free_locked(struct nouveau_drm *drm, struct page *page)
{}

void
nouveau_dmem_resume(struct nouveau_drm *drm)
{}

void
nouveau_dmem_suspend(struct nouveau_drm *drm)
{}

/*
 * Evict all pages mapping a chunk.
 */
static void
nouveau_dmem_evict_chunk(struct nouveau_dmem_chunk *chunk)
{}

void
nouveau_dmem_fini(struct nouveau_drm *drm)
{}

static int
nvc0b5_migrate_copy(struct nouveau_drm *drm, u64 npages,
		    enum nouveau_aper dst_aper, u64 dst_addr,
		    enum nouveau_aper src_aper, u64 src_addr)
{}

static int
nvc0b5_migrate_clear(struct nouveau_drm *drm, u32 length,
		     enum nouveau_aper dst_aper, u64 dst_addr)
{}

static int
nouveau_dmem_migrate_init(struct nouveau_drm *drm)
{}

void
nouveau_dmem_init(struct nouveau_drm *drm)
{}

static unsigned long nouveau_dmem_migrate_copy_one(struct nouveau_drm *drm,
		struct nouveau_svmm *svmm, unsigned long src,
		dma_addr_t *dma_addr, u64 *pfn)
{}

static void nouveau_dmem_migrate_chunk(struct nouveau_drm *drm,
		struct nouveau_svmm *svmm, struct migrate_vma *args,
		dma_addr_t *dma_addrs, u64 *pfns)
{}

int
nouveau_dmem_migrate_vma(struct nouveau_drm *drm,
			 struct nouveau_svmm *svmm,
			 struct vm_area_struct *vma,
			 unsigned long start,
			 unsigned long end)
{}