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
6c762d1b
Commit
6c762d1b
authored
Feb 15, 2019
by
Ben Skeggs
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
drm/nouveau/dmem: extend copy function to allow direct use of physical addresses
Signed-off-by:
Ben Skeggs
<
bskeggs@redhat.com
>
parent
f180bf12
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
50 additions
and
6 deletions
+50
-6
drivers/gpu/drm/nouveau/nouveau_dmem.c
drivers/gpu/drm/nouveau/nouveau_dmem.c
+50
-6
No files found.
drivers/gpu/drm/nouveau/nouveau_dmem.c
View file @
6c762d1b
...
...
@@ -46,8 +46,15 @@
struct
nouveau_migrate
;
enum
nouveau_aper
{
NOUVEAU_APER_VIRT
,
NOUVEAU_APER_VRAM
,
NOUVEAU_APER_HOST
,
};
typedef
int
(
*
nouveau_migrate_copy_t
)(
struct
nouveau_drm
*
drm
,
u64
npages
,
u64
dst_addr
,
u64
src_addr
);
enum
nouveau_aper
,
u64
dst_addr
,
enum
nouveau_aper
,
u64
src_addr
);
struct
nouveau_dmem_chunk
{
struct
list_head
list
;
...
...
@@ -267,7 +274,8 @@ nouveau_dmem_fault_alloc_and_copy(struct vm_area_struct *vma,
src_addr
=
page_to_pfn
(
spage
)
-
chunk
->
pfn_first
;
src_addr
=
(
src_addr
<<
PAGE_SHIFT
)
+
chunk
->
vma
.
addr
;
ret
=
copy
(
drm
,
1
,
dst_addr
,
src_addr
);
ret
=
copy
(
drm
,
1
,
NOUVEAU_APER_VIRT
,
dst_addr
,
NOUVEAU_APER_VIRT
,
src_addr
);
if
(
ret
)
{
dst_pfns
[
i
]
=
MIGRATE_PFN_ERROR
;
__free_page
(
dpage
);
...
...
@@ -588,15 +596,49 @@ nouveau_dmem_fini(struct nouveau_drm *drm)
static
int
nvc0b5_migrate_copy
(
struct
nouveau_drm
*
drm
,
u64
npages
,
u64
dst_addr
,
u64
src_addr
)
enum
nouveau_aper
dst_aper
,
u64
dst_addr
,
enum
nouveau_aper
src_aper
,
u64
src_addr
)
{
struct
nouveau_channel
*
chan
=
drm
->
dmem
->
migrate
.
chan
;
u32
launch_dma
=
(
1
<<
9
)
/* MULTI_LINE_ENABLE. */
|
(
1
<<
8
)
/* DST_MEMORY_LAYOUT_PITCH. */
|
(
1
<<
7
)
/* SRC_MEMORY_LAYOUT_PITCH. */
|
(
1
<<
2
)
/* FLUSH_ENABLE_TRUE. */
|
(
2
<<
0
)
/* DATA_TRANSFER_TYPE_NON_PIPELINED. */
;
int
ret
;
ret
=
RING_SPACE
(
chan
,
1
0
);
ret
=
RING_SPACE
(
chan
,
1
3
);
if
(
ret
)
return
ret
;
if
(
src_aper
!=
NOUVEAU_APER_VIRT
)
{
switch
(
src_aper
)
{
case
NOUVEAU_APER_VRAM
:
BEGIN_IMC0
(
chan
,
NvSubCopy
,
0x0260
,
0
);
break
;
case
NOUVEAU_APER_HOST
:
BEGIN_IMC0
(
chan
,
NvSubCopy
,
0x0260
,
1
);
break
;
default:
return
-
EINVAL
;
}
launch_dma
|=
0x00001000
;
/* SRC_TYPE_PHYSICAL. */
}
if
(
dst_aper
!=
NOUVEAU_APER_VIRT
)
{
switch
(
dst_aper
)
{
case
NOUVEAU_APER_VRAM
:
BEGIN_IMC0
(
chan
,
NvSubCopy
,
0x0264
,
0
);
break
;
case
NOUVEAU_APER_HOST
:
BEGIN_IMC0
(
chan
,
NvSubCopy
,
0x0264
,
1
);
break
;
default:
return
-
EINVAL
;
}
launch_dma
|=
0x00002000
;
/* DST_TYPE_PHYSICAL. */
}
BEGIN_NVC0
(
chan
,
NvSubCopy
,
0x0400
,
8
);
OUT_RING
(
chan
,
upper_32_bits
(
src_addr
));
OUT_RING
(
chan
,
lower_32_bits
(
src_addr
));
...
...
@@ -606,7 +648,8 @@ nvc0b5_migrate_copy(struct nouveau_drm *drm, u64 npages,
OUT_RING
(
chan
,
PAGE_SIZE
);
OUT_RING
(
chan
,
PAGE_SIZE
);
OUT_RING
(
chan
,
npages
);
BEGIN_IMC0
(
chan
,
NvSubCopy
,
0x0300
,
0x0386
);
BEGIN_NVC0
(
chan
,
NvSubCopy
,
0x0300
,
1
);
OUT_RING
(
chan
,
launch_dma
);
return
0
;
}
...
...
@@ -761,7 +804,8 @@ nouveau_dmem_migrate_alloc_and_copy(struct vm_area_struct *vma,
src_addr
=
migrate
->
hmem
.
vma
.
addr
+
(
c
<<
PAGE_SHIFT
);
c
++
;
ret
=
copy
(
drm
,
1
,
dst_addr
,
src_addr
);
ret
=
copy
(
drm
,
1
,
NOUVEAU_APER_VIRT
,
dst_addr
,
NOUVEAU_APER_VIRT
,
src_addr
);
if
(
ret
)
{
nouveau_dmem_page_free_locked
(
drm
,
dpage
);
dst_pfns
[
i
]
=
0
;
...
...
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