Skip to content

Commit

Permalink
drm/nouveau/ce: namespace + nvidia gpu names (no binary change)
Browse files Browse the repository at this point in the history
The namespace of NVKM is being changed to nvkm_ instead of nouveau_,
which will be used for the DRM part of the driver.  This is being
done in order to make it very clear as to what part of the driver a
given symbol belongs to, and as a minor step towards splitting the
DRM driver out to be able to stand on its own (for virt).

Because there's already a large amount of churn here anyway, this is
as good a time as any to also switch to NVIDIA's device and chipset
naming to ease collaboration with them.

A comparison of objdump disassemblies proves no code changes.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
  • Loading branch information
Ben Skeggs committed Jan 22, 2015
1 parent 912a29c commit bd6c5ca
Show file tree
Hide file tree
Showing 15 changed files with 353 additions and 375 deletions.
15 changes: 7 additions & 8 deletions drivers/gpu/drm/nouveau/include/nvkm/engine/ce.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,12 @@
#define __NVKM_CE_H__
#include <core/engine.h>

void nva3_ce_intr(struct nouveau_subdev *);

extern struct nouveau_oclass nva3_ce_oclass;
extern struct nouveau_oclass nvc0_ce0_oclass;
extern struct nouveau_oclass nvc0_ce1_oclass;
extern struct nouveau_oclass nve0_ce0_oclass;
extern struct nouveau_oclass nve0_ce1_oclass;
extern struct nouveau_oclass nve0_ce2_oclass;
void gt215_ce_intr(struct nvkm_subdev *);

extern struct nvkm_oclass gt215_ce_oclass;
extern struct nvkm_oclass gf100_ce0_oclass;
extern struct nvkm_oclass gf100_ce1_oclass;
extern struct nvkm_oclass gk104_ce0_oclass;
extern struct nvkm_oclass gk104_ce1_oclass;
extern struct nvkm_oclass gk104_ce2_oclass;
#endif
6 changes: 3 additions & 3 deletions drivers/gpu/drm/nouveau/nvkm/engine/ce/Kbuild
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
nvkm-y += nvkm/engine/ce/nva3.o
nvkm-y += nvkm/engine/ce/nvc0.o
nvkm-y += nvkm/engine/ce/nve0.o
nvkm-y += nvkm/engine/ce/gt215.o
nvkm-y += nvkm/engine/ce/gf100.o
nvkm-y += nvkm/engine/ce/gk104.o
33 changes: 13 additions & 20 deletions drivers/gpu/drm/nouveau/nvkm/engine/ce/fuc/com.fuc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* fuc microcode for copy engine on nva3- chipsets
/* fuc microcode for copy engine on gt215- chipsets
*
* Copyright 2011 Red Hat Inc.
*
Expand All @@ -23,21 +23,14 @@
* Authors: Ben Skeggs
*/

/* To build for nva3:nvc0
* m4 -DNVA3 nva3_copy.fuc | envyas -a -w -m fuc -V nva3 -o nva3_copy.fuc.h
*
* To build for nvc0-
* m4 -DNVC0 nva3_copy.fuc | envyas -a -w -m fuc -V nva3 -o nvc0_copy.fuc.h
*/

#ifdef NVA3
.section #nva3_pce_data
#ifdef GT215
.section #gt215_pce_data
#else
.section #nvc0_pce_data
.section #gf100_pce_data
#endif

ctx_object: .b32 0
#ifdef NVA3
#ifdef GT215
ctx_dma:
ctx_dma_query: .b32 0
ctx_dma_src: .b32 0
Expand Down Expand Up @@ -86,7 +79,7 @@ dispatch_table:
// mthd 0x0140, PM_TRIGGER
.b16 0x050 1
.b32 0x00010000 + #cmd_pm_trigger ~0xffffffff
#ifdef NVA3
#ifdef GT215
// mthd 0x0180-0x018c, DMA_
.b16 0x060 #ctx_dma_count
dispatch_dma:
Expand Down Expand Up @@ -134,10 +127,10 @@ dispatch_dma:
.b32 #ctx_query_counter ~0xffffffff
.b16 0x800 0

