cregit-Linux how code gets into the kernel

Release 4.17 drivers/gpu/drm/nouveau/nouveau_sgdma.c

// SPDX-License-Identifier: GPL-2.0
#include <linux/pagemap.h>
#include <linux/slab.h>

#include "nouveau_drv.h"
#include "nouveau_mem.h"
#include "nouveau_ttm.h"


struct nouveau_sgdma_be {
	/* this has to be the first field so populate/unpopulated in
         * nouve_bo.c works properly, otherwise have to move them here
         */
	
struct ttm_dma_tt ttm;
	
struct nouveau_mem *mem;
};


static void nouveau_sgdma_destroy(struct ttm_tt *ttm) { struct nouveau_sgdma_be *nvbe = (struct nouveau_sgdma_be *)ttm; if (ttm) { ttm_dma_tt_fini(&nvbe->ttm); kfree(nvbe); } }

Contributors

PersonTokensPropCommitsCommitProp
Ben Skeggs3071.43%250.00%
Jérôme Glisse1228.57%250.00%
Total42100.00%4100.00%


static int nv04_sgdma_bind(struct ttm_tt *ttm, struct ttm_mem_reg *reg) { struct nouveau_sgdma_be *nvbe = (struct nouveau_sgdma_be *)ttm; struct nouveau_mem *mem = nouveau_mem(reg); int ret; ret = nouveau_mem_host(reg, &nvbe->ttm); if (ret) return ret; ret = nouveau_mem_map(mem, &mem->cli->vmm.vmm, &mem->vma[0]); if (ret) { nouveau_mem_fini(mem); return ret; } nvbe->mem = mem; return 0; }

Contributors

PersonTokensPropCommitsCommitProp
Ben Skeggs10295.33%777.78%
Jérôme Glisse54.67%222.22%
Total107100.00%9100.00%


static int nv04_sgdma_unbind(struct ttm_tt *ttm) { struct nouveau_sgdma_be *nvbe = (struct nouveau_sgdma_be *)ttm; nouveau_mem_fini(nvbe->mem); return 0; }

Contributors

PersonTokensPropCommitsCommitProp
Ben Skeggs3090.91%583.33%
Jérôme Glisse39.09%116.67%
Total33100.00%6100.00%

static struct ttm_backend_func nv04_sgdma_backend = { .bind = nv04_sgdma_bind, .unbind = nv04_sgdma_unbind, .destroy = nouveau_sgdma_destroy };
static int nv50_sgdma_bind(struct ttm_tt *ttm, struct ttm_mem_reg *reg) { struct nouveau_sgdma_be *nvbe = (struct nouveau_sgdma_be *)ttm; struct nouveau_mem *mem = nouveau_mem(reg); int ret; ret = nouveau_mem_host(reg, &nvbe->ttm); if (ret) return ret; nvbe->mem = mem; return 0; }

Contributors

PersonTokensPropCommitsCommitProp
Ben Skeggs6492.75%880.00%
Jérôme Glisse57.25%220.00%
Total69100.00%10100.00%

static struct ttm_backend_func nv50_sgdma_backend = { .bind = nv50_sgdma_bind, .unbind = nv04_sgdma_unbind, .destroy = nouveau_sgdma_destroy };
struct ttm_tt * nouveau_sgdma_create_ttm(struct ttm_buffer_object *bo, uint32_t page_flags) { struct nouveau_drm *drm = nouveau_bdev(bo->bdev); struct nouveau_sgdma_be *nvbe; nvbe = kzalloc(sizeof(*nvbe), GFP_KERNEL); if (!nvbe) return NULL; if (drm->client.device.info.family < NV_DEVICE_INFO_V0_TESLA) nvbe->ttm.ttm.func = &nv04_sgdma_backend; else nvbe->ttm.ttm.func = &nv50_sgdma_backend; if (ttm_dma_tt_init(&nvbe->ttm, bo, page_flags)) /* * A failing ttm_dma_tt_init() will call ttm_tt_destroy() * and thus our nouveau_sgdma_destroy() hook, so we don't need * to free nvbe here. */ return NULL; return &nvbe->ttm.ttm; }

Contributors

PersonTokensPropCommitsCommitProp
Ben Skeggs9581.90%758.33%
Jérôme Glisse119.48%18.33%
Christian König54.31%18.33%
Lucas Stach32.59%18.33%
Jon Mason10.86%18.33%
Alexandre Courbot10.86%18.33%
Total116100.00%12100.00%


Overall Contributors

PersonTokensPropCommitsCommitProp
Ben Skeggs39288.69%1669.57%
Jérôme Glisse398.82%28.70%
Christian König51.13%14.35%
Lucas Stach30.68%14.35%
Alexandre Courbot10.23%14.35%
Greg Kroah-Hartman10.23%14.35%
Jon Mason10.23%14.35%
Total442100.00%23100.00%
Information contained on this website is for historical information purposes only and does not indicate or represent copyright ownership.
Created with cregit.