Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
linux
Commits
cd821077
Commit
cd821077
authored
Aug 20, 2015
by
Ben Skeggs
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
drm/nouveau/mmu: switch to gpuobj accessor macros
Signed-off-by:
Ben Skeggs
<
bskeggs@redhat.com
>
parent
19187075
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
68 additions
and
38 deletions
+68
-38
drivers/gpu/drm/nouveau/nvkm/subdev/mmu/gf100.c
drivers/gpu/drm/nouveau/nvkm/subdev/mmu/gf100.c
+16
-8
drivers/gpu/drm/nouveau/nvkm/subdev/mmu/nv04.c
drivers/gpu/drm/nouveau/nvkm/subdev/mmu/nv04.c
+10
-4
drivers/gpu/drm/nouveau/nvkm/subdev/mmu/nv41.c
drivers/gpu/drm/nouveau/nvkm/subdev/mmu/nv41.c
+6
-2
drivers/gpu/drm/nouveau/nvkm/subdev/mmu/nv44.c
drivers/gpu/drm/nouveau/nvkm/subdev/mmu/nv44.c
+20
-16
drivers/gpu/drm/nouveau/nvkm/subdev/mmu/nv50.c
drivers/gpu/drm/nouveau/nvkm/subdev/mmu/nv50.c
+16
-8
No files found.
drivers/gpu/drm/nouveau/nvkm/subdev/mmu/gf100.c
View file @
cd821077
...
...
@@ -79,8 +79,10 @@ gf100_vm_map_pgt(struct nvkm_gpuobj *pgd, u32 index, struct nvkm_gpuobj *pgt[2])
if
(
pgt
[
1
])
pde
[
0
]
=
0x00000001
|
(
pgt
[
1
]
->
addr
>>
8
);
nv_wo32
(
pgd
,
(
index
*
8
)
+
0
,
pde
[
0
]);
nv_wo32
(
pgd
,
(
index
*
8
)
+
4
,
pde
[
1
]);
nvkm_kmap
(
pgd
);
nvkm_wo32
(
pgd
,
(
index
*
8
)
+
0
,
pde
[
0
]);
nvkm_wo32
(
pgd
,
(
index
*
8
)
+
4
,
pde
[
1
]);
nvkm_done
(
pgd
);
}
static
inline
u64
...
...
@@ -114,12 +116,14 @@ gf100_vm_map(struct nvkm_vma *vma, struct nvkm_gpuobj *pgt,
ltc
->
tags_clear
(
ltc
,
tag
,
cnt
);
}
nvkm_kmap
(
pgt
);
while
(
cnt
--
)
{
nv_wo32
(
pgt
,
pte
+
0
,
lower_32_bits
(
phys
));
nv_wo32
(
pgt
,
pte
+
4
,
upper_32_bits
(
phys
));
nv
km
_wo32
(
pgt
,
pte
+
0
,
lower_32_bits
(
phys
));
nv
km
_wo32
(
pgt
,
pte
+
4
,
upper_32_bits
(
phys
));
phys
+=
next
;
pte
+=
8
;
}
nvkm_done
(
pgt
);
}
static
void
...
...
@@ -130,24 +134,28 @@ gf100_vm_map_sg(struct nvkm_vma *vma, struct nvkm_gpuobj *pgt,
/* compressed storage types are invalid for system memory */
u32
memtype
=
gf100_pte_storage_type_map
[
mem
->
memtype
&
0xff
];
nvkm_kmap
(
pgt
);
pte
<<=
3
;
while
(
cnt
--
)
{
u64
phys
=
gf100_vm_addr
(
vma
,
*
list
++
,
memtype
,
target
);
nv_wo32
(
pgt
,
pte
+
0
,
lower_32_bits
(
phys
));
nv_wo32
(
pgt
,
pte
+
4
,
upper_32_bits
(
phys
));
nv
km
_wo32
(
pgt
,
pte
+
0
,
lower_32_bits
(
phys
));
nv
km
_wo32
(
pgt
,
pte
+
4
,
upper_32_bits
(
phys
));
pte
+=
8
;
}
nvkm_done
(
pgt
);
}
static
void
gf100_vm_unmap
(
struct
nvkm_gpuobj
*
pgt
,
u32
pte
,
u32
cnt
)
{
nvkm_kmap
(
pgt
);
pte
<<=
3
;
while
(
cnt
--
)
{
nv_wo32
(
pgt
,
pte
+
0
,
0x00000000
);
nv_wo32
(
pgt
,
pte
+
4
,
0x00000000
);
nv
km
_wo32
(
pgt
,
pte
+
0
,
0x00000000
);
nv
km
_wo32
(
pgt
,
pte
+
4
,
0x00000000
);
pte
+=
8
;
}
nvkm_done
(
pgt
);
}
static
void
...
...
drivers/gpu/drm/nouveau/nvkm/subdev/mmu/nv04.c
View file @
cd821077
...
...
@@ -37,26 +37,30 @@ nv04_vm_map_sg(struct nvkm_vma *vma, struct nvkm_gpuobj *pgt,
struct
nvkm_mem
*
mem
,
u32
pte
,
u32
cnt
,
dma_addr_t
*
list
)
{
pte
=
0x00008
+
(
pte
*
4
);
nvkm_kmap
(
pgt
);
while
(
cnt
)
{
u32
page
=
PAGE_SIZE
/
NV04_PDMA_PAGE
;
u32
phys
=
(
u32
)
*
list
++
;
while
(
cnt
&&
page
--
)
{
nv_wo32
(
pgt
,
pte
,
phys
|
3
);
nv
km
_wo32
(
pgt
,
pte
,
phys
|
3
);
phys
+=
NV04_PDMA_PAGE
;
pte
+=
4
;
cnt
-=
1
;
}
}
nvkm_done
(
pgt
);
}
static
void
nv04_vm_unmap
(
struct
nvkm_gpuobj
*
pgt
,
u32
pte
,
u32
cnt
)
{
pte
=
0x00008
+
(
pte
*
4
);
nvkm_kmap
(
pgt
);
while
(
cnt
--
)
{
nv_wo32
(
pgt
,
pte
,
0x00000000
);
nv
km
_wo32
(
pgt
,
pte
,
0x00000000
);
pte
+=
4
;
}
nvkm_done
(
pgt
);
}
static
void
...
...
@@ -118,8 +122,10 @@ nv04_mmu_ctor(struct nvkm_object *parent, struct nvkm_object *engine,
if
(
ret
)
return
ret
;
nv_wo32
(
dma
,
0x00000
,
0x0002103d
);
/* PCI, RW, PT, !LN */
nv_wo32
(
dma
,
0x00004
,
NV04_PDMA_SIZE
-
1
);
nvkm_kmap
(
dma
);
nvkm_wo32
(
dma
,
0x00000
,
0x0002103d
);
/* PCI, RW, PT, !LN */
nvkm_wo32
(
dma
,
0x00004
,
NV04_PDMA_SIZE
-
1
);
nvkm_done
(
dma
);
return
0
;
}
...
...
drivers/gpu/drm/nouveau/nvkm/subdev/mmu/nv41.c
View file @
cd821077
...
...
@@ -39,26 +39,30 @@ nv41_vm_map_sg(struct nvkm_vma *vma, struct nvkm_gpuobj *pgt,
struct
nvkm_mem
*
mem
,
u32
pte
,
u32
cnt
,
dma_addr_t
*
list
)
{
pte
=
pte
*
4
;
nvkm_kmap
(
pgt
);
while
(
cnt
)
{
u32
page
=
PAGE_SIZE
/
NV41_GART_PAGE
;
u64
phys
=
(
u64
)
*
list
++
;
while
(
cnt
&&
page
--
)
{
nv_wo32
(
pgt
,
pte
,
(
phys
>>
7
)
|
1
);
nv
km
_wo32
(
pgt
,
pte
,
(
phys
>>
7
)
|
1
);
phys
+=
NV41_GART_PAGE
;
pte
+=
4
;
cnt
-=
1
;
}
}
nvkm_done
(
pgt
);
}
static
void
nv41_vm_unmap
(
struct
nvkm_gpuobj
*
pgt
,
u32
pte
,
u32
cnt
)
{
pte
=
pte
*
4
;
nvkm_kmap
(
pgt
);
while
(
cnt
--
)
{
nv_wo32
(
pgt
,
pte
,
0x00000000
);
nv
km
_wo32
(
pgt
,
pte
,
0x00000000
);
pte
+=
4
;
}
nvkm_done
(
pgt
);
}
static
void
...
...
drivers/gpu/drm/nouveau/nvkm/subdev/mmu/nv44.c
View file @
cd821077
...
...
@@ -41,10 +41,10 @@ nv44_vm_fill(struct nvkm_gpuobj *pgt, dma_addr_t null,
u32
base
=
(
pte
<<
2
)
&
~
0x0000000f
;
u32
tmp
[
4
];
tmp
[
0
]
=
nv_ro32
(
pgt
,
base
+
0x0
);
tmp
[
1
]
=
nv_ro32
(
pgt
,
base
+
0x4
);
tmp
[
2
]
=
nv_ro32
(
pgt
,
base
+
0x8
);
tmp
[
3
]
=
nv_ro32
(
pgt
,
base
+
0xc
);
tmp
[
0
]
=
nv
km
_ro32
(
pgt
,
base
+
0x0
);
tmp
[
1
]
=
nv
km
_ro32
(
pgt
,
base
+
0x4
);
tmp
[
2
]
=
nv
km
_ro32
(
pgt
,
base
+
0x8
);
tmp
[
3
]
=
nv
km
_ro32
(
pgt
,
base
+
0xc
);
while
(
cnt
--
)
{
u32
addr
=
list
?
(
*
list
++
>>
12
)
:
(
null
>>
12
);
...
...
@@ -74,10 +74,10 @@ nv44_vm_fill(struct nvkm_gpuobj *pgt, dma_addr_t null,
}
}
nv_wo32
(
pgt
,
base
+
0x0
,
tmp
[
0
]);
nv_wo32
(
pgt
,
base
+
0x4
,
tmp
[
1
]);
nv_wo32
(
pgt
,
base
+
0x8
,
tmp
[
2
]);
nv_wo32
(
pgt
,
base
+
0xc
,
tmp
[
3
]
|
0x40000000
);
nv
km
_wo32
(
pgt
,
base
+
0x0
,
tmp
[
0
]);
nv
km
_wo32
(
pgt
,
base
+
0x4
,
tmp
[
1
]);
nv
km
_wo32
(
pgt
,
base
+
0x8
,
tmp
[
2
]);
nv
km
_wo32
(
pgt
,
base
+
0xc
,
tmp
[
3
]
|
0x40000000
);
}
static
void
...
...
@@ -88,6 +88,7 @@ nv44_vm_map_sg(struct nvkm_vma *vma, struct nvkm_gpuobj *pgt,
u32
tmp
[
4
];
int
i
;
nvkm_kmap
(
pgt
);
if
(
pte
&
3
)
{
u32
max
=
4
-
(
pte
&
3
);
u32
part
=
(
cnt
>
max
)
?
max
:
cnt
;
...
...
@@ -100,15 +101,16 @@ nv44_vm_map_sg(struct nvkm_vma *vma, struct nvkm_gpuobj *pgt,
while
(
cnt
>=
4
)
{
for
(
i
=
0
;
i
<
4
;
i
++
)
tmp
[
i
]
=
*
list
++
>>
12
;
nv_wo32
(
pgt
,
pte
++
*
4
,
tmp
[
0
]
>>
0
|
tmp
[
1
]
<<
27
);
nv_wo32
(
pgt
,
pte
++
*
4
,
tmp
[
1
]
>>
5
|
tmp
[
2
]
<<
22
);
nv_wo32
(
pgt
,
pte
++
*
4
,
tmp
[
2
]
>>
10
|
tmp
[
3
]
<<
17
);
nv_wo32
(
pgt
,
pte
++
*
4
,
tmp
[
3
]
>>
15
|
0x40000000
);
nv
km
_wo32
(
pgt
,
pte
++
*
4
,
tmp
[
0
]
>>
0
|
tmp
[
1
]
<<
27
);
nv
km
_wo32
(
pgt
,
pte
++
*
4
,
tmp
[
1
]
>>
5
|
tmp
[
2
]
<<
22
);
nv
km
_wo32
(
pgt
,
pte
++
*
4
,
tmp
[
2
]
>>
10
|
tmp
[
3
]
<<
17
);
nv
km
_wo32
(
pgt
,
pte
++
*
4
,
tmp
[
3
]
>>
15
|
0x40000000
);
cnt
-=
4
;
}
if
(
cnt
)
nv44_vm_fill
(
pgt
,
mmu
->
null
,
list
,
pte
,
cnt
);
nvkm_done
(
pgt
);
}
static
void
...
...
@@ -116,6 +118,7 @@ nv44_vm_unmap(struct nvkm_gpuobj *pgt, u32 pte, u32 cnt)
{
struct
nv04_mmu
*
mmu
=
(
void
*
)
nvkm_mmu
(
pgt
);
nvkm_kmap
(
pgt
);
if
(
pte
&
3
)
{
u32
max
=
4
-
(
pte
&
3
);
u32
part
=
(
cnt
>
max
)
?
max
:
cnt
;
...
...
@@ -125,15 +128,16 @@ nv44_vm_unmap(struct nvkm_gpuobj *pgt, u32 pte, u32 cnt)
}
while
(
cnt
>=
4
)
{
nv_wo32
(
pgt
,
pte
++
*
4
,
0x00000000
);
nv_wo32
(
pgt
,
pte
++
*
4
,
0x00000000
);
nv_wo32
(
pgt
,
pte
++
*
4
,
0x00000000
);
nv_wo32
(
pgt
,
pte
++
*
4
,
0x00000000
);
nv
km
_wo32
(
pgt
,
pte
++
*
4
,
0x00000000
);
nv
km
_wo32
(
pgt
,
pte
++
*
4
,
0x00000000
);
nv
km
_wo32
(
pgt
,
pte
++
*
4
,
0x00000000
);
nv
km
_wo32
(
pgt
,
pte
++
*
4
,
0x00000000
);
cnt
-=
4
;
}
if
(
cnt
)
nv44_vm_fill
(
pgt
,
mmu
->
null
,
NULL
,
pte
,
cnt
);
nvkm_done
(
pgt
);
}
static
void
...
...
drivers/gpu/drm/nouveau/nvkm/subdev/mmu/nv50.c
View file @
cd821077
...
...
@@ -53,8 +53,10 @@ nv50_vm_map_pgt(struct nvkm_gpuobj *pgd, u32 pde, struct nvkm_gpuobj *pgt[2])
phys
|=
0x20
;
}
nv_wo32
(
pgd
,
(
pde
*
8
)
+
0
,
lower_32_bits
(
phys
));
nv_wo32
(
pgd
,
(
pde
*
8
)
+
4
,
upper_32_bits
(
phys
));
nvkm_kmap
(
pgd
);
nvkm_wo32
(
pgd
,
(
pde
*
8
)
+
0
,
lower_32_bits
(
phys
));
nvkm_wo32
(
pgd
,
(
pde
*
8
)
+
4
,
upper_32_bits
(
phys
));
nvkm_done
(
pgd
);
}
static
inline
u64
...
...
@@ -89,6 +91,7 @@ nv50_vm_map(struct nvkm_vma *vma, struct nvkm_gpuobj *pgt,
pte
<<=
3
;
cnt
<<=
3
;
nvkm_kmap
(
pgt
);
while
(
cnt
)
{
u32
offset_h
=
upper_32_bits
(
phys
);
u32
offset_l
=
lower_32_bits
(
phys
);
...
...
@@ -109,12 +112,13 @@ nv50_vm_map(struct nvkm_vma *vma, struct nvkm_gpuobj *pgt,
}
while
(
block
)
{
nv_wo32
(
pgt
,
pte
+
0
,
offset_l
);
nv_wo32
(
pgt
,
pte
+
4
,
offset_h
);
nv
km
_wo32
(
pgt
,
pte
+
0
,
offset_l
);
nv
km
_wo32
(
pgt
,
pte
+
4
,
offset_h
);
pte
+=
8
;
block
-=
8
;
}
}
nvkm_done
(
pgt
);
}
static
void
...
...
@@ -123,23 +127,27 @@ nv50_vm_map_sg(struct nvkm_vma *vma, struct nvkm_gpuobj *pgt,
{
u32
target
=
(
vma
->
access
&
NV_MEM_ACCESS_NOSNOOP
)
?
3
:
2
;
pte
<<=
3
;
nvkm_kmap
(
pgt
);
while
(
cnt
--
)
{
u64
phys
=
vm_addr
(
vma
,
(
u64
)
*
list
++
,
mem
->
memtype
,
target
);
nv_wo32
(
pgt
,
pte
+
0
,
lower_32_bits
(
phys
));
nv_wo32
(
pgt
,
pte
+
4
,
upper_32_bits
(
phys
));
nv
km
_wo32
(
pgt
,
pte
+
0
,
lower_32_bits
(
phys
));
nv
km
_wo32
(
pgt
,
pte
+
4
,
upper_32_bits
(
phys
));
pte
+=
8
;
}
nvkm_done
(
pgt
);
}
static
void
nv50_vm_unmap
(
struct
nvkm_gpuobj
*
pgt
,
u32
pte
,
u32
cnt
)
{
pte
<<=
3
;
nvkm_kmap
(
pgt
);
while
(
cnt
--
)
{
nv_wo32
(
pgt
,
pte
+
0
,
0x00000000
);
nv_wo32
(
pgt
,
pte
+
4
,
0x00000000
);
nv
km
_wo32
(
pgt
,
pte
+
0
,
0x00000000
);
nv
km
_wo32
(
pgt
,
pte
+
4
,
0x00000000
);
pte
+=
8
;
}
nvkm_done
(
pgt
);
}
static
void
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment