cregit-Linux how code gets into the kernel

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

#include <linux/pagemap.h>
#include <linux/slab.h>

#include "nouveau_drv.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 nvkm_mem *node;
};


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 nvkm_mem *node = reg->mm_node; if (ttm->sg) { node->sg = ttm->sg; node->pages = NULL; } else { node->sg = NULL; node->pages = nvbe->ttm.dma_address; } node->size = (reg->num_pages << PAGE_SHIFT) >> 12; nvkm_vm_map(&node->vma[0], node); nvbe->node = node; return 0; }

Contributors

PersonTokensPropCommitsCommitProp
Ben Skeggs10793.86%777.78%
Jérôme Glisse76.14%222.22%
Total114100.00%9100.00%


static int nv04_sgdma_unbind(struct ttm_tt *ttm) { struct nouveau_sgdma_be *nvbe = (struct nouveau_sgdma_be *)ttm; nvkm_vm_unmap(&nvbe->node->vma[0]); return 0; }

Contributors

PersonTokensPropCommitsCommitProp
Ben Skeggs3692.31%685.71%
Jérôme Glisse37.69%114.29%
Total39100.00%7100.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 nvkm_mem *node = reg->mm_node; /* noop: bound in move_notify() */ if (ttm->sg) { node->sg = ttm->sg; node->pages = NULL; } else { node->sg = NULL; node->pages = nvbe->ttm.dma_address; } node->size = (reg->num_pages << PAGE_SHIFT) >> 12; return 0; }

Contributors

PersonTokensPropCommitsCommitProp
Ben Skeggs7173.96%872.73%
Dave Airlie1717.71%19.09%
Jérôme Glisse88.33%218.18%
Total96100.00%11100.00%


static int nv50_sgdma_unbind(struct ttm_tt *ttm) { /* noop: unbound in move_notify() */ return 0; }

Contributors

PersonTokensPropCommitsCommitProp
Ben Skeggs1386.67%375.00%
Jérôme Glisse213.33%125.00%
Total15100.00%4100.00%

static struct ttm_backend_func nv50_sgdma_backend = { .bind = nv50_sgdma_bind, .unbind = nv50_sgdma_unbind, .destroy = nouveau_sgdma_destroy };
struct ttm_tt * nouveau_sgdma_create_ttm(struct ttm_bo_device *bdev, unsigned long size, uint32_t page_flags, struct page *dummy_read_page) { struct nouveau_drm *drm = nouveau_bdev(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, bdev, size, page_flags, dummy_read_page)) /* * 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 Skeggs10078.74%763.64%
Jérôme Glisse2217.32%19.09%
Lucas Stach32.36%19.09%
Alexandre Courbot10.79%19.09%
Jon Mason10.79%19.09%
Total127100.00%11100.00%


Overall Contributors

PersonTokensPropCommitsCommitProp
Ben Skeggs42584.33%1571.43%
Jérôme Glisse5711.31%29.52%
Dave Airlie173.37%14.76%
Lucas Stach30.60%14.76%
Alexandre Courbot10.20%14.76%
Jon Mason10.20%14.76%
Total504100.00%21100.00%
Information contained on this website is for historical information purposes only and does not indicate or represent copyright ownership.
Created with cregit.