#ifdef NVA3
.section #nva3_pce_code
#ifdef GT215
.section #gt215_pce_code
#else
.section #nvc0_pce_code
.section #gf100_pce_code
#endif

main:
Expand Down Expand Up @@ -190,7 +183,7 @@ ih:
swctx:
mov $r4 0x7700
mov $xtargets $r4
#ifdef NVA3
#ifdef GT215
// target 7 hardcoded to ctx dma object
mov $xdbase $r0
#else
Expand Down Expand Up @@ -271,7 +264,7 @@ chsw:
bra e #chsw_finish_load
bset $flags $p1
call #swctx
#ifdef NVA3
#ifdef GT215
// load dma objects back into TARGET regs
mov $r5 #ctx_dma
mov $r6 #ctx_dma_count
Expand Down Expand Up @@ -396,7 +389,7 @@ cmd_pm_trigger:
iowr I[$r2] $r3
ret

#ifdef NVA3
#ifdef GT215
// SET_DMA_* method handler
//
// Inputs:
Expand Down Expand Up @@ -547,7 +540,7 @@ cmd_exec_set_surface_tiled:
ld b32 $r7 D[$r5 + #ctx_src_tile_mode]
extr $r9 $r7 8:11
extr $r8 $r7 4:7
#ifdef NVA3
#ifdef GT215
add b32 $r8 2
#else
add b32 $r8 3
Expand Down
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
#define NVA3
#define GF100
#include "com.fuc"
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
uint32_t nvc0_pce_data[] = {
uint32_t gf100_pce_data[] = {
/* 0x0000: ctx_object */
0x00000000,
/* 0x0004: ctx_query_address_high */
Expand Down Expand Up @@ -171,7 +171,7 @@ uint32_t nvc0_pce_data[] = {
0x00000800,
};

uint32_t nvc0_pce_code[] = {
uint32_t gf100_pce_code[] = {
/* 0x0000: main */
0x04fe04bd,
0x3517f000,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
#define NVC0
#define GT215
#include "com.fuc"
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
uint32_t nva3_pce_data[] = {
uint32_t gt215_pce_data[] = {
/* 0x0000: ctx_object */
0x00000000,
/* 0x0004: ctx_dma */
Expand Down Expand Up @@ -183,7 +183,7 @@ uint32_t nva3_pce_data[] = {
0x00000800,
};

uint32_t nva3_pce_code[] = {
uint32_t gt215_pce_code[] = {
/* 0x0000: main */
0x04fe04bd,
0x3517f000,
Expand Down
166 changes: 166 additions & 0 deletions drivers/gpu/drm/nouveau/nvkm/engine/ce/gf100.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,166 @@
/*
* 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 <engine/ce.h>
#include <engine/falcon.h>
#include "fuc/gf100.fuc3.h"

struct gf100_ce_priv {
struct nvkm_falcon base;
};

/*******************************************************************************
* Copy object classes
******************************************************************************/

static struct nvkm_oclass
gf100_ce0_sclass[] = {
{ 0x90b5, &nvkm_object_ofuncs },
{},
};

static struct nvkm_oclass
gf100_ce1_sclass[] = {
{ 0x90b8, &nvkm_object_ofuncs },
{},
};

/*******************************************************************************
* PCE context
******************************************************************************/

static struct nvkm_ofuncs
gf100_ce_context_ofuncs = {
.ctor = _nvkm_falcon_context_ctor,
.dtor = _nvkm_falcon_context_dtor,
.init = _nvkm_falcon_context_init,
.fini = _nvkm_falcon_context_fini,
.rd32 = _nvkm_falcon_context_rd32,
.wr32 = _nvkm_falcon_context_wr32,
};

static struct nvkm_oclass
gf100_ce0_cclass = {
.handle = NV_ENGCTX(CE0, 0xc0),
.ofuncs = &gf100_ce_context_ofuncs,
};

static struct nvkm_oclass
gf100_ce1_cclass = {
.handle = NV_ENGCTX(CE1, 0xc0),
.ofuncs = &gf100_ce_context_ofuncs,
};

/*******************************************************************************
* PCE engine/subdev functions
******************************************************************************/

static int
gf100_ce_init(struct nvkm_object *object)
{
struct gf100_ce_priv *priv = (void *)object;
int ret;

ret = nvkm_falcon_init(&priv->base);
if (ret)
return ret;

nv_wo32(priv, 0x084, nv_engidx(&priv->base.base) - NVDEV_ENGINE_CE0);
return 0;
}

static int
gf100_ce0_ctor(struct nvkm_object *parent, struct nvkm_object *engine,
struct nvkm_oclass *oclass, void *data, u32 size,
struct nvkm_object **pobject)
{
struct gf100_ce_priv *priv;
int ret;

ret = nvkm_falcon_create(parent, engine, oclass, 0x104000, true,
"PCE0", "ce0", &priv);
*pobject = nv_object(priv);
if (ret)
return ret;

nv_subdev(priv)->unit = 0x00000040;
nv_subdev(priv)->intr = gt215_ce_intr;
nv_engine(priv)->cclass = &gf100_ce0_cclass;
nv_engine(priv)->sclass = gf100_ce0_sclass;
nv_falcon(priv)->code.data = gf100_pce_code;
nv_falcon(priv)->code.size = sizeof(gf100_pce_code);
nv_falcon(priv)->data.data = gf100_pce_data;
nv_falcon(priv)->data.size = sizeof(gf100_pce_data);
return 0;
}

static int
gf100_ce1_ctor(struct nvkm_object *parent, struct nvkm_object *engine,
struct nvkm_oclass *oclass, void *data, u32 size,
struct nvkm_object **pobject)
{
struct gf100_ce_priv *priv;
int ret;

ret = nvkm_falcon_create(parent, engine, oclass, 0x105000, true,
"PCE1", "ce1", &priv);
*pobject = nv_object(priv);
if (ret)
return ret;

nv_subdev(priv)->unit = 0x00000080;
nv_subdev(priv)->intr = gt215_ce_intr;
nv_engine(priv)->cclass = &gf100_ce1_cclass;
nv_engine(priv)->sclass = gf100_ce1_sclass;
nv_falcon(priv)->code.data = gf100_pce_code;
nv_falcon(priv)->code.size = sizeof(gf100_pce_code);
nv_falcon(priv)->data.data = gf100_pce_data;
nv_falcon(priv)->data.size = sizeof(gf100_pce_data);
return 0;
}

struct nvkm_oclass
gf100_ce0_oclass = {
.handle = NV_ENGINE(CE0, 0xc0),
.ofuncs = &(struct nvkm_ofuncs) {
.ctor = gf100_ce0_ctor,
.dtor = _nvkm_falcon_dtor,
.init = gf100_ce_init,
.fini = _nvkm_falcon_fini,
.rd32 = _nvkm_falcon_rd32,
.wr32 = _nvkm_falcon_wr32,
},
};

struct nvkm_oclass
gf100_ce1_oclass = {
.handle = NV_ENGINE(CE1, 0xc0),
.ofuncs = &(struct nvkm_ofuncs) {
.ctor = gf100_ce1_ctor,
.dtor = _nvkm_falcon_dtor,
.init = gf100_ce_init,
.fini = _nvkm_falcon_fini,
.rd32 = _nvkm_falcon_rd32,
.wr32 = _nvkm_falcon_wr32,
},
};
Loading

0 comments on commit bd6c5ca

Please sign in to comment.