drm/ttm: remove TTM_PAGE_FLAG_WRITE
Subsystems (7)
PATCH 1/8 drm/ttm: remove TTM_PAGE_FLAG_WRITE
Not used any more.
--- include/drm/ttm/ttm_tt.h | 1 - 1 file changed, 1 deletion(-)
include/drm/ttm/ttm_tt.h +0 -1
@@ -34,7 +34,6 @@ struct ttm_resource;struct ttm_buffer_object ;struct ttm_operation_ctx ; -#define TTM_PAGE_FLAG_WRITE (1 << 3)#define TTM_PAGE_FLAG_SWAPPED (1 << 4)#define TTM_PAGE_FLAG_ZERO_ALLOC (1 << 6)#define TTM_PAGE_FLAG_DMA32 (1 << 7)
Signature · 6 lines
2.17.1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 2/8 drm/ttm: move ttm_set_memory.h out of include
This is not something drivers should use.
---
drivers/gpu/drm/ttm/ttm_page_alloc.c | 3 ++-
drivers/gpu/drm/ttm/ttm_page_alloc_dma.c | 3 ++-
{include => drivers/gpu}/drm/ttm/ttm_set_memory.h | 0
3 files changed, 4 insertions(+), 2 deletions(-)
rename {include => drivers/gpu}/drm/ttm/ttm_set_memory.h (100%)drivers/gpu/drm/ttm/ttm_page_alloc.c +2 -1
@@ -47,7 +47,8 @@#include <drm/ttm/ttm_bo_driver.h> #include <drm/ttm/ttm_page_alloc.h> -#include <drm/ttm/ttm_set_memory.h> + +#include "ttm_set_memory.h" #define NUM_PAGES_TO_ALLOC (PAGE_SIZE/sizeof(struct page *))#define SMALL_ALLOCATION 16
drivers/gpu/drm/ttm/ttm_page_alloc_dma.c +2 -1
@@ -49,7 +49,8 @@#include <linux/kthread.h> #include <drm/ttm/ttm_bo_driver.h> #include <drm/ttm/ttm_page_alloc.h> -#include <drm/ttm/ttm_set_memory.h> + +#include "ttm_set_memory.h" #define NUM_PAGES_TO_ALLOC (PAGE_SIZE/sizeof(struct page *))#define SMALL_ALLOCATION 4
drivers/gpu/drm/ttm/ttm_set_memory.h renamed from include/drm/ttm/ttm_set_memory.h +0 -0
Signature · 6 lines
2.17.1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
RE: [PATCH 2/8] drm/ttm: move ttm_set_memory.h out of include
Quoted 9 lines
-----Original Message-----
From: dri-devel <[email protected]> On Behalf Of Christian König
Sent: Thursday, October 1, 2020 7:28 AM
To: [email protected]; [email protected]; [email protected]; [email protected]
Subject: [PATCH 2/8] drm/ttm: movettm_set_memory.hout of includeThis is not something drivers should use.
It's not?
I am not really sure what you are doing here.
M
Quoted 48 lines
Signed-off-by Christian König <[email protected]>---
drivers/gpu/drm/ttm/ttm_page_alloc.c | 3 ++- drivers/gpu/drm/ttm/ttm_page_alloc_dma.c | 3 ++- {include => drivers/gpu}/drm/ttm/ttm_set_memory.h | 0 3 files changed, 4 insertions(+), 2 deletions(-)rename {include =>
drivers/gpu}/drm/ttm/ttm_set_memory.h(100%)drivers/gpu/drm/ttm/ttm_page_alloc.c +2
-1@@ -47,7 +47,8 @@#include <drm/ttm/ttm_bo_driver.h> #include <drm/ttm/ttm_page_alloc.h> -#include <drm/ttm/ttm_set_memory.h> + +#include "ttm_set_memory.h" #define NUM_PAGES_TO_ALLOC (PAGE_SIZE/sizeof(struct page *))#define
SMALL_ALLOCATION16drivers/gpu/drm/ttm/ttm_page_alloc_dma.c +2
-1@@ -49,7 +49,8 @@#include <linux/kthread.h> #include <drm/ttm/ttm_bo_driver.h> #include <drm/ttm/ttm_page_alloc.h> -#include <drm/ttm/ttm_set_memory.h> + +#include "ttm_set_memory.h" #define NUM_PAGES_TO_ALLOC (PAGE_SIZE/sizeof(struct page *))#define
SMALL_ALLOCATION4drivers/gpu/drm/ttm/ttm_set_memory.h renamed from include/drm/ttm/ttm_set_memory.h +0
-1--2.17.1
Quoted 4 lines
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 2/8] drm/ttm: move ttm_set_memory.h out of include
Am 05.10.20 um 17:01 schrieb Ruhl, Michael J:
Quoted 10 lines
Quoted 9 lines
-----Original Message-----
From: dri-devel <[email protected]> On Behalf Of Christian König
Sent: Thursday, October 1, 2020 7:28 AM
To: [email protected]; [email protected]; [email protected]; [email protected]
Subject: [PATCH 2/8] drm/ttm: movettm_set_memory.hout of includeThis is not something drivers should use.
It's not?
Those are helper functions which are used by the two different page pools to change the global mapping of pages on x86.
Quoted 1 line
I am not really sure what you are doing here.
Making sure that no driver things that it should touch the CPU caching attributes manually :)
Christian.
Quoted 52 lines
M
Quoted 48 lines
Signed-off-by Christian König <[email protected]>---
drivers/gpu/drm/ttm/ttm_page_alloc.c | 3 ++- drivers/gpu/drm/ttm/ttm_page_alloc_dma.c | 3 ++- {include => drivers/gpu}/drm/ttm/ttm_set_memory.h | 0 3 files changed, 4 insertions(+), 2 deletions(-)rename {include =>
drivers/gpu}/drm/ttm/ttm_set_memory.h(100%)drivers/gpu/drm/ttm/ttm_page_alloc.c +2
-1@@ -47,7 +47,8 @@#include <drm/ttm/ttm_bo_driver.h> #include <drm/ttm/ttm_page_alloc.h> -#include <drm/ttm/ttm_set_memory.h> + +#include "ttm_set_memory.h" #define NUM_PAGES_TO_ALLOC (PAGE_SIZE/sizeof(struct page *))#define
SMALL_ALLOCATION16drivers/gpu/drm/ttm/ttm_page_alloc_dma.c +2
-1@@ -49,7 +49,8 @@#include <linux/kthread.h> #include <drm/ttm/ttm_bo_driver.h> #include <drm/ttm/ttm_page_alloc.h> -#include <drm/ttm/ttm_set_memory.h> + +#include "ttm_set_memory.h" #define NUM_PAGES_TO_ALLOC (PAGE_SIZE/sizeof(struct page *))#define
SMALL_ALLOCATION4drivers/gpu/drm/ttm/ttm_set_memory.h renamed from include/drm/ttm/ttm_set_memory.h +0
-1--2.17.1
Quoted 4 lines
Quoted 4 lines
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Ruhl, Michael J
Reviewed-byRE: [PATCH 2/8] drm/ttm: move ttm_set_memory.h out of include
Quoted 20 lines
-----Original Message-----
From: Christian König <[email protected]>
Sent: Wednesday, October 7, 2020 4:31 AM
To: Ruhl, Michael J <[email protected]>; dri- [email protected]; [email protected]; [email protected]; [email protected]
Subject: Re: [PATCH 2/8] drm/ttm: movettm_set_memory.hout of includeAm 05.10.20 um 17:01 schrieb Ruhl, Michael J:
Quoted 10 lines
Quoted 9 lines
-----Original Message-----
From: dri-devel <[email protected]> On Behalf Of Christian König
Sent: Thursday, October 1, 2020 7:28 AM
To: [email protected]; [email protected]; [email protected]; [email protected]
Subject: [PATCH 2/8] drm/ttm: movettm_set_memory.hout of includeThis is not something drivers should use.
It's not?
Quoted 7 lines
Those are helper functions which are used by the two different page pools to change the global mapping of pages on x86.
Quoted 1 line
I am not really sure what you are doing here.
Making sure that no driver things that it should touch the CPU caching attributes manually :)
Got it. So should you move the header to the drivers/gpu/drm/ttm ?
Mike
Quoted 54 lines
Christian.
Quoted 52 lines
M
Quoted 48 lines
Signed-off-by Christian König <[email protected]>---
drivers/gpu/drm/ttm/ttm_page_alloc.c | 3 ++- drivers/gpu/drm/ttm/ttm_page_alloc_dma.c | 3 ++- {include => drivers/gpu}/drm/ttm/ttm_set_memory.h | 0 3 files changed, 4 insertions(+), 2 deletions(-)rename {include =>
drivers/gpu}/drm/ttm/ttm_set_memory.h(100%)drivers/gpu/drm/ttm/ttm_page_alloc.c +2
-1@@ -47,7 +47,8 @@#include <drm/ttm/ttm_bo_driver.h> #include <drm/ttm/ttm_page_alloc.h> -#include <drm/ttm/ttm_set_memory.h> + +#include "ttm_set_memory.h" #define NUM_PAGES_TO_ALLOC (PAGE_SIZE/sizeof(struct page *))#define
SMALL_ALLOCATION16drivers/gpu/drm/ttm/ttm_page_alloc_dma.c +2
-1@@ -49,7 +49,8 @@#include <linux/kthread.h> #include <drm/ttm/ttm_bo_driver.h> #include <drm/ttm/ttm_page_alloc.h> -#include <drm/ttm/ttm_set_memory.h> + +#include "ttm_set_memory.h" #define NUM_PAGES_TO_ALLOC (PAGE_SIZE/sizeof(struct page *))#define
SMALL_ALLOCATION4drivers/gpu/drm/ttm/ttm_set_memory.h renamed from include/drm/ttm/ttm_set_memory.h +0
-1--2.17.1
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Christian König
maintainerRe: [PATCH 2/8] drm/ttm: move ttm_set_memory.h out of include
Am 07.10.20 um 13:46 schrieb Ruhl, Michael J:
Quoted 18 lines
Quoted 18 lines
-----Original Message-----
From: Christian König <[email protected]>
Sent: Wednesday, October 7, 2020 4:31 AM
To: Ruhl, Michael J <[email protected]>; dri- [email protected]; [email protected]; [email protected]; [email protected]
Subject: Re: [PATCH 2/8] drm/ttm: movettm_set_memory.hout of includeAm 05.10.20 um 17:01 schrieb Ruhl, Michael J:
Quoted 9 lines
Quoted 9 lines
-----Original Message-----
From: dri-devel <[email protected]> On Behalf Of Christian König
Sent: Thursday, October 1, 2020 7:28 AM
To: [email protected]; [email protected]; [email protected]; [email protected]
Subject: [PATCH 2/8] drm/ttm: movettm_set_memory.hout of includeThis is not something drivers should use.
Quoted 8 lines
Quoted 7 lines
Quoted 1 line
It's not?
Those are helper functions which are used by the two different page pools to change the global mapping of pages on x86.
Quoted 1 line
I am not really sure what you are doing here.
Making sure that no driver things that it should touch the CPU caching attributes manually :)
Got it. So should you move the header to the
drivers/gpu/drm/ttm?
Yes, in the long term we probably want to move the functionality into the DMA API. But for now the TTM subfolder should do as well.
Christian.
Quoted 58 lines
Reviewed-by Michael J. Ruhl <[email protected]>Mike
Quoted 53 lines
Christian.
Quoted 51 lines
M
Quoted 48 lines
Signed-off-by Christian König <[email protected]>---
drivers/gpu/drm/ttm/ttm_page_alloc.c | 3 ++- drivers/gpu/drm/ttm/ttm_page_alloc_dma.c | 3 ++- {include => drivers/gpu}/drm/ttm/ttm_set_memory.h | 0 3 files changed, 4 insertions(+), 2 deletions(-)rename {include =>
drivers/gpu}/drm/ttm/ttm_set_memory.h(100%)drivers/gpu/drm/ttm/ttm_page_alloc.c +2
-1@@ -47,7 +47,8 @@#include <drm/ttm/ttm_bo_driver.h> #include <drm/ttm/ttm_page_alloc.h> -#include <drm/ttm/ttm_set_memory.h> + +#include "ttm_set_memory.h" #define NUM_PAGES_TO_ALLOC (PAGE_SIZE/sizeof(struct page *))#define
SMALL_ALLOCATION16drivers/gpu/drm/ttm/ttm_page_alloc_dma.c +2
-1@@ -49,7 +49,8 @@#include <linux/kthread.h> #include <drm/ttm/ttm_bo_driver.h> #include <drm/ttm/ttm_page_alloc.h> -#include <drm/ttm/ttm_set_memory.h> + +#include "ttm_set_memory.h" #define NUM_PAGES_TO_ALLOC (PAGE_SIZE/sizeof(struct page *))#define
SMALL_ALLOCATION4drivers/gpu/drm/ttm/ttm_set_memory.h renamed from include/drm/ttm/ttm_set_memory.h +0
-1--2.17.1
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
_______________________________________________
dri-devel mailing list
[email protected]
https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Fdri-devel&data=02%7C01%7Cchristian.koenig%40amd.com%7C4219f6c8468f4d5297bd08d86ab6ad3c%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637376680113288476&sdata=G8IO0iMZWAROyBJZRSVrh%2FXgFI%2B3kEO58Si6cd%2F%2B8o0%3D&reserved=0
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 3/8 drm/ttm: cleanup ttm_handle_caching_state_failure
In reply to Christian KönigRemove unused parameters, shorten the function name.
--- drivers/gpu/drm/ttm/ttm_page_alloc.c | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-)
drivers/gpu/drm/ttm/ttm_page_alloc.c +8 -12
@@ -467,11 +467,11 @@ static int ttm_set_pages_caching(struct page **pages,* any pages that have changed their caching state already put them to the * pool. */ -static void ttm_handle_caching_state_failure (struct list_head *pages, -int ttm_flags,enum ttm_caching_state cstate, -struct page **failed_pages,unsigned cpages) +static void ttm_handle_caching_failure (struct page **failed_pages, +unsigned cpages) {unsigned i; +/* Failed pages have to be freed */ for (i =0 ; i < cpages; ++i) {list_del (&failed_pages[i]->lru);
@@ -517,9 +517,8 @@ static int ttm_alloc_new_pages(struct list_head *pages, gfp_t gfp_flags, r =ttm_set_pages_caching (caching_array, cstate, cpages);if (r) -ttm_handle_caching_state_failure (pages, - ttm_flags, cstate, - caching_array, cpages); +ttm_handle_caching_failure (caching_array, + cpages); } r = -ENOMEM ; goto out;
@@ -542,9 +541,8 @@ static int ttm_alloc_new_pages(struct list_head *pages, gfp_t gfp_flags, r =ttm_set_pages_caching (caching_array, cstate, cpages);if (r) { -ttm_handle_caching_state_failure (pages, - ttm_flags, cstate, - caching_array, cpages); +ttm_handle_caching_failure (caching_array, + cpages); goto out; } cpages =0 ;
@@ -555,9 +553,7 @@ static int ttm_alloc_new_pages(struct list_head *pages, gfp_t gfp_flags,if (cpages) { r =ttm_set_pages_caching (caching_array, cstate, cpages);if (r) -ttm_handle_caching_state_failure (pages, - ttm_flags, cstate, - caching_array, cpages); +ttm_handle_caching_failure (caching_array, cpages); } out:kfree (caching_array);
Signature · 6 lines
2.17.1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
RE: [PATCH 3/8] drm/ttm: cleanup ttm_handle_caching_state_failure
Quoted 11 lines
-----Original Message-----
From: dri-devel <[email protected]> On Behalf Of Christian König
Sent: Thursday, October 1, 2020 7:28 AM
To: [email protected]; [email protected]; [email protected]; [email protected]
Subject: [PATCH 3/8] drm/ttm: cleanupttm_handle_caching_state_failureRemove unused parameters, shorten the function name.
Looks good to me.
M
Quoted 67 lines
Signed-off-by Christian König <[email protected]>---
drivers/gpu/drm/ttm/ttm_page_alloc.c| 20 ++++++++------------1 file changed, 8 insertions(+), 12 deletions(-)drivers/gpu/drm/ttm/ttm_page_alloc.c +3
-3@@ -467,11 +467,11 @@ static int ttm_set_pages_caching(struct page**pages, * any pages that have changed their caching state already put them to the * pool. */ -static void ttm_handle_caching_state_failure (struct list_head *pages, -int ttm_flags,enum ttm_caching_state cstate, -struct page **failed_pages,unsigned cpages) +static void ttm_handle_caching_failure (struct page **failed_pages, +unsigned cpages) {unsigned i; +/* Failed pages have to be freed */ for (i =0 ; i < cpages; ++i) {list_del(&failed_pages[i]->lru);drivers/gpu/drm/ttm/ttm_page_alloc.c +2
-3@@ -517,9 +517,8 @@ static int ttm_alloc_new_pages(struct list_head *pages, gfp_t gfp_flags, r =ttm_set_pages_caching (caching_array, cstate, cpages);if (r) -ttm_handle_caching_state_failure (pages, - ttm_flags, cstate, - caching_array, cpages); +ttm_handle_caching_failure (caching_array, + cpages);} r = -ENOMEM; goto out;drivers/gpu/drm/ttm/ttm_page_alloc.c +2
-3@@ -542,9 +541,8 @@ static int ttm_alloc_new_pages(struct list_head *pages, gfp_t gfp_flags, r =ttm_set_pages_caching (caching_array, cstate, cpages);if (r) { -ttm_handle_caching_state_failure (pages, - ttm_flags, cstate, - caching_array, cpages); +ttm_handle_caching_failure (caching_array, + cpages);goto out; } cpages = 0;drivers/gpu/drm/ttm/ttm_page_alloc.c +1
-3@@ -555,9 +553,7 @@ static int ttm_alloc_new_pages(struct list_head *pages, gfp_t gfp_flags, if (cpages) { r =ttm_set_pages_caching (caching_array, cstate, cpages);if (r) -ttm_handle_caching_state_failure (pages, - ttm_flags, cstate, - caching_array, cpages); +ttm_handle_caching_failure (caching_array, cpages); }out:
Quoted 8 lines
kfree(caching_array);--
2.17.1_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 4/8 drm/ttm: rename TTM caching enum
In reply to Christian KönigCleanup the enum name and its values and give it a separate header file.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c | 2 +- drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 2 +- drivers/gpu/drm/radeon/radeon_ttm.c | 2 +- drivers/gpu/drm/ttm/ttm_page_alloc.c | 26 +++++++++--------- drivers/gpu/drm/ttm/ttm_page_alloc_dma.c | 20 +++++++------- drivers/gpu/drm/ttm/ttm_tt.c | 17 ++++++------ include/drm/ttm/ttm_caching.h | 34 ++++++++++++++++++++++++ include/drm/ttm/ttm_tt.h | 9 ++----- 8 files changed, 70 insertions(+), 42 deletions(-) create mode 100644 include/drm/ttm/ttm_caching.h
drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c +1 -1
@@ -124,7 +124,7 @@ uint64_t amdgpu_gmc_agp_addr(struct ttm_buffer_object *bo)struct amdgpu_device *adev =amdgpu_ttm_adev (bo->bdev);struct ttm_dma_tt *ttm; -if (bo->num_pages !=1 || bo->ttm->caching_state == tt_cached) +if (bo->num_pages !=1 || bo->ttm->caching == ttm_cached)return AMDGPU_BO_INVALID_OFFSET ; ttm = container_of(bo->ttm, struct ttm_dma_tt, ttm);
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +1 -1
@@ -1525,7 +1525,7 @@ uint64_t amdgpu_ttm_tt_pde_flags(struct ttm_tt *ttm, struct ttm_resource *mem)if (mem && mem->mem_type ==TTM_PL_TT ) { flags |=AMDGPU_PTE_SYSTEM ; -if (ttm->caching_state == tt_cached) +if (ttm->caching == ttm_cached) flags |=AMDGPU_PTE_SNOOPED ; }
drivers/gpu/drm/radeon/radeon_ttm.c +1 -1
@@ -546,7 +546,7 @@ static int radeon_ttm_backend_bind(struct ttm_bo_device *bdev,WARN (1 ,"nothing to bind %lu pages for mreg %p back %p!\n" , ttm->num_pages, bo_mem, ttm); } -if (ttm->caching_state == tt_cached) +if (ttm->caching == ttm_cached) flags |=RADEON_GART_PAGE_SNOOP ; r =radeon_gart_bind (rdev, gtt->offset, ttm->num_pages, ttm->pages, gtt->ttm.dma_address, flags);
drivers/gpu/drm/ttm/ttm_page_alloc.c +13 -13
@@ -220,14 +220,14 @@ static struct ttm_pool_manager *_manager;/** * Select the right pool or requested caching state and ttm flags. */ static struct ttm_page_pool *ttm_get_pool (int flags,bool huge, -enum ttm_caching_state cstate) +enum ttm_caching cstate) {int pool_index; -if (cstate == tt_cached) +if (cstate == ttm_cached)return NULL ; -if (cstate == tt_wc) +if (cstate == ttm_write_combined) pool_index =0x0 ;else pool_index =0x1 ;
@@ -441,17 +441,17 @@ static void ttm_pool_mm_shrink_fini(struct ttm_pool_manager *manager) }static int ttm_set_pages_caching (struct page **pages, -enum ttm_caching_state cstate,unsigned cpages) +enum ttm_caching cstate,unsigned cpages) {int r =0 ;/* Set page caching */ switch (cstate) { -case tt_uncached: +case ttm_uncached: r =ttm_set_pages_array_uc (pages, cpages);if (r)pr_err ("Failed to set %d pages to uc!\n" , cpages);break ; -case tt_wc: +case ttm_write_combined: r =ttm_set_pages_array_wc (pages, cpages);if (r)pr_err ("Failed to set %d pages to wc!\n" , cpages);
@@ -486,7 +486,7 @@ static void ttm_handle_caching_failure(struct page **failed_pages,* pages returned in pages array. */ static int ttm_alloc_new_pages (struct list_head *pages,gfp_t gfp_flags, -int ttm_flags,enum ttm_caching_state cstate, +int ttm_flags,enum ttm_caching cstate,unsigned count,unsigned order) {struct page **caching_array;
@@ -566,7 +566,7 @@ static int ttm_alloc_new_pages(struct list_head *pages, gfp_t gfp_flags,* pages is small. */ static void ttm_page_pool_fill_locked (struct ttm_page_pool *pool,int ttm_flags, -enum ttm_caching_state cstate, +enum ttm_caching cstate,unsigned count,unsigned long *irq_flags) {struct page *p;
@@ -626,7 +626,7 @@ static void ttm_page_pool_fill_locked(struct ttm_page_pool *pool, int ttm_flags,static int ttm_page_pool_get_pages (struct ttm_page_pool *pool,struct list_head *pages,int ttm_flags, -enum ttm_caching_state cstate, +enum ttm_caching cstate,unsigned count,unsigned order) {unsigned long irq_flags;
@@ -703,7 +703,7 @@ static int ttm_page_pool_get_pages(struct ttm_page_pool *pool,/* Put all pages in pages list to correct pool to wait for reuse */ static void ttm_put_pages (struct page **pages,unsigned npages,int flags, -enum ttm_caching_state cstate) +enum ttm_caching cstate) {struct ttm_page_pool *pool =ttm_get_pool (flags, false, cstate);#ifdef CONFIG_TRANSPARENT_HUGEPAGE
@@ -821,7 +821,7 @@ static void ttm_put_pages(struct page **pages, unsigned npages, int flags,* cached pages. */ static int ttm_get_pages (struct page **pages,unsigned npages,int flags, -enum ttm_caching_state cstate) +enum ttm_caching cstate) {struct ttm_page_pool *pool =ttm_get_pool (flags, false, cstate);#ifdef CONFIG_TRANSPARENT_HUGEPAGE
@@ -1040,7 +1040,7 @@ ttm_pool_unpopulate_helper(struct ttm_tt *ttm, unsigned mem_count_update) put_pages:ttm_put_pages (ttm->pages, ttm->num_pages, ttm->page_flags, - ttm->caching_state); + ttm->caching);ttm_tt_set_unpopulated (ttm); }
@@ -1057,7 +1057,7 @@ int ttm_pool_populate(struct ttm_tt *ttm, struct ttm_operation_ctx *ctx)return -ENOMEM ; ret =ttm_get_pages (ttm->pages, ttm->num_pages, ttm->page_flags, - ttm->caching_state); + ttm->caching);if (unlikely (ret !=0 )) {ttm_pool_unpopulate_helper (ttm,0 );return ret;
drivers/gpu/drm/ttm/ttm_page_alloc_dma.c +10 -10
@@ -325,15 +325,15 @@ static struct dma_page *__ttm_dma_alloc_page(struct dma_pool *pool) }return d_page; } -static enum pool_type ttm_to_type (int flags,enum ttm_caching_state cstate) +static enum pool_type ttm_to_type (int flags,enum ttm_caching cstate) {enum pool_type type =IS_UNDEFINED ;if (flags &TTM_PAGE_FLAG_DMA32 ) type |=IS_DMA32 ; -if (cstate == tt_cached) +if (cstate == ttm_cached) type |=IS_CACHED ; -else if (cstate == tt_uncached) +else if (cstate == ttm_uncached) type |=IS_UC ;else type |=IS_WC ;
@@ -663,7 +663,7 @@ static struct dma_pool *ttm_dma_find_pool(struct device *dev,* are pages that have changed their caching state already put them to the * pool. */ -static void ttm_dma_handle_caching_state_failure (struct dma_pool *pool, +static void ttm_dma_handle_caching_failure (struct dma_pool *pool,struct list_head *d_pages,struct page **failed_pages,unsigned cpages)
@@ -734,7 +734,7 @@ static int ttm_dma_pool_alloc_new_pages(struct dma_pool *pool, r =ttm_set_pages_caching (pool, caching_array, cpages);if (r) -ttm_dma_handle_caching_state_failure ( +ttm_dma_handle_caching_failure ( pool, d_pages, caching_array, cpages); }
@@ -760,7 +760,7 @@ static int ttm_dma_pool_alloc_new_pages(struct dma_pool *pool, r =ttm_set_pages_caching (pool, caching_array, cpages);if (r) { -ttm_dma_handle_caching_state_failure ( +ttm_dma_handle_caching_failure ( pool, d_pages, caching_array, cpages); goto out;
@@ -773,7 +773,7 @@ static int ttm_dma_pool_alloc_new_pages(struct dma_pool *pool,if (cpages) { r =ttm_set_pages_caching (pool, caching_array, cpages);if (r) -ttm_dma_handle_caching_state_failure (pool, d_pages, +ttm_dma_handle_caching_failure (pool, d_pages, caching_array, cpages); } out:
@@ -904,7 +904,7 @@ int ttm_dma_populate(struct ttm_dma_tt *ttm_dma, struct device *dev,INIT_LIST_HEAD (&ttm_dma->pages_list); i =0 ; - type =ttm_to_type (ttm->page_flags, ttm->caching_state); + type =ttm_to_type (ttm->page_flags, ttm->caching);#ifdef CONFIG_TRANSPARENT_HUGEPAGE if (ttm->page_flags &TTM_PAGE_FLAG_DMA32 )
@@ -1000,7 +1000,7 @@ void ttm_dma_unpopulate(struct ttm_dma_tt *ttm_dma, struct device *dev)unsigned count, i, npages =0 ;unsigned long irq_flags; - type =ttm_to_type (ttm->page_flags, ttm->caching_state); + type =ttm_to_type (ttm->page_flags, ttm->caching);#ifdef CONFIG_TRANSPARENT_HUGEPAGE pool =ttm_dma_find_pool (dev, type |IS_HUGE );
@@ -1032,7 +1032,7 @@ void ttm_dma_unpopulate(struct ttm_dma_tt *ttm_dma, struct device *dev)return ; is_cached = (ttm_dma_find_pool (pool->dev, -ttm_to_type (ttm->page_flags, tt_cached)) == pool); +ttm_to_type (ttm->page_flags, ttm_cached)) == pool);/* make sure pages array match list and count number of pages */ count =0 ;
drivers/gpu/drm/ttm/ttm_tt.c +8 -9
@@ -114,31 +114,30 @@ static int ttm_sg_tt_alloc_page_directory(struct ttm_dma_tt *ttm)return 0 ; } -static int ttm_tt_set_caching (struct ttm_tt *ttm, -enum ttm_caching_state c_state) +static int ttm_tt_set_caching (struct ttm_tt *ttm,enum ttm_caching caching) { -if (ttm->caching_state == c_state) +if (ttm->caching == caching)return 0 ;/* Can't change the caching state after TT is populated */ if (WARN_ON_ONCE (ttm_tt_is_populated (ttm)))return -EINVAL ; - ttm->caching_state = c_state; + ttm->caching = caching;return 0 ; }int ttm_tt_set_placement_caching (struct ttm_tt *ttm,uint32_t placement) { -enum ttm_caching_state state; +enum ttm_caching state;if (placement &TTM_PL_FLAG_WC ) - state = tt_wc; + state = ttm_write_combined;else if (placement &TTM_PL_FLAG_UNCACHED ) - state = tt_uncached; + state = ttm_uncached;else - state = tt_cached; + state = ttm_cached;return ttm_tt_set_caching (ttm, state); }
@@ -165,7 +164,7 @@ static void ttm_tt_init_fields(struct ttm_tt *ttm, uint32_t page_flags) { ttm->num_pages = bo->num_pages; - ttm->caching_state = tt_cached; + ttm->caching = ttm_cached; ttm->page_flags = page_flags;ttm_tt_set_unpopulated (ttm); ttm->swap_storage =NULL ;
include/drm/ttm/ttm_caching.h new file +34 -0
@@ -0,0 +1,34 @@ +/* +* Copyright 2020 Advanced Micro Devices, 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: Christian König +*/ + +#ifndef _TTM_CACHING_H_ +#define _TTM_CACHING_H_ + +enum ttm_caching { + ttm_uncached, + ttm_write_combined, + ttm_cached +}; + +#endif
include/drm/ttm/ttm_tt.h +2 -7
@@ -28,6 +28,7 @@#define _TTM_TT_H_#include <linux/types.h> +#include <drm/ttm/ttm_caching.h> struct ttm_tt ;struct ttm_resource ;
@@ -42,12 +43,6 @@ struct ttm_operation_ctx;#define TTM_PAGE_FLAG_PRIV_POPULATED (1 << 31) -enum ttm_caching_state { - tt_uncached, - tt_wc, - tt_cached -}; -/** * struct ttm_tt *
@@ -69,7 +64,7 @@ struct ttm_tt {unsigned long num_pages;struct sg_table *sg;/* for SG objects via dma-buf */ struct file *swap_storage; -enum ttm_caching_state caching_state; +enum ttm_caching caching; };static inline bool ttm_tt_is_populated (struct ttm_tt *tt)
Signature · 6 lines
2.17.1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
RE: [PATCH 4/8] drm/ttm: rename TTM caching enum
Quoted 9 lines
-----Original Message-----
From: dri-devel <[email protected]> On Behalf Of Christian König
Sent: Thursday, October 1, 2020 7:28 AM
To: [email protected]; [email protected]; [email protected]; [email protected]
Subject: [PATCH 4/8] drm/ttm: rename TTM caching enumCleanup the enum name and its values and give it a separate header file.
This clean up looks straight forward.
I am not really clear on why you are giving it a separate header. If you could detail that a little more in the commit?
Otherwise:
m
Quoted 413 lines
Signed-off-by Christian König <[email protected]>---
drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c | 2 +- drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 2 +- drivers/gpu/drm/radeon/radeon_ttm.c | 2 +- drivers/gpu/drm/ttm/ttm_page_alloc.c | 26 +++++++++--------- drivers/gpu/drm/ttm/ttm_page_alloc_dma.c | 20 +++++++------- drivers/gpu/drm/ttm/ttm_tt.c | 17 ++++++------ include/drm/ttm/ttm_caching.h | 34 ++++++++++++++++++++++++ include/drm/ttm/ttm_tt.h | 9 ++----- 8 files changed, 70 insertions(+), 42 deletions(-)create mode 100644
include/drm/ttm/ttm_caching.hdrivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c +1
-1@@ -124,7 +124,7 @@ uint64_t amdgpu_gmc_agp_addr(struct ttm_buffer_object *bo)struct amdgpu_device *adev =amdgpu_ttm_adev (bo->bdev);struct ttm_dma_tt *ttm; -if (bo->num_pages !=1 || bo->ttm->caching_state == tt_cached) +if (bo->num_pages !=1 || bo->ttm->caching == ttm_cached)return AMDGPU_BO_INVALID_OFFSET ;ttm = container_of(bo->ttm, struct ttm_dma_tt, ttm);drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +1
-1@@ -1525,7 +1525,7 @@ uint64_t amdgpu_ttm_tt_pde_flags(struct ttm_tt *ttm, struct ttm_resource *mem)if (mem && mem->mem_type ==TTM_PL_TT ) { flags |=AMDGPU_PTE_SYSTEM ; -if (ttm->caching_state == tt_cached) +if (ttm->caching == ttm_cached) flags |=AMDGPU_PTE_SNOOPED ; }drivers/gpu/drm/radeon/radeon_ttm.c +1
-1@@ -546,7 +546,7 @@ static int radeon_ttm_backend_bind(struct ttm_bo_device *bdev, WARN(1, "nothing to bind %lu pages for mreg %p back %p!\n", ttm->num_pages, bo_mem, ttm); } -if (ttm->caching_state == tt_cached) +if (ttm->caching == ttm_cached) flags |=RADEON_GART_PAGE_SNOOP ;r = radeon_gart_bind(rdev, gtt->offset, ttm->num_pages, ttm->pages, gtt->ttm.dma_address, flags);drivers/gpu/drm/ttm/ttm_page_alloc.c +6
-6@@ -220,14 +220,14 @@ static struct ttm_pool_manager *_manager;/** * Select the right pool or requested caching state and ttm flags. */ static struct ttm_page_pool *ttm_get_pool (int flags,bool huge, -enum ttm_caching_state cstate) +enum ttm_caching cstate) {int pool_index; -if (cstate == tt_cached) +if (cstate == ttm_cached)return NULL ; -if (cstate == tt_wc) +if (cstate == ttm_write_combined) pool_index =0x0 ;else pool_index =0x1 ;@@ -441,17 +441,17 @@ static void ttm_pool_mm_shrink_fini(struct ttm_pool_manager *manager) }static int ttm_set_pages_caching (struct page **pages, -enum ttm_caching_state cstate,unsigned cpages) +enum ttm_caching cstate,unsigned cpages) {int r =0 ;/* Set page caching */ switch (cstate) { -case tt_uncached: +case ttm_uncached: r =ttm_set_pages_array_uc (pages, cpages);if (r)pr_err ("Failed to set %d pages to uc!\n" , cpages);break ; -case tt_wc: +case ttm_write_combined: r =ttm_set_pages_array_wc (pages, cpages);if (r)pr_err("Failed to set %d pages to wc!\n", cpages);drivers/gpu/drm/ttm/ttm_page_alloc.c +1
-1@@ -486,7 +486,7 @@ static void ttm_handle_caching_failure(struct page**failed_pages, * pages returned in pages array. */ static int ttm_alloc_new_pages (struct list_head *pages,gfp_t gfp_flags, -int ttm_flags,enum ttm_caching_state cstate, +int ttm_flags,enum ttm_caching cstate,unsigned count,unsigned order) {struct page **caching_array;drivers/gpu/drm/ttm/ttm_page_alloc.c +0
-0@@ -566,7 +566,7 @@ static int ttm_alloc_new_pages(struct list_head*pages, gfp_t gfp_flags, * pages is small. */ static void ttm_page_pool_fill_locked(struct
ttm_page_pool*pool, intttm_flags,drivers/gpu/drm/ttm/ttm_page_alloc.c +1
-1- enum ttm_caching_state cstate, + enum ttm_caching cstate,unsigned count, unsigned long
*irq_flags){ struct page *p;drivers/gpu/drm/ttm/ttm_page_alloc.c +1
-1@@ -626,7 +626,7 @@ static void ttm_page_pool_fill_locked(struct ttm_page_pool *pool, int ttm_flags, static int ttm_page_pool_get_pages(struct ttm_page_pool *pool, struct list_head *pages, int ttm_flags, - enum ttm_caching_state cstate, + enum ttm_caching cstate, unsigned count, unsigned order) {unsigned long irq_flags;drivers/gpu/drm/ttm/ttm_page_alloc.c +1
-1@@ -703,7 +703,7 @@ static int ttm_page_pool_get_pages(structttm_page_pool *pool,/* Put all pages in pages list to correct pool to wait for reuse */ static void ttm_put_pages(struct page **pages, unsigned npages, int flags, - enum ttm_caching_state cstate) + enum ttm_caching cstate) { struct ttm_page_pool *pool = ttm_get_pool(flags, false, cstate);#ifdef
CONFIG_TRANSPARENT_HUGEPAGEdrivers/gpu/drm/ttm/ttm_page_alloc.c +1
-1@@ -821,7 +821,7 @@ static void ttm_put_pages(struct page **pages,unsigned npages, int flags, * cached pages. */ static int ttm_get_pages (struct page **pages,unsigned npages,int flags, -enum ttm_caching_state cstate) +enum ttm_caching cstate) {struct ttm_page_pool *pool =ttm_get_pool (flags, false, cstate);#ifdef
CONFIG_TRANSPARENT_HUGEPAGEdrivers/gpu/drm/ttm/ttm_page_alloc.c +0
-0@@ -1040,7 +1040,7 @@ ttm_pool_unpopulate_helper(struct ttm_tt *ttm, unsigned mem_count_update)
put_pages:ttm_put_pages(ttm->pages, ttm->num_pages, ttm->page_flags,drivers/gpu/drm/ttm/ttm_page_alloc.c +1
-1- ttm->caching_state); + ttm->caching);ttm_tt_set_unpopulated(ttm); }drivers/gpu/drm/ttm/ttm_page_alloc.c +1
-1@@ -1057,7 +1057,7 @@ int ttm_pool_populate(struct ttm_tt *ttm, struct ttm_operation_ctx *ctx)return -ENOMEM ; ret =ttm_get_pages (ttm->pages, ttm->num_pages, ttm->page_flags, - ttm->caching_state); + ttm->caching);if (unlikely (ret !=0 )) {ttm_pool_unpopulate_helper (ttm,0 );return ret;drivers/gpu/drm/ttm/ttm_page_alloc_dma.c +3
-3@@ -325,15 +325,15 @@ static struct dma_page *__ttm_dma_alloc_page(struct dma_pool *pool) }return d_page; } -static enum pool_type ttm_to_type (int flags,enum ttm_caching_state cstate) +static enum pool_type ttm_to_type(int flags, enum ttm_caching cstate) {enum pool_type type =IS_UNDEFINED ;if (flags &TTM_PAGE_FLAG_DMA32 ) type |=IS_DMA32 ; -if (cstate == tt_cached) +if (cstate == ttm_cached) type |=IS_CACHED ; -else if (cstate == tt_uncached) +else if (cstate == ttm_uncached) type |=IS_UC ;else type |= IS_WC;drivers/gpu/drm/ttm/ttm_page_alloc_dma.c +1
-1@@ -663,7 +663,7 @@ static struct dma_pool *ttm_dma_find_pool(structdevice *dev, * are pages that have changed their caching state already put them to the * pool. */ -static void ttm_dma_handle_caching_state_failure(struct dma_pool *pool, +static void ttm_dma_handle_caching_failure(struct dma_pool *pool, struct list_head *d_pages, struct page **failed_pages,unsigned cpages)
drivers/gpu/drm/ttm/ttm_page_alloc_dma.c +1
-1@@ -734,7 +734,7 @@ static int ttm_dma_pool_alloc_new_pages(structdma_pool *pool, r =ttm_set_pages_caching (pool, caching_array, cpages);if (r) - ttm_dma_handle_caching_state_failure( + ttm_dma_handle_caching_failure(pool, d_pages, caching_array, cpages); }drivers/gpu/drm/ttm/ttm_page_alloc_dma.c +1
-1@@ -760,7 +760,7 @@ static int ttm_dma_pool_alloc_new_pages(structdma_pool *pool, r =ttm_set_pages_caching (pool, caching_array, cpages);if (r) { - ttm_dma_handle_caching_state_failure( + ttm_dma_handle_caching_failure(pool, d_pages, caching_array, cpages); goto out;drivers/gpu/drm/ttm/ttm_page_alloc_dma.c +1
-1@@ -773,7 +773,7 @@ static int ttm_dma_pool_alloc_new_pages(structdma_pool *pool, if (cpages) { r =ttm_set_pages_caching (pool, caching_array, cpages);if (r) -ttm_dma_handle_caching_state_failure (pool, d_pages, +ttm_dma_handle_caching_failure (pool, d_pages, caching_array, cpages);}out:
drivers/gpu/drm/ttm/ttm_page_alloc_dma.c +1
-1@@ -904,7 +904,7 @@ int ttm_dma_populate(struct ttm_dma_tt *ttm_dma,struct device *dev, INIT_LIST_HEAD(&ttm_dma->pages_list); i =0 ; - type =ttm_to_type (ttm->page_flags, ttm->caching_state); + type =ttm_to_type (ttm->page_flags, ttm->caching);#ifdef CONFIG_TRANSPARENT_HUGEPAGE if (ttm->page_flags & TTM_PAGE_FLAG_DMA32)drivers/gpu/drm/ttm/ttm_page_alloc_dma.c +1
-1@@ -1000,7 +1000,7 @@ void ttm_dma_unpopulate(struct ttm_dma_tt *ttm_dma, struct device *dev)unsigned count, i, npages =0 ;unsigned long irq_flags; - type =ttm_to_type (ttm->page_flags, ttm->caching_state); + type =ttm_to_type (ttm->page_flags, ttm->caching);#ifdef CONFIG_TRANSPARENT_HUGEPAGE pool = ttm_dma_find_pool(dev, type | IS_HUGE);drivers/gpu/drm/ttm/ttm_page_alloc_dma.c +1
-1@@ -1032,7 +1032,7 @@ void ttm_dma_unpopulate(struct ttm_dma_tt *ttm_dma, struct device *dev)return ; is_cached = (ttm_dma_find_pool (pool->dev, -ttm_to_type (ttm->page_flags, tt_cached)) == pool); +ttm_to_type (ttm->page_flags, ttm_cached)) == pool);/* make sure pages array match list and count number of pages */ count = 0;drivers/gpu/drm/ttm/ttm_tt.c +7
-8@@ -114,31 +114,30 @@ static int ttm_sg_tt_alloc_page_directory(struct ttm_dma_tt *ttm)return 0 ; } -static int ttm_tt_set_caching (struct ttm_tt *ttm, -enum ttm_caching_state c_state) +static int ttm_tt_set_caching (struct ttm_tt *ttm,enum ttm_caching caching) { -if (ttm->caching_state == c_state) +if (ttm->caching == caching)return 0 ;/* Can't change the caching state after TT is populated */ if (WARN_ON_ONCE (ttm_tt_is_populated (ttm)))return -EINVAL ; - ttm->caching_state = c_state; + ttm->caching = caching;return 0 ; }int ttm_tt_set_placement_caching (struct ttm_tt *ttm,uint32_t placement) { -enum ttm_caching_state state; +enum ttm_caching state;if (placement &TTM_PL_FLAG_WC ) - state = tt_wc; + state = ttm_write_combined;else if (placement &TTM_PL_FLAG_UNCACHED ) - state = tt_uncached; + state = ttm_uncached;else - state = tt_cached; + state = ttm_cached;return ttm_tt_set_caching (ttm, state);}
drivers/gpu/drm/ttm/ttm_tt.c +1
-1@@ -165,7 +164,7 @@ static void ttm_tt_init_fields(struct ttm_tt *ttm, uint32_t page_flags) { ttm->num_pages = bo->num_pages; - ttm->caching_state = tt_cached; + ttm->caching = ttm_cached; ttm->page_flags = page_flags;ttm_tt_set_unpopulated (ttm); ttm->swap_storage =NULL ;include/drm/ttm/ttm_caching.h new file +5
-0@@ -0,0 +1,34 @@ +/* +* Copyright 2020 Advanced Micro Devices, 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: Christian König
+ */include/drm/ttm/ttm_caching.h new file +11
-0+ +#ifndef _TTM_CACHING_H_ +#define _TTM_CACHING_H_ + +enum ttm_caching { + ttm_uncached, + ttm_write_combined, + ttm_cached +}; + +#endif include/drm/ttm/ttm_tt.h +2
-8@@ -28,6 +28,7 @@#define _TTM_TT_H_#include <linux/types.h> +#include <drm/ttm/ttm_caching.h> struct ttm_tt ;struct ttm_resource ;@@ -42,12 +43,6 @@ struct ttm_operation_ctx;#define TTM_PAGE_FLAG_PRIV_POPULATED (1 << 31) -enum ttm_caching_state { - tt_uncached, - tt_wc, - tt_cached -}; -/** * struct ttm_tt * @@ -69,7 +64,7 @@ struct ttm_tt {unsigned long num_pages;struct sg_table *sg;/* for SG objects via dma-buf */ struct file *swap_storage; -enum ttm_caching_state caching_state; +enum ttm_caching caching; };static inline bool ttm_tt_is_populated (struct ttm_tt *tt) --2.17.1
Quoted 4 lines
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 4/8] drm/ttm: rename TTM caching enum
Am 05.10.20 um 17:05 schrieb Ruhl, Michael J:
Quoted 8 lines
Quoted 8 lines
-----Original Message-----
From: dri-devel <[email protected]> On Behalf Of Christian König
Sent: Thursday, October 1, 2020 7:28 AM
To: [email protected]; [email protected]; [email protected]; [email protected]
Subject: [PATCH 4/8] drm/ttm: rename TTM caching enum
Quoted 5 lines
Quoted 1 line
Cleanup the enum name and its values and give it a separate header file.
This clean up looks straight forward.
I am not really clear on why you are giving it a separate header. If you could detail that a little more in the commit?
Well I'm not clear if I should give it a separate header either.
It is used by the placement, the TT and the resource handling, so I wasn't sure where to put it.
Anyway a separate header is fine for now I think even if it looks like a bit overkill.
Quoted 4 lines
Otherwise:
Reviewed-by Michael J. Ruhl <[email protected]>
Thanks,
Christian.
Quoted 412 lines
m
Quoted 409 lines
Signed-off-by Christian König <[email protected]>---
drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c | 2 +- drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 2 +- drivers/gpu/drm/radeon/radeon_ttm.c | 2 +- drivers/gpu/drm/ttm/ttm_page_alloc.c | 26 +++++++++--------- drivers/gpu/drm/ttm/ttm_page_alloc_dma.c | 20 +++++++------- drivers/gpu/drm/ttm/ttm_tt.c | 17 ++++++------ include/drm/ttm/ttm_caching.h | 34 ++++++++++++++++++++++++ include/drm/ttm/ttm_tt.h | 9 ++----- 8 files changed, 70 insertions(+), 42 deletions(-)create mode 100644
include/drm/ttm/ttm_caching.hdrivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c +1
-1@@ -124,7 +124,7 @@ uint64_t amdgpu_gmc_agp_addr(struct ttm_buffer_object *bo)struct amdgpu_device *adev =amdgpu_ttm_adev (bo->bdev);struct ttm_dma_tt *ttm; -if (bo->num_pages !=1 || bo->ttm->caching_state == tt_cached) +if (bo->num_pages !=1 || bo->ttm->caching == ttm_cached)return AMDGPU_BO_INVALID_OFFSET ;ttm = container_of(bo->ttm, struct ttm_dma_tt, ttm);drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +1
-1@@ -1525,7 +1525,7 @@ uint64_t amdgpu_ttm_tt_pde_flags(struct ttm_tt *ttm, struct ttm_resource *mem)if (mem && mem->mem_type ==TTM_PL_TT ) { flags |=AMDGPU_PTE_SYSTEM ; -if (ttm->caching_state == tt_cached) +if (ttm->caching == ttm_cached) flags |=AMDGPU_PTE_SNOOPED ; }drivers/gpu/drm/radeon/radeon_ttm.c +1
-1@@ -546,7 +546,7 @@ static int radeon_ttm_backend_bind(struct ttm_bo_device *bdev, WARN(1, "nothing to bind %lu pages for mreg %p back %p!\n", ttm->num_pages, bo_mem, ttm); } -if (ttm->caching_state == tt_cached) +if (ttm->caching == ttm_cached) flags |=RADEON_GART_PAGE_SNOOP ;r = radeon_gart_bind(rdev, gtt->offset, ttm->num_pages, ttm->pages, gtt->ttm.dma_address, flags);drivers/gpu/drm/ttm/ttm_page_alloc.c +6
-6@@ -220,14 +220,14 @@ static struct ttm_pool_manager *_manager;/** * Select the right pool or requested caching state and ttm flags. */ static struct ttm_page_pool *ttm_get_pool (int flags,bool huge, -enum ttm_caching_state cstate) +enum ttm_caching cstate) {int pool_index; -if (cstate == tt_cached) +if (cstate == ttm_cached)return NULL ; -if (cstate == tt_wc) +if (cstate == ttm_write_combined) pool_index =0x0 ;else pool_index =0x1 ;@@ -441,17 +441,17 @@ static void ttm_pool_mm_shrink_fini(struct ttm_pool_manager *manager) }static int ttm_set_pages_caching (struct page **pages, -enum ttm_caching_state cstate,unsigned cpages) +enum ttm_caching cstate,unsigned cpages) {int r =0 ;/* Set page caching */ switch (cstate) { -case tt_uncached: +case ttm_uncached: r =ttm_set_pages_array_uc (pages, cpages);if (r)pr_err ("Failed to set %d pages to uc!\n" , cpages);break ; -case tt_wc: +case ttm_write_combined: r =ttm_set_pages_array_wc (pages, cpages);if (r)pr_err("Failed to set %d pages to wc!\n", cpages);drivers/gpu/drm/ttm/ttm_page_alloc.c +1
-1@@ -486,7 +486,7 @@ static void ttm_handle_caching_failure(struct page**failed_pages, * pages returned in pages array. */ static int ttm_alloc_new_pages (struct list_head *pages,gfp_t gfp_flags, -int ttm_flags,enum ttm_caching_state cstate, +int ttm_flags,enum ttm_caching cstate,unsigned count,unsigned order) {struct page **caching_array;drivers/gpu/drm/ttm/ttm_page_alloc.c +0
-0@@ -566,7 +566,7 @@ static int ttm_alloc_new_pages(struct list_head*pages, gfp_t gfp_flags, * pages is small. */ static void ttm_page_pool_fill_locked(struct
ttm_page_pool*pool, intttm_flags,drivers/gpu/drm/ttm/ttm_page_alloc.c +1
-1- enum ttm_caching_state cstate, + enum ttm_caching cstate,unsigned count, unsigned long
*irq_flags){ struct page *p;drivers/gpu/drm/ttm/ttm_page_alloc.c +1
-1@@ -626,7 +626,7 @@ static void ttm_page_pool_fill_locked(struct ttm_page_pool *pool, int ttm_flags, static int ttm_page_pool_get_pages(struct ttm_page_pool *pool, struct list_head *pages, int ttm_flags, - enum ttm_caching_state cstate, + enum ttm_caching cstate, unsigned count, unsigned order) {unsigned long irq_flags;drivers/gpu/drm/ttm/ttm_page_alloc.c +1
-1@@ -703,7 +703,7 @@ static int ttm_page_pool_get_pages(structttm_page_pool *pool,/* Put all pages in pages list to correct pool to wait for reuse */ static void ttm_put_pages(struct page **pages, unsigned npages, int flags, - enum ttm_caching_state cstate) + enum ttm_caching cstate) { struct ttm_page_pool *pool = ttm_get_pool(flags, false, cstate);#ifdef
CONFIG_TRANSPARENT_HUGEPAGEdrivers/gpu/drm/ttm/ttm_page_alloc.c +1
-1@@ -821,7 +821,7 @@ static void ttm_put_pages(struct page **pages,unsigned npages, int flags, * cached pages. */ static int ttm_get_pages (struct page **pages,unsigned npages,int flags, -enum ttm_caching_state cstate) +enum ttm_caching cstate) {struct ttm_page_pool *pool =ttm_get_pool (flags, false, cstate);#ifdef
CONFIG_TRANSPARENT_HUGEPAGEdrivers/gpu/drm/ttm/ttm_page_alloc.c +0
-0@@ -1040,7 +1040,7 @@ ttm_pool_unpopulate_helper(struct ttm_tt *ttm, unsigned mem_count_update)
put_pages:ttm_put_pages(ttm->pages, ttm->num_pages, ttm->page_flags,drivers/gpu/drm/ttm/ttm_page_alloc.c +1
-1- ttm->caching_state); + ttm->caching);ttm_tt_set_unpopulated(ttm); }drivers/gpu/drm/ttm/ttm_page_alloc.c +1
-1@@ -1057,7 +1057,7 @@ int ttm_pool_populate(struct ttm_tt *ttm, struct ttm_operation_ctx *ctx)return -ENOMEM ; ret =ttm_get_pages (ttm->pages, ttm->num_pages, ttm->page_flags, - ttm->caching_state); + ttm->caching);if (unlikely (ret !=0 )) {ttm_pool_unpopulate_helper (ttm,0 );return ret;drivers/gpu/drm/ttm/ttm_page_alloc_dma.c +3
-3@@ -325,15 +325,15 @@ static struct dma_page *__ttm_dma_alloc_page(struct dma_pool *pool) }return d_page; } -static enum pool_type ttm_to_type (int flags,enum ttm_caching_state cstate) +static enum pool_type ttm_to_type(int flags, enum ttm_caching cstate) {enum pool_type type =IS_UNDEFINED ;if (flags &TTM_PAGE_FLAG_DMA32 ) type |=IS_DMA32 ; -if (cstate == tt_cached) +if (cstate == ttm_cached) type |=IS_CACHED ; -else if (cstate == tt_uncached) +else if (cstate == ttm_uncached) type |=IS_UC ;else type |= IS_WC;drivers/gpu/drm/ttm/ttm_page_alloc_dma.c +1
-1@@ -663,7 +663,7 @@ static struct dma_pool *ttm_dma_find_pool(structdevice *dev, * are pages that have changed their caching state already put them to the * pool. */ -static void ttm_dma_handle_caching_state_failure(struct dma_pool *pool, +static void ttm_dma_handle_caching_failure(struct dma_pool *pool, struct list_head *d_pages, struct page **failed_pages,unsigned cpages)
drivers/gpu/drm/ttm/ttm_page_alloc_dma.c +1
-1@@ -734,7 +734,7 @@ static int ttm_dma_pool_alloc_new_pages(structdma_pool *pool, r =ttm_set_pages_caching (pool, caching_array, cpages);if (r) - ttm_dma_handle_caching_state_failure( + ttm_dma_handle_caching_failure(pool, d_pages, caching_array, cpages); }drivers/gpu/drm/ttm/ttm_page_alloc_dma.c +1
-1@@ -760,7 +760,7 @@ static int ttm_dma_pool_alloc_new_pages(structdma_pool *pool, r =ttm_set_pages_caching (pool, caching_array, cpages);if (r) { - ttm_dma_handle_caching_state_failure( + ttm_dma_handle_caching_failure(pool, d_pages, caching_array, cpages); goto out;drivers/gpu/drm/ttm/ttm_page_alloc_dma.c +1
-1@@ -773,7 +773,7 @@ static int ttm_dma_pool_alloc_new_pages(structdma_pool *pool, if (cpages) { r =ttm_set_pages_caching (pool, caching_array, cpages);if (r) -ttm_dma_handle_caching_state_failure (pool, d_pages, +ttm_dma_handle_caching_failure (pool, d_pages, caching_array, cpages);}out:
drivers/gpu/drm/ttm/ttm_page_alloc_dma.c +1
-1@@ -904,7 +904,7 @@ int ttm_dma_populate(struct ttm_dma_tt *ttm_dma,struct device *dev, INIT_LIST_HEAD(&ttm_dma->pages_list); i =0 ; - type =ttm_to_type (ttm->page_flags, ttm->caching_state); + type =ttm_to_type (ttm->page_flags, ttm->caching);#ifdef CONFIG_TRANSPARENT_HUGEPAGE if (ttm->page_flags & TTM_PAGE_FLAG_DMA32)drivers/gpu/drm/ttm/ttm_page_alloc_dma.c +1
-1@@ -1000,7 +1000,7 @@ void ttm_dma_unpopulate(struct ttm_dma_tt *ttm_dma, struct device *dev)unsigned count, i, npages =0 ;unsigned long irq_flags; - type =ttm_to_type (ttm->page_flags, ttm->caching_state); + type =ttm_to_type (ttm->page_flags, ttm->caching);#ifdef CONFIG_TRANSPARENT_HUGEPAGE pool = ttm_dma_find_pool(dev, type | IS_HUGE);drivers/gpu/drm/ttm/ttm_page_alloc_dma.c +1
-1@@ -1032,7 +1032,7 @@ void ttm_dma_unpopulate(struct ttm_dma_tt *ttm_dma, struct device *dev)return ; is_cached = (ttm_dma_find_pool (pool->dev, -ttm_to_type (ttm->page_flags, tt_cached)) == pool); +ttm_to_type (ttm->page_flags, ttm_cached)) == pool);/* make sure pages array match list and count number of pages */ count = 0;drivers/gpu/drm/ttm/ttm_tt.c +7
-8@@ -114,31 +114,30 @@ static int ttm_sg_tt_alloc_page_directory(struct ttm_dma_tt *ttm)return 0 ; } -static int ttm_tt_set_caching (struct ttm_tt *ttm, -enum ttm_caching_state c_state) +static int ttm_tt_set_caching (struct ttm_tt *ttm,enum ttm_caching caching) { -if (ttm->caching_state == c_state) +if (ttm->caching == caching)return 0 ;/* Can't change the caching state after TT is populated */ if (WARN_ON_ONCE (ttm_tt_is_populated (ttm)))return -EINVAL ; - ttm->caching_state = c_state; + ttm->caching = caching;return 0 ; }int ttm_tt_set_placement_caching (struct ttm_tt *ttm,uint32_t placement) { -enum ttm_caching_state state; +enum ttm_caching state;if (placement &TTM_PL_FLAG_WC ) - state = tt_wc; + state = ttm_write_combined;else if (placement &TTM_PL_FLAG_UNCACHED ) - state = tt_uncached; + state = ttm_uncached;else - state = tt_cached; + state = ttm_cached;return ttm_tt_set_caching (ttm, state);}
drivers/gpu/drm/ttm/ttm_tt.c +1
-1@@ -165,7 +164,7 @@ static void ttm_tt_init_fields(struct ttm_tt *ttm, uint32_t page_flags) { ttm->num_pages = bo->num_pages; - ttm->caching_state = tt_cached; + ttm->caching = ttm_cached; ttm->page_flags = page_flags;ttm_tt_set_unpopulated (ttm); ttm->swap_storage =NULL ;include/drm/ttm/ttm_caching.h new file +5
-0@@ -0,0 +1,34 @@ +/* +* Copyright 2020 Advanced Micro Devices, 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: Christian König
+ */include/drm/ttm/ttm_caching.h new file +11
-0+ +#ifndef _TTM_CACHING_H_ +#define _TTM_CACHING_H_ + +enum ttm_caching { + ttm_uncached, + ttm_write_combined, + ttm_cached +}; + +#endif include/drm/ttm/ttm_tt.h +2
-7@@ -28,6 +28,7 @@#define _TTM_TT_H_#include <linux/types.h> +#include <drm/ttm/ttm_caching.h> struct ttm_tt ;struct ttm_resource ;@@ -42,12 +43,6 @@ struct ttm_operation_ctx;#define TTM_PAGE_FLAG_PRIV_POPULATED (1 << 31) -enum ttm_caching_state { - tt_uncached, - tt_wc, - tt_cached -}; -/** * struct ttm_tt * @@ -69,7 +64,7 @@ struct ttm_tt {unsigned long num_pages;struct sg_table *sg;/* for SG objects via dma-buf */ struct file *swap_storage; -enum ttm_caching_state caching_state; +enum ttm_caching caching; };
Quoted 8 lines
Quoted 8 lines
include/drm/ttm/ttm_tt.h +0
-1static inline bool ttm_tt_is_populated (struct ttm_tt *tt) --2.17.1
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 5/8 drm/ttm: set the tt caching state at creation time
In reply to Christian KönigAll drivers can determine the tt caching state at creation time, no need to do this on the fly during every validation.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 9 ++++++++- drivers/gpu/drm/drm_gem_vram_helper.c | 2 +- drivers/gpu/drm/nouveau/nouveau_sgdma.c | 13 ++++++++++++- drivers/gpu/drm/qxl/qxl_ttm.c | 2 +- drivers/gpu/drm/radeon/radeon_ttm.c | 14 +++++++++++++- drivers/gpu/drm/ttm/ttm_agp_backend.c | 2 +- drivers/gpu/drm/ttm/ttm_tt.c | 16 +++++++++------- drivers/gpu/drm/vmwgfx/vmwgfx_ttm_buffer.c | 6 ++++-- include/drm/ttm/ttm_tt.h | 7 ++++--- 9 files changed, 53 insertions(+), 18 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +8 -1
@@ -1292,7 +1292,9 @@ static void amdgpu_ttm_backend_destroy(struct ttm_bo_device *bdev,static struct ttm_tt *amdgpu_ttm_tt_create (struct ttm_buffer_object *bo,uint32_t page_flags) { +struct amdgpu_bo *abo =ttm_to_amdgpu_bo (bo);struct amdgpu_ttm_tt *gtt; +enum ttm_caching caching; gtt =kzalloc (sizeof (struct amdgpu_ttm_tt ),GFP_KERNEL );if (gtt ==NULL ) {
@@ -1300,8 +1302,13 @@ static struct ttm_tt *amdgpu_ttm_tt_create(struct ttm_buffer_object *bo, } gtt->gobj = &bo->base; +if (abo->flags &AMDGPU_GEM_CREATE_CPU_GTT_USWC ) + caching = ttm_write_combined; +else + caching = ttm_cached; +/* allocate space for the uninitialized page entries */ -if (ttm_sg_tt_init (>t->ttm, bo, page_flags)) { +if (ttm_sg_tt_init (>t->ttm, bo, page_flags, caching)) {kfree (gtt);return NULL ; }
drivers/gpu/drm/drm_gem_vram_helper.c +1 -1
@@ -910,7 +910,7 @@ static struct ttm_tt *bo_driver_ttm_tt_create(struct ttm_buffer_object *bo,if (!tt)return NULL ; - ret =ttm_tt_init (tt, bo, page_flags); + ret =ttm_tt_init (tt, bo, page_flags, ttm_cached);if (ret <0 ) goto err_ttm_tt_init;
drivers/gpu/drm/nouveau/nouveau_sgdma.c +12 -1
@@ -5,6 +5,7 @@#include "nouveau_drv.h" #include "nouveau_mem.h" #include "nouveau_ttm.h" +#include "nouveau_bo.h" struct nouveau_sgdma_be {/* this has to be the first field so populate/unpopulated in
@@ -67,13 +68,23 @@ nouveau_sgdma_unbind(struct ttm_bo_device *bdev, struct ttm_tt *ttm)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_bo *nvbo =nouveau_bo (bo);struct nouveau_sgdma_be *nvbe; +enum ttm_caching caching; + +if (nvbo->force_coherent) + caching = ttm_uncached; +else if (drm->agp.bridge) + caching = ttm_write_combined; +else + caching = ttm_cached; nvbe =kzalloc (sizeof (*nvbe),GFP_KERNEL );if (!nvbe)return NULL ; -if (ttm_dma_tt_init (&nvbe->ttm, bo, page_flags)) { +if (ttm_dma_tt_init (&nvbe->ttm, bo, page_flags, caching)) {kfree (nvbe);return NULL ; }
drivers/gpu/drm/qxl/qxl_ttm.c +1 -1
@@ -146,7 +146,7 @@ static struct ttm_tt *qxl_ttm_tt_create(struct ttm_buffer_object *bo,if (gtt ==NULL )return NULL ; gtt->qdev = qdev; -if (ttm_tt_init (>t->ttm, bo, page_flags)) { +if (ttm_tt_init (>t->ttm, bo, page_flags, ttm_cached)) {kfree (gtt);return NULL ; }
drivers/gpu/drm/radeon/radeon_ttm.c +13 -1
@@ -590,6 +590,10 @@ static struct ttm_tt *radeon_ttm_tt_create(struct ttm_buffer_object *bo, {struct radeon_device *rdev;struct radeon_ttm_tt *gtt; +enum ttm_caching caching; +struct radeon_bo *rbo; + + rbo = container_of(bo, struct radeon_bo, tbo); rdev =radeon_get_rdev (bo->bdev);#if IS_ENABLED (CONFIG_AGP )
@@ -603,7 +607,15 @@ static struct ttm_tt *radeon_ttm_tt_create(struct ttm_buffer_object *bo,if (gtt ==NULL ) {return NULL ; } -if (ttm_dma_tt_init (>t->ttm, bo, page_flags)) { + +if (rbo->flags &RADEON_GEM_GTT_UC ) + caching = ttm_uncached; +else if (rbo->flags &RADEON_GEM_GTT_WC ) + caching = ttm_write_combined; +else + caching = ttm_cached; + +if (ttm_dma_tt_init (>t->ttm, bo, page_flags, caching)) {kfree (gtt);return NULL ; }
drivers/gpu/drm/ttm/ttm_agp_backend.c +1 -1
@@ -136,7 +136,7 @@ struct ttm_tt *ttm_agp_tt_create(struct ttm_buffer_object *bo, agp_be->mem =NULL ; agp_be->bridge = bridge; -if (ttm_tt_init (&agp_be->ttm, bo, page_flags)) { +if (ttm_tt_init (&agp_be->ttm, bo, page_flags, ttm_write_combined)) {kfree (agp_be);return NULL ; }
drivers/gpu/drm/ttm/ttm_tt.c +9 -7
@@ -161,7 +161,8 @@ void ttm_tt_destroy(struct ttm_bo_device *bdev, struct ttm_tt *ttm)static void ttm_tt_init_fields (struct ttm_tt *ttm,struct ttm_buffer_object *bo, -uint32_t page_flags) +uint32_t page_flags, +enum ttm_caching caching) { ttm->num_pages = bo->num_pages; ttm->caching = ttm_cached;
@@ -169,12 +170,13 @@ static void ttm_tt_init_fields(struct ttm_tt *ttm,ttm_tt_set_unpopulated (ttm); ttm->swap_storage =NULL ; ttm->sg = bo->sg; + ttm->caching = caching; }int ttm_tt_init (struct ttm_tt *ttm,struct ttm_buffer_object *bo, -uint32_t page_flags) +uint32_t page_flags,enum ttm_caching caching) { -ttm_tt_init_fields (ttm, bo, page_flags); +ttm_tt_init_fields (ttm, bo, page_flags, caching);if (ttm_tt_alloc_page_directory (ttm)) {pr_err ("Failed allocating page table\n" );
@@ -192,11 +194,11 @@ void ttm_tt_fini(struct ttm_tt *ttm)EXPORT_SYMBOL (ttm_tt_fini);int ttm_dma_tt_init (struct ttm_dma_tt *ttm_dma,struct ttm_buffer_object *bo, -uint32_t page_flags) +uint32_t page_flags,enum ttm_caching caching) {struct ttm_tt *ttm = &ttm_dma->ttm; -ttm_tt_init_fields (ttm, bo, page_flags); +ttm_tt_init_fields (ttm, bo, page_flags, caching);INIT_LIST_HEAD (&ttm_dma->pages_list);if (ttm_dma_tt_alloc_page_directory (ttm_dma)) {
@@ -208,12 +210,12 @@ int ttm_dma_tt_init(struct ttm_dma_tt *ttm_dma, struct ttm_buffer_object *bo,EXPORT_SYMBOL (ttm_dma_tt_init);int ttm_sg_tt_init (struct ttm_dma_tt *ttm_dma,struct ttm_buffer_object *bo, -uint32_t page_flags) +uint32_t page_flags,enum ttm_caching caching) {struct ttm_tt *ttm = &ttm_dma->ttm;int ret; -ttm_tt_init_fields (ttm, bo, page_flags); +ttm_tt_init_fields (ttm, bo, page_flags, caching);INIT_LIST_HEAD (&ttm_dma->pages_list);if (page_flags &TTM_PAGE_FLAG_SG )
drivers/gpu/drm/vmwgfx/vmwgfx_ttm_buffer.c +4 -2
@@ -647,9 +647,11 @@ static struct ttm_tt *vmw_ttm_tt_create(struct ttm_buffer_object *bo, vmw_be->mob =NULL ;if (vmw_be->dev_priv->map_mode == vmw_dma_alloc_coherent) - ret =ttm_dma_tt_init (&vmw_be->dma_ttm, bo, page_flags); + ret =ttm_dma_tt_init (&vmw_be->dma_ttm, bo, page_flags, + ttm_cached);else - ret =ttm_tt_init (&vmw_be->dma_ttm.ttm, bo, page_flags); + ret =ttm_tt_init (&vmw_be->dma_ttm.ttm, bo, page_flags, + ttm_cached);if (unlikely (ret !=0 )) goto out_no_init;
include/drm/ttm/ttm_tt.h +4 -3
@@ -116,6 +116,7 @@ int ttm_tt_create(struct ttm_buffer_object *bo, bool zero_alloc);* @ttm: The struct ttm_tt. * @bo: The buffer object we create the ttm for. * @page_flags: Page flags as identified by TTM_PAGE_FLAG_XX flags. +* @caching: the desired caching state of the pages * * Create a struct ttm_tt to back data with system memory pages. * No pages are actually allocated.
@@ -123,11 +124,11 @@ int ttm_tt_create(struct ttm_buffer_object *bo, bool zero_alloc);* NULL: Out of memory. */ int ttm_tt_init (struct ttm_tt *ttm,struct ttm_buffer_object *bo, -uint32_t page_flags); +uint32_t page_flags,enum ttm_caching caching);int ttm_dma_tt_init (struct ttm_dma_tt *ttm_dma,struct ttm_buffer_object *bo, -uint32_t page_flags); +uint32_t page_flags,enum ttm_caching caching);int ttm_sg_tt_init (struct ttm_dma_tt *ttm_dma,struct ttm_buffer_object *bo, -uint32_t page_flags); +uint32_t page_flags,enum ttm_caching caching);/** * ttm_tt_fini
Signature · 6 lines
2.17.1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
RE: [PATCH 5/8] drm/ttm: set the tt caching state at creation time
Quoted 10 lines
-----Original Message-----
From: dri-devel <[email protected]> On Behalf Of Christian König
Sent: Thursday, October 1, 2020 7:28 AM
To: [email protected]; [email protected]; [email protected]; [email protected]
Subject: [PATCH 5/8] drm/ttm: set the tt caching state at creation timeAll drivers can determine the tt caching state at creation time, no need to do this on the fly during every validation.
m
Quoted 282 lines
Signed-off-by Christian König <[email protected]>---
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 9 ++++++++- drivers/gpu/drm/drm_gem_vram_helper.c | 2 +- drivers/gpu/drm/nouveau/nouveau_sgdma.c | 13 ++++++++++++- drivers/gpu/drm/qxl/qxl_ttm.c | 2 +- drivers/gpu/drm/radeon/radeon_ttm.c | 14 +++++++++++++- drivers/gpu/drm/ttm/ttm_agp_backend.c | 2 +- drivers/gpu/drm/ttm/ttm_tt.c | 16 +++++++++------- drivers/gpu/drm/vmwgfx/vmwgfx_ttm_buffer.c | 6 ++++-- include/drm/ttm/ttm_tt.h | 7 ++++--- 9 files changed, 53 insertions(+), 18 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +2
-0@@ -1292,7 +1292,9 @@ static void amdgpu_ttm_backend_destroy(structttm_bo_device *bdev, static struct ttm_tt *amdgpu_ttm_tt_create(struct ttm_buffer_object *bo, uint32_t page_flags) { + struct amdgpu_bo *abo = ttm_to_amdgpu_bo(bo);struct amdgpu_ttm_tt *gtt; +enum ttm_caching caching; gtt =kzalloc (sizeof (struct amdgpu_ttm_tt ),GFP_KERNEL );if (gtt == NULL) {drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +6
-1@@ -1300,8 +1302,13 @@ static struct ttm_tt *amdgpu_ttm_tt_create(struct ttm_buffer_object *bo, } gtt->gobj = &bo->base; +if (abo->flags &AMDGPU_GEM_CREATE_CPU_GTT_USWC ) + caching = ttm_write_combined; +else + caching = ttm_cached; +/* allocate space for the uninitialized page entries */ -if (ttm_sg_tt_init (>t->ttm, bo, page_flags)) { +if (ttm_sg_tt_init (>t->ttm, bo, page_flags, caching)) {kfree (gtt);return NULL ;}drivers/gpu/drm/drm_gem_vram_helper.c +1
-1@@ -910,7 +910,7 @@ static struct ttm_tt *bo_driver_ttm_tt_create(struct ttm_buffer_object *bo, if (!tt)return NULL ; - ret =ttm_tt_init (tt, bo, page_flags); + ret =ttm_tt_init (tt, bo, page_flags, ttm_cached);if (ret <0 ) goto err_ttm_tt_init;drivers/gpu/drm/nouveau/nouveau_sgdma.c +1
-0@@ -5,6 +5,7 @@#include "nouveau_drv.h" #include "nouveau_mem.h" #include "nouveau_ttm.h" +#include "nouveau_bo.h" struct nouveau_sgdma_be {/* this has to be the first field so populate/unpopulated in @@ -67,13 +68,23 @@ nouveau_sgdma_unbind(struct ttm_bo_device *bdev, struct ttm_tt *ttm)struct
ttm_tt*nouveau_sgdma_create_ttm(struct ttm_buffer_object *bo, uint32_t page_flags)
{drivers/gpu/drm/nouveau/nouveau_sgdma.c +2
-0+struct nouveau_drm *drm =nouveau_bdev (bo->bdev); +struct nouveau_bo *nvbo =nouveau_bo (bo);struct nouveau_sgdma_be *nvbe;drivers/gpu/drm/nouveau/nouveau_sgdma.c +8
-0+enum ttm_caching caching; + +if (nvbo->force_coherent) + caching = ttm_uncached; +else if (drm->agp.bridge) + caching = ttm_write_combined; +else + caching = ttm_cached;nvbe = kzalloc(sizeof(*nvbe), GFP_KERNEL); if (!nvbe) return NULL;drivers/gpu/drm/nouveau/nouveau_sgdma.c +1
-1-if (ttm_dma_tt_init (&nvbe->ttm, bo, page_flags)) { +if (ttm_dma_tt_init (&nvbe->ttm, bo, page_flags, caching)) {kfree(nvbe); return NULL; }drivers/gpu/drm/qxl/qxl_ttm.c +1
-1@@ -146,7 +146,7 @@ static struct ttm_tt *qxl_ttm_tt_create(struct ttm_buffer_object *bo, if (gtt == NULL)return NULL ; gtt->qdev = qdev; -if (ttm_tt_init (>t->ttm, bo, page_flags)) { +if (ttm_tt_init (>t->ttm, bo, page_flags, ttm_cached)) {kfree (gtt);return NULL ;}drivers/gpu/drm/radeon/radeon_ttm.c +4
-0@@ -590,6 +590,10 @@ static struct ttm_tt *radeon_ttm_tt_create(struct ttm_buffer_object *bo, {struct radeon_device *rdev;struct radeon_ttm_tt *gtt; +enum ttm_caching caching; +struct radeon_bo *rbo; + + rbo = container_of(bo, struct radeon_bo, tbo); rdev =radeon_get_rdev (bo->bdev);#if
IS_ENABLED(CONFIG_AGP)drivers/gpu/drm/radeon/radeon_ttm.c +9
-1@@ -603,7 +607,15 @@ static struct ttm_tt *radeon_ttm_tt_create(struct ttm_buffer_object *bo, if (gtt == NULL) {return NULL ; } -if (ttm_dma_tt_init (>t->ttm, bo, page_flags)) { + +if (rbo->flags &RADEON_GEM_GTT_UC ) + caching = ttm_uncached; +else if (rbo->flags &RADEON_GEM_GTT_WC ) + caching = ttm_write_combined; +else + caching = ttm_cached; + +if (ttm_dma_tt_init (>t->ttm, bo, page_flags, caching)) {kfree (gtt);return NULL ;}drivers/gpu/drm/ttm/ttm_agp_backend.c +1
-1@@ -136,7 +136,7 @@ struct ttm_tt *ttm_agp_tt_create(struct ttm_buffer_object *bo, agp_be->mem =NULL ; agp_be->bridge = bridge; -if (ttm_tt_init (&agp_be->ttm, bo, page_flags)) { +if (ttm_tt_init (&agp_be->ttm, bo, page_flags, ttm_write_combined)) {kfree (agp_be);return NULL; }drivers/gpu/drm/ttm/ttm_tt.c +2
-1@@ -161,7 +161,8 @@ void ttm_tt_destroy(struct ttm_bo_device *bdev, struct ttm_tt *ttm)static void ttm_tt_init_fields (struct ttm_tt *ttm,struct ttm_buffer_object *bo, -uint32_t page_flags) +uint32_t page_flags, +enum ttm_caching caching) { ttm->num_pages = bo->num_pages;ttm->caching = ttm_cached;drivers/gpu/drm/ttm/ttm_tt.c +3
-2@@ -169,12 +170,13 @@ static void ttm_tt_init_fields(struct ttm_tt *ttm,ttm_tt_set_unpopulated (ttm); ttm->swap_storage =NULL ; ttm->sg = bo->sg; + ttm->caching = caching; }int ttm_tt_init (struct ttm_tt *ttm,struct ttm_buffer_object *bo, -uint32_t page_flags) +uint32_t page_flags,enum ttm_caching caching) { -ttm_tt_init_fields (ttm, bo, page_flags); +ttm_tt_init_fields (ttm, bo, page_flags, caching);if (ttm_tt_alloc_page_directory (ttm)) {pr_err ("Failed allocating page table\n" );@@ -192,11 +194,11 @@ void ttm_tt_fini(struct ttm_tt *ttm)EXPORT_SYMBOL (ttm_tt_fini);int ttm_dma_tt_init(struct
ttm_dma_tt*ttm_dma, structttm_buffer_object*bo,drivers/gpu/drm/ttm/ttm_tt.c +1
-1- uint32_t page_flags) + uint32_t page_flags, enum ttm_caching caching){ struct ttm_tt *ttm = &ttm_dma->ttm;drivers/gpu/drm/ttm/ttm_tt.c +1
-1-ttm_tt_init_fields (ttm, bo, page_flags); +ttm_tt_init_fields (ttm, bo, page_flags, caching);INIT_LIST_HEAD(&ttm_dma->pages_list); if (ttm_dma_tt_alloc_page_directory(ttm_dma)) {drivers/gpu/drm/ttm/ttm_tt.c +0
-0@@ -208,12 +210,12 @@ int ttm_dma_tt_init(struct ttm_dma_tt *ttm_dma,struct ttm_buffer_object *bo,EXPORT_SYMBOL (ttm_dma_tt_init );int ttm_sg_tt_init(struct
ttm_dma_tt*ttm_dma, structttm_buffer_object*bo,drivers/gpu/drm/ttm/ttm_tt.c +1
-1- uint32_t page_flags) + uint32_t page_flags, enum ttm_caching caching){ struct ttm_tt *ttm = &ttm_dma->ttm; int ret;drivers/gpu/drm/ttm/ttm_tt.c +1
-1-ttm_tt_init_fields (ttm, bo, page_flags); +ttm_tt_init_fields (ttm, bo, page_flags, caching);INIT_LIST_HEAD(&ttm_dma->pages_list); if (page_flags & TTM_PAGE_FLAG_SG)drivers/gpu/drm/vmwgfx/vmwgfx_ttm_buffer.c +4
-2@@ -647,9 +647,11 @@ static struct ttm_tt *vmw_ttm_tt_create(struct ttm_buffer_object *bo, vmw_be->mob =NULL ;if (vmw_be->dev_priv->map_mode == vmw_dma_alloc_coherent) - ret =ttm_dma_tt_init (&vmw_be->dma_ttm, bo, page_flags); + ret =ttm_dma_tt_init (&vmw_be->dma_ttm, bo, page_flags, + ttm_cached);else - ret =ttm_tt_init (&vmw_be->dma_ttm.ttm, bo, page_flags); + ret =ttm_tt_init (&vmw_be->dma_ttm.ttm, bo, page_flags, + ttm_cached);if (unlikely (ret !=0 )) goto out_no_init;include/drm/ttm/ttm_tt.h +1
-0@@ -116,6 +116,7 @@ int ttm_tt_create(struct ttm_buffer_object *bo, bool zero_alloc); * @ttm: The struct ttm_tt. * @bo: The buffer object we create the ttm for. * @page_flags: Page flags as identified by TTM_PAGE_FLAG_XX flags. + * @caching: the desired caching state of the pages * * Create a struct ttm_tt to back data with system memory pages.* No pages are actually allocated.
include/drm/ttm/ttm_tt.h +1
-1@@ -123,11 +124,11 @@ int ttm_tt_create(struct ttm_buffer_object *bo,bool zero_alloc); * NULL: Out of memory. */ int ttm_tt_init (struct ttm_tt *ttm,struct ttm_buffer_object *bo, -uint32_t page_flags); +uint32_t page_flags,enum ttm_caching caching);int ttm_dma_tt_init(struct
ttm_dma_tt*ttm_dma, structttm_buffer_object*bo,include/drm/ttm/ttm_tt.h +1
-1- uint32_t page_flags); + uint32_t page_flags, enum ttm_caching caching);int ttm_sg_tt_init(struct
ttm_dma_tt*ttm_dma, structttm_buffer_object*bo,include/drm/ttm/ttm_tt.h +1
-1- uint32_t page_flags); + uint32_t page_flags, enum ttm_caching caching);/**
*ttm_tt_fini
--
2.17.1
Quoted 4 lines
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 6/8 drm/ttm: add caching state to ttm_bus_placement
In reply to Christian KönigAnd implement setting it up correctly in the drivers.
This allows getting rid of the placement flags for this.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 1 + drivers/gpu/drm/drm_gem_vram_helper.c | 1 + drivers/gpu/drm/nouveau/nouveau_bo.c | 11 +++++++++++ drivers/gpu/drm/qxl/qxl_ttm.c | 2 ++ drivers/gpu/drm/radeon/radeon_ttm.c | 2 ++ drivers/gpu/drm/vmwgfx/vmwgfx_ttm_buffer.c | 1 + include/drm/ttm/ttm_resource.h | 8 +++++--- 7 files changed, 23 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +1 -0
@@ -769,6 +769,7 @@ static int amdgpu_ttm_io_mem_reserve(struct ttm_bo_device *bdev, struct ttm_reso mem->bus.offset += adev->gmc.aper_base; mem->bus.is_iomem = true; + mem->bus.caching = ttm_write_combined;break ;default :return -EINVAL ;
drivers/gpu/drm/drm_gem_vram_helper.c +1 -0
@@ -961,6 +961,7 @@ static int bo_driver_io_mem_reserve(struct ttm_bo_device *bdev,case TTM_PL_VRAM : mem->bus.offset = (mem->start <<PAGE_SHIFT ) + vmm->vram_base; mem->bus.is_iomem = true; + mem->bus.caching = ttm_write_combined;break ;default :return -EINVAL ;
drivers/gpu/drm/nouveau/nouveau_bo.c +11 -0
@@ -1124,6 +1124,8 @@ nouveau_ttm_io_mem_reserve(struct ttm_bo_device *bdev, struct ttm_resource *reg)struct nouveau_drm *drm =nouveau_bdev (bdev);struct nvkm_device *device =nvxx_device (&drm->client.device);struct nouveau_mem *mem =nouveau_mem (reg); +struct nvif_mmu *mmu = &drm->client.mmu; +const u8 type = mmu->type[drm->ttm.type_vram].type;int ret;mutex_lock (&drm->ttm.io_reserve_mutex);
@@ -1139,6 +1141,7 @@ nouveau_ttm_io_mem_reserve(struct ttm_bo_device *bdev, struct ttm_resource *reg) reg->bus.offset = (reg->start <<PAGE_SHIFT ) + drm->agp.base; reg->bus.is_iomem = !drm->agp.cma; + reg->bus.caching = ttm_write_combined; }#endif if (drm->client.mem->oclass < NVIF_CLASS_MEM_NV50 ||
@@ -1152,6 +1155,14 @@ nouveau_ttm_io_mem_reserve(struct ttm_bo_device *bdev, struct ttm_resource *reg) reg->bus.offset = (reg->start <<PAGE_SHIFT ) + device->func->resource_addr (device,1 ); reg->bus.is_iomem = true; + +/* Some BARs do not support being ioremapped WC */ +if (drm->client.device.info.family >=NV_DEVICE_INFO_V0_TESLA && + type &NVIF_MEM_UNCACHED ) + reg->bus.caching = ttm_uncached; +else + reg->bus.caching = ttm_write_combined; +if (drm->client.mem->oclass >=NVIF_CLASS_MEM_NV50 ) {union {struct nv50_mem_map_v0 nv50;
drivers/gpu/drm/qxl/qxl_ttm.c +2 -0
@@ -83,11 +83,13 @@ int qxl_ttm_io_mem_reserve(struct ttm_bo_device *bdev,case TTM_PL_VRAM : mem->bus.is_iomem = true; mem->bus.offset = (mem->start <<PAGE_SHIFT ) + qdev->vram_base; + mem->bus.caching = ttm_cached;break ;case TTM_PL_PRIV : mem->bus.is_iomem = true; mem->bus.offset = (mem->start <<PAGE_SHIFT ) + qdev->surfaceram_base; + mem->bus.caching = ttm_cached;break ;default :return -EINVAL ;
drivers/gpu/drm/radeon/radeon_ttm.c +2 -0
@@ -372,6 +372,7 @@ static int radeon_ttm_io_mem_reserve(struct ttm_bo_device *bdev, struct ttm_reso mem->bus.offset = (mem->start <<PAGE_SHIFT ) + rdev->mc.agp_base; mem->bus.is_iomem = !rdev->ddev->agp->cant_use_aperture; + mem->bus.caching = ttm_write_combined; }#endif break ;
@@ -382,6 +383,7 @@ static int radeon_ttm_io_mem_reserve(struct ttm_bo_device *bdev, struct ttm_resoreturn -EINVAL ; mem->bus.offset += rdev->mc.aper_base; mem->bus.is_iomem = true; + mem->bus.caching = ttm_write_combined;#ifdef __alpha__/* * Alpha: use bus.addr to hold the ioremap() return,
drivers/gpu/drm/vmwgfx/vmwgfx_ttm_buffer.c +1 -0
@@ -688,6 +688,7 @@ static int vmw_ttm_io_mem_reserve(struct ttm_bo_device *bdev, struct ttm_resourc mem->bus.offset = (mem->start <<PAGE_SHIFT ) + dev_priv->vram_start; mem->bus.is_iomem = true; + mem->bus.caching = ttm_cached;break ;default :return -EINVAL ;
include/drm/ttm/ttm_resource.h +5 -3
@@ -29,6 +29,7 @@#include <linux/mutex.h> #include <linux/dma-fence.h> #include <drm/drm_print.h> +#include <drm/ttm/ttm_caching.h> #define TTM_MAX_BO_PRIORITY 4U
@@ -148,9 +149,10 @@ struct ttm_resource_manager {* Structure indicating the bus placement of an object. */ struct ttm_bus_placement { -void *addr; -phys_addr_t offset; -bool is_iomem; +void *addr; +phys_addr_t offset; +bool is_iomem; +enum ttm_caching caching; };/**
Signature · 6 lines
2.17.1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
RE: [PATCH 6/8] drm/ttm: add caching state to ttm_bus_placement
Quoted 68 lines
-----Original Message-----
From: dri-devel <[email protected]> On Behalf Of Christian König
Sent: Thursday, October 1, 2020 7:28 AM
To: [email protected]; [email protected]; [email protected]; [email protected]
Subject: [PATCH 6/8] drm/ttm: add caching state tottm_bus_placementAnd implement setting it up correctly in the drivers.
This allows getting rid of the placement flags for this.
Signed-off-by Christian König <[email protected]>---
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 1 + drivers/gpu/drm/drm_gem_vram_helper.c | 1 + drivers/gpu/drm/nouveau/nouveau_bo.c | 11 +++++++++++ drivers/gpu/drm/qxl/qxl_ttm.c | 2 ++ drivers/gpu/drm/radeon/radeon_ttm.c | 2 ++ drivers/gpu/drm/vmwgfx/vmwgfx_ttm_buffer.c | 1 + include/drm/ttm/ttm_resource.h | 8 +++++--- 7 files changed, 23 insertions(+), 3 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +0
-0@@ -769,6 +769,7 @@ static int amdgpu_ttm_io_mem_reserve(struct
ttm_bo_device*bdev, structttm_resomem->bus.offset += adev->gmc.aper_base; mem->bus.is_iomem = true;drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +1
-0+ mem->bus.caching = ttm_write_combined;break; default: return -EINVAL;drivers/gpu/drm/drm_gem_vram_helper.c +1
-0@@ -961,6 +961,7 @@ static int bo_driver_io_mem_reserve(structttm_bo_device *bdev, case TTM_PL_VRAM: mem->bus.offset = (mem->start << PAGE_SHIFT) + vmm- >vram_base; mem->bus.is_iomem = true; + mem->bus.caching = ttm_write_combined;break ;default: return -EINVAL;drivers/gpu/drm/nouveau/nouveau_bo.c +2
-0@@ -1124,6 +1124,8 @@ nouveau_ttm_io_mem_reserve(struct ttm_bo_device *bdev, struct ttm_resource *reg) struct nouveau_drm *drm = nouveau_bdev(bdev);struct nvkm_device *device =nvxx_device (&drm->client.device);struct nouveau_mem *mem =nouveau_mem (reg); +struct nvif_mmu *mmu = &drm->client.mmu; +const u8 type = mmu->type[drm->ttm.type_vram].type;int ret;mutex_lock(&drm->ttm.io_reserve_mutex);
drivers/gpu/drm/nouveau/nouveau_bo.c nouveau_ttm_io_mem_reserve(struct · line 1144
Quoted 4 lines
drivers/gpu/drm/nouveau/nouveau_bo.c +0
-0@@ -1139,6 +1141,7 @@ nouveau_ttm_io_mem_reserve(struct ttm_bo_device *bdev, struct ttm_resource *reg) reg->bus.offset = (reg->start << PAGE_SHIFT) + drm->agp.base; reg->bus.is_iomem = !drm->agp.cma;
Don't really know if this is true or not, so I will take your word on it. 😊
Quoted 29 lines
drivers/gpu/drm/nouveau/nouveau_bo.c +1
-0+ reg->bus.caching = ttm_write_combined; }#endif if (drm->client.mem->oclass < NVIF_CLASS_MEM_NV50 ||drivers/gpu/drm/nouveau/nouveau_bo.c +3
-0@@ -1152,6 +1155,14 @@ nouveau_ttm_io_mem_reserve(struct ttm_bo_device *bdev, struct ttm_resource *reg) reg->bus.offset = (reg->start << PAGE_SHIFT) + device->func->resource_addr (device,1 ); reg->bus.is_iomem = true; + +/* Some BARs do not support being ioremapped WC */ + if (drm->client.device.info.family >=
NV_DEVICE_INFO_V0_TESLA&&drivers/gpu/drm/nouveau/nouveau_bo.c +5
-0+ type & NVIF_MEM_UNCACHED) + reg->bus.caching = ttm_uncached; + else + reg->bus.caching = ttm_write_combined; +if (drm->client.mem->oclass >= NVIF_CLASS_MEM_NV50) { union { struct nv50_mem_map_v0 nv50;drivers/gpu/drm/qxl/qxl_ttm.c +0
-0@@ -83,11 +83,13 @@ int qxl_ttm_io_mem_reserve(struct ttm_bo_device *bdev, case TTM_PL_VRAM:
drivers/gpu/drm/qxl/qxl_ttm.c int qxl_ttm_io_mem_reserve(struct ttm_bo_device · line 94
Quoted 10 lines
drivers/gpu/drm/qxl/qxl_ttm.c +2
-0mem->bus.is_iomem = true; mem->bus.offset = (mem->start <<PAGE_SHIFT ) + qdev- >vram_base; + mem->bus.caching = ttm_cached;break ;case TTM_PL_PRIV : mem->bus.is_iomem = true; mem->bus.offset = (mem->start <<PAGE_SHIFT ) + qdev->surfaceram_base; + mem->bus.caching = ttm_cached;
is_iomem = true and ttm_cached is correct?
qxl is a software gpu?
If this is true, then this looks reasonable.
M
Quoted 71 lines
drivers/gpu/drm/qxl/qxl_ttm.c +0
-0break ;default: return -EINVAL;drivers/gpu/drm/radeon/radeon_ttm.c +0
-0@@ -372,6 +372,7 @@ static int radeon_ttm_io_mem_reserve(struct
ttm_bo_device*bdev, structttm_resomem->bus.offset = (mem->start << PAGE_SHIFT) + rdev->mc.agp_base; mem->bus.is_iomem = !rdev->ddev->agp-Quoted 1 line
cant_use_aperture;drivers/gpu/drm/radeon/radeon_ttm.c +1
-0+ mem->bus.caching = ttm_write_combined;} #endif break;drivers/gpu/drm/radeon/radeon_ttm.c +0
-0@@ -382,6 +383,7 @@ static int radeon_ttm_io_mem_reserve(struct
ttm_bo_device*bdev, structttm_resoreturn -EINVAL; mem->bus.offset += rdev->mc.aper_base; mem->bus.is_iomem = true;drivers/gpu/drm/radeon/radeon_ttm.c +1
-0+ mem->bus.caching = ttm_write_combined;#ifdef __alpha__ /* * Alpha: use bus.addr to hold the ioremap() return,drivers/gpu/drm/vmwgfx/vmwgfx_ttm_buffer.c +0
-0@@ -688,6 +688,7 @@ static int vmw_ttm_io_mem_reserve(struct
ttm_bo_device*bdev, structttm_resourcmem->bus.offset = (mem->start << PAGE_SHIFT) + dev_priv->vram_start; mem->bus.is_iomem = true;drivers/gpu/drm/vmwgfx/vmwgfx_ttm_buffer.c +1
-0+ mem->bus.caching = ttm_cached;break; default: return -EINVAL;include/drm/ttm/ttm_resource.h +5
-4@@ -29,6 +29,7 @@#include <linux/mutex.h> #include <linux/dma-fence.h> #include <drm/drm_print.h> +#include <drm/ttm/ttm_caching.h> #define TTM_MAX_BO_PRIORITY 4U@@ -148,9 +149,10 @@ struct ttm_resource_manager {* Structure indicating the bus placement of an object. */ struct ttm_bus_placement { -void *addr; -phys_addr_t offset; -bool is_iomem; +void *addr; +phys_addr_t offset; +bool is_iomem; +enum ttm_caching caching; };/** -- 2.17.1
Quoted 4 lines
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 6/8] drm/ttm: add caching state to ttm_bus_placement
Am 05.10.20 um 17:39 schrieb Ruhl, Michael J:
Quoted 105 lines
Quoted 68 lines
-----Original Message-----
From: dri-devel <[email protected]> On Behalf Of Christian König
Sent: Thursday, October 1, 2020 7:28 AM
To: [email protected]; [email protected]; [email protected]; [email protected]
Subject: [PATCH 6/8] drm/ttm: add caching state tottm_bus_placementAnd implement setting it up correctly in the drivers.
This allows getting rid of the placement flags for this.
Signed-off-by Christian König <[email protected]>---
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 1 + drivers/gpu/drm/drm_gem_vram_helper.c | 1 + drivers/gpu/drm/nouveau/nouveau_bo.c | 11 +++++++++++ drivers/gpu/drm/qxl/qxl_ttm.c | 2 ++ drivers/gpu/drm/radeon/radeon_ttm.c | 2 ++ drivers/gpu/drm/vmwgfx/vmwgfx_ttm_buffer.c | 1 + include/drm/ttm/ttm_resource.h | 8 +++++--- 7 files changed, 23 insertions(+), 3 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +0
-0@@ -769,6 +769,7 @@ static int amdgpu_ttm_io_mem_reserve(struct
ttm_bo_device*bdev, structttm_resomem->bus.offset += adev->gmc.aper_base; mem->bus.is_iomem = true;drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +1
-0+ mem->bus.caching = ttm_write_combined;break; default: return -EINVAL;drivers/gpu/drm/drm_gem_vram_helper.c +1
-0@@ -961,6 +961,7 @@ static int bo_driver_io_mem_reserve(structttm_bo_device *bdev, case TTM_PL_VRAM: mem->bus.offset = (mem->start << PAGE_SHIFT) + vmm- > vram_base; mem->bus.is_iomem = true; + mem->bus.caching = ttm_write_combined;break ;default: return -EINVAL;drivers/gpu/drm/nouveau/nouveau_bo.c +2
-0@@ -1124,6 +1124,8 @@ nouveau_ttm_io_mem_reserve(struct ttm_bo_device *bdev, struct ttm_resource *reg) struct nouveau_drm *drm = nouveau_bdev(bdev);struct nvkm_device *device =nvxx_device (&drm->client.device);struct nouveau_mem *mem =nouveau_mem (reg); +struct nvif_mmu *mmu = &drm->client.mmu; +const u8 type = mmu->type[drm->ttm.type_vram].type;int ret;mutex_lock(&drm->ttm.io_reserve_mutex);drivers/gpu/drm/nouveau/nouveau_bo.c nouveau_ttm_io_mem_reserve(struct · line 1144
Quoted 4 lines
drivers/gpu/drm/nouveau/nouveau_bo.c +0
-0@@ -1139,6 +1141,7 @@ nouveau_ttm_io_mem_reserve(struct ttm_bo_device *bdev, struct ttm_resource *reg) reg->bus.offset = (reg->start << PAGE_SHIFT) + drm->agp.base; reg->bus.is_iomem = !drm->agp.cma;Don't really know if this is true or not, so I will take your word on it. 😊
Quoted 31 lines
drivers/gpu/drm/nouveau/nouveau_bo.c +1
-0+ reg->bus.caching = ttm_write_combined; }#endif if (drm->client.mem->oclass < NVIF_CLASS_MEM_NV50 ||drivers/gpu/drm/nouveau/nouveau_bo.c +3
-0@@ -1152,6 +1155,14 @@ nouveau_ttm_io_mem_reserve(struct ttm_bo_device *bdev, struct ttm_resource *reg) reg->bus.offset = (reg->start << PAGE_SHIFT) + device->func->resource_addr (device,1 ); reg->bus.is_iomem = true; + +/* Some BARs do not support being ioremapped WC */ + if (drm->client.device.info.family >=
NV_DEVICE_INFO_V0_TESLA&&drivers/gpu/drm/nouveau/nouveau_bo.c +5
-0+ type & NVIF_MEM_UNCACHED) + reg->bus.caching = ttm_uncached; + else + reg->bus.caching = ttm_write_combined; +if (drm->client.mem->oclass >= NVIF_CLASS_MEM_NV50) { union { struct nv50_mem_map_v0 nv50;drivers/gpu/drm/qxl/qxl_ttm.c +0
-0@@ -83,11 +83,13 @@ int qxl_ttm_io_mem_reserve(struct ttm_bo_device *bdev, case TTM_PL_VRAM: mem->bus.is_iomem = true; mem->bus.offset = (mem->start <<PAGE_SHIFT ) + qdev- > vram_base;
Quoted 8 lines
drivers/gpu/drm/qxl/qxl_ttm.c int qxl_ttm_io_mem_reserve(struct ttm_bo_device *bdev, · line 92
Quoted 7 lines
drivers/gpu/drm/qxl/qxl_ttm.c +2
-0+ mem->bus.caching = ttm_cached;break ;case TTM_PL_PRIV : mem->bus.is_iomem = true; mem->bus.offset = (mem->start <<PAGE_SHIFT ) + qdev->surfaceram_base; + mem->bus.caching = ttm_cached;
is_iomem= true andttm_cachedis correct?
At least I think so :)
Quoted 1 line
qxl is a software gpu?
Yes, indeed.
Quoted 3 lines
If this is true, then this looks reasonable.
Reviewed-by Michael J. Ruhl <[email protected]>
Thanks,
Christian.
Quoted 70 lines
M
Quoted 67 lines
drivers/gpu/drm/qxl/qxl_ttm.c +0
-0break ;default: return -EINVAL;drivers/gpu/drm/radeon/radeon_ttm.c +0
-0@@ -372,6 +372,7 @@ static int radeon_ttm_io_mem_reserve(struct
ttm_bo_device*bdev, structttm_resomem->bus.offset = (mem->start << PAGE_SHIFT) + rdev->mc.agp_base; mem->bus.is_iomem = !rdev->ddev->agp-Quoted 1 line
cant_use_aperture;drivers/gpu/drm/radeon/radeon_ttm.c +1
-0+ mem->bus.caching = ttm_write_combined;} #endif break;drivers/gpu/drm/radeon/radeon_ttm.c +0
-0@@ -382,6 +383,7 @@ static int radeon_ttm_io_mem_reserve(struct
ttm_bo_device*bdev, structttm_resoreturn -EINVAL; mem->bus.offset += rdev->mc.aper_base; mem->bus.is_iomem = true;drivers/gpu/drm/radeon/radeon_ttm.c +1
-0+ mem->bus.caching = ttm_write_combined;#ifdef __alpha__ /* * Alpha: use bus.addr to hold the ioremap() return,drivers/gpu/drm/vmwgfx/vmwgfx_ttm_buffer.c +0
-0@@ -688,6 +688,7 @@ static int vmw_ttm_io_mem_reserve(struct
ttm_bo_device*bdev, structttm_resourcmem->bus.offset = (mem->start << PAGE_SHIFT) + dev_priv->vram_start; mem->bus.is_iomem = true;drivers/gpu/drm/vmwgfx/vmwgfx_ttm_buffer.c +1
-0+ mem->bus.caching = ttm_cached;break; default: return -EINVAL;include/drm/ttm/ttm_resource.h +5
-3@@ -29,6 +29,7 @@#include <linux/mutex.h> #include <linux/dma-fence.h> #include <drm/drm_print.h> +#include <drm/ttm/ttm_caching.h> #define TTM_MAX_BO_PRIORITY 4U@@ -148,9 +149,10 @@ struct ttm_resource_manager {* Structure indicating the bus placement of an object. */ struct ttm_bus_placement { -void *addr; -phys_addr_t offset; -bool is_iomem; +void *addr; +phys_addr_t offset; +bool is_iomem; +enum ttm_caching caching; };
Quoted 8 lines
Quoted 8 lines
include/drm/ttm/ttm_resource.h +0
-1/** -- 2.17.1
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 7/8 drm/ttm: use caching instead of placement for ttm_io_prot
In reply to Christian KönigInstead of the placement flags use the caching of the bus mapping or tt object for the page protection flags.
--- drivers/gpu/drm/ttm/ttm_bo_util.c | 23 ++++++++++++++--------- drivers/gpu/drm/ttm/ttm_bo_vm.c | 2 +- drivers/gpu/drm/vmwgfx/vmwgfx_blit.c | 4 ++-- include/drm/ttm/ttm_bo_driver.h | 6 ++++-- 4 files changed, 21 insertions(+), 14 deletions(-)
drivers/gpu/drm/ttm/ttm_bo_util.c +14 -9
@@ -279,13 +279,11 @@ int ttm_bo_move_memcpy(struct ttm_buffer_object *bo,for (i =0 ; i < new_mem->num_pages; ++i) { page = i * dir + add;if (old_iomap ==NULL ) { -pgprot_t prot =ttm_io_prot (old_mem->placement, -PAGE_KERNEL ); +pgprot_t prot =ttm_io_prot (bo, old_mem,PAGE_KERNEL ); ret =ttm_copy_ttm_io_page (ttm, new_iomap, page, prot); }else if (new_iomap ==NULL ) { -pgprot_t prot =ttm_io_prot (new_mem->placement, -PAGE_KERNEL ); +pgprot_t prot =ttm_io_prot (bo, new_mem,PAGE_KERNEL ); ret =ttm_copy_io_ttm_page (ttm, old_iomap, page, prot); }else {
@@ -384,21 +382,28 @@ static int ttm_buffer_object_transfer(struct ttm_buffer_object *bo,return 0 ; } -pgprot_t ttm_io_prot (uint32_t caching_flags,pgprot_t tmp) +pgprot_t ttm_io_prot (struct ttm_buffer_object *bo,struct ttm_resource *res, +pgprot_t tmp) { +struct ttm_resource_manager *man; +enum ttm_caching caching; + + man =ttm_manager_type (bo->bdev, res->mem_type); + caching = man->use_tt ? bo->ttm->caching : res->bus.caching; +/* Cached mappings need no adjustment */ -if (caching_flags &TTM_PL_FLAG_CACHED ) +if (caching == ttm_cached)return tmp;#if defined(__i386__) || defined(__x86_64__) -if (caching_flags &TTM_PL_FLAG_WC ) +if (caching == ttm_write_combined) tmp =pgprot_writecombine (tmp);else if (boot_cpu_data.x86 >3 ) tmp =pgprot_noncached (tmp);#endif #if defined(__ia64__) || defined(__arm__) || defined(__aarch64__) || \ defined(__powerpc__) || defined(__mips__) -if (caching_flags &TTM_PL_FLAG_WC ) +if (caching == ttm_write_combined) tmp =pgprot_writecombine (tmp);else tmp =pgprot_noncached (tmp);
@@ -466,7 +471,7 @@ static int ttm_bo_kmap_ttm(struct ttm_buffer_object *bo,* We need to use vmap to get the desired page protection * or to make the buffer object look contiguous. */ - prot =ttm_io_prot (mem->placement,PAGE_KERNEL ); + prot =ttm_io_prot (bo, mem,PAGE_KERNEL ); map->bo_kmap_type = ttm_bo_map_vmap; map->virtual =vmap (ttm->pages + start_page, num_pages,0 , prot);
drivers/gpu/drm/ttm/ttm_bo_vm.c +1 -1
@@ -310,7 +310,7 @@ vm_fault_t ttm_bo_vm_fault_reserved(struct vm_fault *vmf,if (unlikely (page_offset >= bo->num_pages))return VM_FAULT_SIGBUS ; - prot =ttm_io_prot (bo->mem.placement, prot); + prot =ttm_io_prot (bo, &bo->mem, prot);if (!bo->mem.bus.is_iomem) {struct ttm_operation_ctx ctx = { .interruptible = false,
drivers/gpu/drm/vmwgfx/vmwgfx_blit.c +2 -2
@@ -484,8 +484,8 @@ int vmw_bo_cpu_blit(struct ttm_buffer_object *dst, d.src_pages = src->ttm->pages; d.dst_num_pages = dst->num_pages; d.src_num_pages = src->num_pages; - d.dst_prot =ttm_io_prot (dst->mem.placement,PAGE_KERNEL ); - d.src_prot =ttm_io_prot (src->mem.placement,PAGE_KERNEL ); + d.dst_prot =ttm_io_prot (dst, &dst->mem,PAGE_KERNEL ); + d.src_prot =ttm_io_prot (src, &src->mem,PAGE_KERNEL ); d.diff = diff;for (j =0 ; j < h; ++j) {
include/drm/ttm/ttm_bo_driver.h +4 -2
@@ -666,13 +666,15 @@ int ttm_bo_pipeline_gutting(struct ttm_buffer_object *bo);/** * ttm_io_prot * -* @c_state: Caching state. +* bo: ttm buffer object +* res: ttm resource object * @tmp: Page protection flag for a normal, cached mapping. * * Utility function that returns the pgprot_t that should be used for * setting up a PTE with the caching model indicated by @c_state. */ -pgprot_t ttm_io_prot (uint32_t caching_flags,pgprot_t tmp); +pgprot_t ttm_io_prot (struct ttm_buffer_object *bo,struct ttm_resource *res, +pgprot_t tmp);/** * ttm_bo_tt_bind
Signature · 6 lines
2.17.1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
RE: [PATCH 7/8] drm/ttm: use caching instead of placement for ttm_io_prot
Quoted 26 lines
-----Original Message-----
From: dri-devel <[email protected]> On Behalf Of Christian König
Sent: Thursday, October 1, 2020 7:28 AM
To: [email protected]; [email protected]; [email protected]; [email protected]
Subject: [PATCH 7/8] drm/ttm: use caching instead of placement forttm_io_protInstead of the placement flags use the caching of the bus mapping or tt object for the page protection flags.
Signed-off-by Christian König <[email protected]>---
drivers/gpu/drm/ttm/ttm_bo_util.c | 23 ++++++++++++++--------- drivers/gpu/drm/ttm/ttm_bo_vm.c | 2 +- drivers/gpu/drm/vmwgfx/vmwgfx_blit.c | 4 ++-- include/drm/ttm/ttm_bo_driver.h | 6 ++++-- 4 files changed, 21 insertions(+), 14 deletions(-)drivers/gpu/drm/ttm/ttm_bo_util.c +0
-0
drivers/gpu/drm/ttm/ttm_bo_util.c int ttm_bo_move_memcpy(struct · line 284
Quoted 6 lines
drivers/gpu/drm/ttm/ttm_bo_util.c +0
-2@@ -279,13 +279,11 @@ int ttm_bo_move_memcpy(struct ttm_buffer_object *bo, for (i = 0; i < new_mem->num_pages; ++i) { page = i * dir + add;if (old_iomap ==NULL ) { -pgprot_t prot =ttm_io_prot (old_mem->placement, -PAGE_KERNEL );
So will placement get removed from ttm_resource?
M
Quoted 116 lines
drivers/gpu/drm/ttm/ttm_bo_util.c +2
-2+pgprot_t prot =ttm_io_prot (bo, old_mem,PAGE_KERNEL ); ret =ttm_copy_ttm_io_page (ttm, new_iomap, page, prot); }else if (new_iomap ==NULL ) { -pgprot_t prot =ttm_io_prot (new_mem->placement, -PAGE_KERNEL ); +pgprot_t prot =ttm_io_prot (bo, new_mem,PAGE_KERNEL );ret = ttm_copy_io_ttm_page(ttm, old_iomap, page, prot); } else {drivers/gpu/drm/ttm/ttm_bo_util.c +11
-4@@ -384,21 +382,28 @@ static int ttm_buffer_object_transfer(structttm_buffer_object *bo, return 0; } -pgprot_t ttm_io_prot(uint32_t caching_flags, pgprot_t tmp) +pgprot_t ttm_io_prot (struct ttm_buffer_object *bo,struct ttm_resource *res, +pgprot_t tmp) { +struct ttm_resource_manager *man; +enum ttm_caching caching; + + man =ttm_manager_type (bo->bdev, res->mem_type); + caching = man->use_tt ? bo->ttm->caching : res->bus.caching; +/* Cached mappings need no adjustment */ -if (caching_flags &TTM_PL_FLAG_CACHED ) +if (caching == ttm_cached)return tmp;#if defined(__i386__) || defined(__x86_64__) -if (caching_flags &TTM_PL_FLAG_WC ) +if (caching == ttm_write_combined) tmp =pgprot_writecombine (tmp);else if (boot_cpu_data.x86 >3 ) tmp =pgprot_noncached (tmp);#endif #if defined(__ia64__) || defined(__arm__) || defined(__aarch64__) || \ defined(__powerpc__) || defined(__mips__) -if (caching_flags &TTM_PL_FLAG_WC ) +if (caching == ttm_write_combined) tmp =pgprot_writecombine (tmp);else tmp = pgprot_noncached(tmp);drivers/gpu/drm/ttm/ttm_bo_util.c +1
-1@@ -466,7 +471,7 @@ static int ttm_bo_kmap_ttm(struct ttm_buffer_object*bo, * We need to use vmap to get the desired page protection * or to make the buffer object look contiguous. */ - prot =ttm_io_prot (mem->placement,PAGE_KERNEL ); + prot =ttm_io_prot (bo, mem,PAGE_KERNEL ); map->bo_kmap_type = ttm_bo_map_vmap; map->virtual = vmap(ttm->pages + start_page, num_pages,0, prot);drivers/gpu/drm/ttm/ttm_bo_vm.c +1
-1@@ -310,7 +310,7 @@ vm_fault_t ttm_bo_vm_fault_reserved(struct vm_fault *vmf, if (unlikely(page_offset >= bo->num_pages))return VM_FAULT_SIGBUS ; - prot =ttm_io_prot (bo->mem.placement, prot); + prot =ttm_io_prot (bo, &bo->mem, prot);if (!bo->mem.bus.is_iomem) { struct ttm_operation_ctx ctx = {.interruptible = false,
drivers/gpu/drm/vmwgfx/vmwgfx_blit.c +2
-2@@ -484,8 +484,8 @@ int vmw_bo_cpu_blit(struct ttm_buffer_object *dst, d.src_pages = src->ttm->pages; d.dst_num_pages = dst->num_pages; d.src_num_pages = src->num_pages; - d.dst_prot =ttm_io_prot (dst->mem.placement,PAGE_KERNEL ); - d.src_prot =ttm_io_prot (src->mem.placement,PAGE_KERNEL ); + d.dst_prot =ttm_io_prot (dst, &dst->mem,PAGE_KERNEL ); + d.src_prot =ttm_io_prot (src, &src->mem,PAGE_KERNEL ); d.diff = diff;for (j =0 ; j < h; ++j) {include/drm/ttm/ttm_bo_driver.h +4
-2@@ -666,13 +666,15 @@ int ttm_bo_pipeline_gutting(struct ttm_buffer_object *bo);/** * ttm_io_prot * -* @c_state: Caching state. +* bo: ttm buffer object +* res: ttm resource object * @tmp: Page protection flag for a normal, cached mapping. * * Utility function that returns the pgprot_t that should be used for * setting up a PTE with the caching model indicated by @c_state. */ -pgprot_t ttm_io_prot (uint32_t caching_flags,pgprot_t tmp); +pgprot_t ttm_io_prot (struct ttm_buffer_object *bo,struct ttm_resource *res, +pgprot_t tmp);/**
*ttm_bo_tt_bind
--
2.17.1
Quoted 4 lines
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 7/8] drm/ttm: use caching instead of placement for ttm_io_prot
Am 05.10.20 um 17:51 schrieb Ruhl, Michael J:
Quoted 20 lines
Quoted 20 lines
-----Original Message-----
From: dri-devel <[email protected]> On Behalf Of Christian König
Sent: Thursday, October 1, 2020 7:28 AM
To: [email protected]; [email protected]; [email protected]; [email protected]
Subject: [PATCH 7/8] drm/ttm: use caching instead of placement forttm_io_protInstead of the placement flags use the caching of the bus mapping or tt object for the page protection flags.
Signed-off-by Christian König <[email protected]>---
drivers/gpu/drm/ttm/ttm_bo_util.c | 23 ++++++++++++++--------- drivers/gpu/drm/ttm/ttm_bo_vm.c | 2 +- drivers/gpu/drm/vmwgfx/vmwgfx_blit.c | 4 ++-- include/drm/ttm/ttm_bo_driver.h | 6 ++++-- 4 files changed, 21 insertions(+), 14 deletions(-)
Quoted 13 lines
drivers/gpu/drm/ttm/ttm_bo_util.c int ttm_bo_move_memcpy(struct · line 284
Quoted 12 lines
drivers/gpu/drm/ttm/ttm_bo_util.c +0
-2@@ -279,13 +279,11 @@ int ttm_bo_move_memcpy(struct ttm_buffer_object *bo, for (i = 0; i < new_mem->num_pages; ++i) { page = i * dir + add;if (old_iomap ==NULL ) { -pgprot_t prot =ttm_io_prot (old_mem->placement, -PAGE_KERNEL );So will placement get removed from
ttm_resource?
That's the long term plan, yes. But currently we still have the contiguous flag in there.
Christian.
Quoted 121 lines
Reviewed-by Michael J. Ruhl <[email protected]>M
Quoted 116 lines
drivers/gpu/drm/ttm/ttm_bo_util.c +2
-2+pgprot_t prot =ttm_io_prot (bo, old_mem,PAGE_KERNEL ); ret =ttm_copy_ttm_io_page (ttm, new_iomap, page, prot); }else if (new_iomap ==NULL ) { -pgprot_t prot =ttm_io_prot (new_mem->placement, -PAGE_KERNEL ); +pgprot_t prot =ttm_io_prot (bo, new_mem,PAGE_KERNEL );ret = ttm_copy_io_ttm_page(ttm, old_iomap, page, prot); } else {drivers/gpu/drm/ttm/ttm_bo_util.c +11
-4@@ -384,21 +382,28 @@ static int ttm_buffer_object_transfer(structttm_buffer_object *bo, return 0; } -pgprot_t ttm_io_prot(uint32_t caching_flags, pgprot_t tmp) +pgprot_t ttm_io_prot (struct ttm_buffer_object *bo,struct ttm_resource *res, +pgprot_t tmp) { +struct ttm_resource_manager *man; +enum ttm_caching caching; + + man =ttm_manager_type (bo->bdev, res->mem_type); + caching = man->use_tt ? bo->ttm->caching : res->bus.caching; +/* Cached mappings need no adjustment */ -if (caching_flags &TTM_PL_FLAG_CACHED ) +if (caching == ttm_cached)return tmp;#if defined(__i386__) || defined(__x86_64__) -if (caching_flags &TTM_PL_FLAG_WC ) +if (caching == ttm_write_combined) tmp =pgprot_writecombine (tmp);else if (boot_cpu_data.x86 >3 ) tmp =pgprot_noncached (tmp);#endif #if defined(__ia64__) || defined(__arm__) || defined(__aarch64__) || \ defined(__powerpc__) || defined(__mips__) -if (caching_flags &TTM_PL_FLAG_WC ) +if (caching == ttm_write_combined) tmp =pgprot_writecombine (tmp);else tmp = pgprot_noncached(tmp);drivers/gpu/drm/ttm/ttm_bo_util.c +1
-1@@ -466,7 +471,7 @@ static int ttm_bo_kmap_ttm(struct ttm_buffer_object*bo, * We need to use vmap to get the desired page protection * or to make the buffer object look contiguous. */ - prot =ttm_io_prot (mem->placement,PAGE_KERNEL ); + prot =ttm_io_prot (bo, mem,PAGE_KERNEL ); map->bo_kmap_type = ttm_bo_map_vmap; map->virtual = vmap(ttm->pages + start_page, num_pages,0, prot);drivers/gpu/drm/ttm/ttm_bo_vm.c +1
-1@@ -310,7 +310,7 @@ vm_fault_t ttm_bo_vm_fault_reserved(struct vm_fault *vmf, if (unlikely(page_offset >= bo->num_pages))return VM_FAULT_SIGBUS ; - prot =ttm_io_prot (bo->mem.placement, prot); + prot =ttm_io_prot (bo, &bo->mem, prot);if (!bo->mem.bus.is_iomem) { struct ttm_operation_ctx ctx = {.interruptible = false,
drivers/gpu/drm/vmwgfx/vmwgfx_blit.c +2
-2@@ -484,8 +484,8 @@ int vmw_bo_cpu_blit(struct ttm_buffer_object *dst, d.src_pages = src->ttm->pages; d.dst_num_pages = dst->num_pages; d.src_num_pages = src->num_pages; - d.dst_prot =ttm_io_prot (dst->mem.placement,PAGE_KERNEL ); - d.src_prot =ttm_io_prot (src->mem.placement,PAGE_KERNEL ); + d.dst_prot =ttm_io_prot (dst, &dst->mem,PAGE_KERNEL ); + d.src_prot =ttm_io_prot (src, &src->mem,PAGE_KERNEL ); d.diff = diff;for (j =0 ; j < h; ++j) {include/drm/ttm/ttm_bo_driver.h +4
-2@@ -666,13 +666,15 @@ int ttm_bo_pipeline_gutting(struct ttm_buffer_object *bo);/** * ttm_io_prot * -* @c_state: Caching state. +* bo: ttm buffer object +* res: ttm resource object * @tmp: Page protection flag for a normal, cached mapping. * * Utility function that returns the pgprot_t that should be used for * setting up a PTE with the caching model indicated by @c_state. */ -pgprot_t ttm_io_prot (uint32_t caching_flags,pgprot_t tmp); +pgprot_t ttm_io_prot (struct ttm_buffer_object *bo,struct ttm_resource *res, +pgprot_t tmp);/**
*ttm_bo_tt_bind
--
2.17.1
Quoted 4 lines
Quoted 4 lines
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 8/8 drm/ttm: nuke caching placement flags
In reply to Christian KönigChanging the caching on the fly never really worked flawlessly.
So stop this completely and just let drivers specific the desired caching in the tt or bus object.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | 20 +++------- drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 12 ++---- drivers/gpu/drm/drm_gem_vram_helper.c | 7 +--- drivers/gpu/drm/nouveau/nouveau_bo.c | 36 +++++------------ drivers/gpu/drm/qxl/qxl_object.c | 10 ++--- drivers/gpu/drm/qxl/qxl_ttm.c | 2 +- drivers/gpu/drm/radeon/radeon_object.c | 46 +++++----------------- drivers/gpu/drm/radeon/radeon_ttm.c | 18 ++------- drivers/gpu/drm/ttm/ttm_agp_backend.c | 2 +- drivers/gpu/drm/ttm/ttm_bo.c | 44 ++------------------- drivers/gpu/drm/ttm/ttm_bo_util.c | 10 ++--- drivers/gpu/drm/ttm/ttm_tt.c | 29 -------------- drivers/gpu/drm/vmwgfx/vmwgfx_ttm_buffer.c | 30 +++++++------- include/drm/ttm/ttm_placement.h | 14 ------- include/drm/ttm/ttm_tt.h | 15 ------- 15 files changed, 61 insertions(+), 234 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_object.c +5 -15
@@ -137,7 +137,7 @@ void amdgpu_bo_placement_from_domain(struct amdgpu_bo *abo, u32 domain) places[c].fpfn =0 ; places[c].lpfn =0 ; places[c].mem_type =TTM_PL_VRAM ; - places[c].flags =TTM_PL_FLAG_WC |TTM_PL_FLAG_UNCACHED ; + places[c].flags =0 ;if (flags &AMDGPU_GEM_CREATE_CPU_ACCESS_REQUIRED ) places[c].lpfn = visible_pfn;
@@ -154,11 +154,6 @@ void amdgpu_bo_placement_from_domain(struct amdgpu_bo *abo, u32 domain) places[c].lpfn =0 ; places[c].mem_type =TTM_PL_TT ; places[c].flags =0 ; -if (flags &AMDGPU_GEM_CREATE_CPU_GTT_USWC ) - places[c].flags |=TTM_PL_FLAG_WC | -TTM_PL_FLAG_UNCACHED ; -else - places[c].flags |=TTM_PL_FLAG_CACHED ; c++; }
@@ -167,11 +162,6 @@ void amdgpu_bo_placement_from_domain(struct amdgpu_bo *abo, u32 domain) places[c].lpfn =0 ; places[c].mem_type =TTM_PL_SYSTEM ; places[c].flags =0 ; -if (flags &AMDGPU_GEM_CREATE_CPU_GTT_USWC ) - places[c].flags |=TTM_PL_FLAG_WC | -TTM_PL_FLAG_UNCACHED ; -else - places[c].flags |=TTM_PL_FLAG_CACHED ; c++; }
@@ -179,7 +169,7 @@ void amdgpu_bo_placement_from_domain(struct amdgpu_bo *abo, u32 domain) places[c].fpfn =0 ; places[c].lpfn =0 ; places[c].mem_type =AMDGPU_PL_GDS ; - places[c].flags =TTM_PL_FLAG_UNCACHED ; + places[c].flags =0 ; c++; }
@@ -187,7 +177,7 @@ void amdgpu_bo_placement_from_domain(struct amdgpu_bo *abo, u32 domain) places[c].fpfn =0 ; places[c].lpfn =0 ; places[c].mem_type =AMDGPU_PL_GWS ; - places[c].flags =TTM_PL_FLAG_UNCACHED ; + places[c].flags =0 ; c++; }
@@ -195,7 +185,7 @@ void amdgpu_bo_placement_from_domain(struct amdgpu_bo *abo, u32 domain) places[c].fpfn =0 ; places[c].lpfn =0 ; places[c].mem_type =AMDGPU_PL_OA ; - places[c].flags =TTM_PL_FLAG_UNCACHED ; + places[c].flags =0 ; c++; }
@@ -203,7 +193,7 @@ void amdgpu_bo_placement_from_domain(struct amdgpu_bo *abo, u32 domain) places[c].fpfn =0 ; places[c].lpfn =0 ; places[c].mem_type =TTM_PL_SYSTEM ; - places[c].flags =TTM_PL_MASK_CACHING ; + places[c].flags =0 ; c++; }
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +3 -9
@@ -92,7 +92,7 @@ static void amdgpu_evict_flags(struct ttm_buffer_object *bo, .fpfn = 0, .lpfn = 0, .mem_type = TTM_PL_SYSTEM, - .flags = TTM_PL_MASK_CACHING + .flags = 0 };/* Don't handle scatter gather BOs */
@@ -538,19 +538,13 @@ static int amdgpu_move_vram_ram(struct ttm_buffer_object *bo, bool evict, placements.fpfn =0 ; placements.lpfn =0 ; placements.mem_type =TTM_PL_TT ; - placements.flags =TTM_PL_MASK_CACHING ; + placements.flags =0 ; r =ttm_bo_mem_space (bo, &placement, &tmp_mem, ctx);if (unlikely (r)) {pr_err ("Failed to find GTT space for blit from VRAM\n" );return r; } -/* set caching flags */ - r =ttm_tt_set_placement_caching (bo->ttm, tmp_mem.placement); -if (unlikely (r)) { - goto out_cleanup; - } - r =ttm_tt_populate (bo->bdev, bo->ttm, ctx);if (unlikely (r)) goto out_cleanup;
@@ -599,7 +593,7 @@ static int amdgpu_move_ram_vram(struct ttm_buffer_object *bo, bool evict, placements.fpfn =0 ; placements.lpfn =0 ; placements.mem_type =TTM_PL_TT ; - placements.flags =TTM_PL_MASK_CACHING ; + placements.flags =0 ; r =ttm_bo_mem_space (bo, &placement, &tmp_mem, ctx);if (unlikely (r)) {pr_err ("Failed to find GTT space for blit to VRAM\n" );
drivers/gpu/drm/drm_gem_vram_helper.c +2 -5
@@ -147,15 +147,12 @@ static void drm_gem_vram_placement(struct drm_gem_vram_object *gbo,if (pl_flag &DRM_GEM_VRAM_PL_FLAG_VRAM ) { gbo->placements[c].mem_type =TTM_PL_VRAM ; - gbo->placements[c++].flags =TTM_PL_FLAG_WC | -TTM_PL_FLAG_UNCACHED | - invariant_flags; + gbo->placements[c++].flags = invariant_flags; }if (pl_flag &DRM_GEM_VRAM_PL_FLAG_SYSTEM || !c) { gbo->placements[c].mem_type =TTM_PL_SYSTEM ; - gbo->placements[c++].flags =TTM_PL_MASK_CACHING | - invariant_flags; + gbo->placements[c++].flags = invariant_flags; } gbo->placement.num_placement = c;
drivers/gpu/drm/nouveau/nouveau_bo.c +9 -27
@@ -343,37 +343,23 @@ nouveau_bo_new(struct nouveau_cli *cli, u64 size, int align, }static void -set_placement_list (struct nouveau_drm *drm,struct ttm_place *pl,unsigned *n, -uint32_t domain,uint32_t flags) +set_placement_list (struct ttm_place *pl,unsigned *n,uint32_t domain) { *n =0 ;if (domain &NOUVEAU_GEM_DOMAIN_VRAM ) { -struct nvif_mmu *mmu = &drm->client.mmu; -const u8 type = mmu->type[drm->ttm.type_vram].type; - pl[*n].mem_type =TTM_PL_VRAM ; - pl[*n].flags = flags & ~TTM_PL_FLAG_CACHED ; - -/* Some BARs do not support being ioremapped WC */ -if (drm->client.device.info.family >=NV_DEVICE_INFO_V0_TESLA && - type &NVIF_MEM_UNCACHED ) - pl[*n].flags &= ~TTM_PL_FLAG_WC ; - + pl[*n].flags =0 ; (*n)++; }if (domain &NOUVEAU_GEM_DOMAIN_GART ) { pl[*n].mem_type =TTM_PL_TT ; - pl[*n].flags = flags; - -if (drm->agp.bridge) - pl[*n].flags &= ~TTM_PL_FLAG_CACHED ; - + pl[*n].flags =0 ; (*n)++; }if (domain &NOUVEAU_GEM_DOMAIN_CPU ) { pl[*n].mem_type =TTM_PL_SYSTEM ; - pl[(*n)++].flags = flags; + pl[(*n)++].flags =0 ; } }
@@ -415,18 +401,14 @@ void nouveau_bo_placement_set(struct nouveau_bo *nvbo, uint32_t domain, uint32_t busy) { - struct nouveau_drm *drm = nouveau_bdev(nvbo->bo.bdev); struct ttm_placement *pl = &nvbo->placement; -uint32_t flags = nvbo->force_coherent ?TTM_PL_FLAG_UNCACHED : -TTM_PL_MASK_CACHING ; pl->placement = nvbo->placements; -set_placement_list (drm, nvbo->placements, &pl->num_placement, - domain, flags); +set_placement_list (nvbo->placements, &pl->num_placement, domain); pl->busy_placement = nvbo->busy_placements; -set_placement_list (drm, nvbo->busy_placements, &pl->num_busy_placement, - domain | busy, flags); +set_placement_list (nvbo->busy_placements, &pl->num_busy_placement, + domain | busy);set_placement_range (nvbo, domain); }
@@ -888,7 +870,7 @@ nouveau_bo_move_flipd(struct ttm_buffer_object *bo, bool evict, .fpfn = 0, .lpfn = 0, .mem_type = TTM_PL_TT, - .flags = TTM_PL_MASK_CACHING + .flags = 0 };struct ttm_placement placement;struct ttm_resource tmp_reg;
@@ -930,7 +912,7 @@ nouveau_bo_move_flips(struct ttm_buffer_object *bo, bool evict, .fpfn = 0, .lpfn = 0, .mem_type = TTM_PL_TT, - .flags = TTM_PL_MASK_CACHING + .flags = 0 };struct ttm_placement placement;struct ttm_resource tmp_reg;
drivers/gpu/drm/qxl/qxl_object.c +5 -5
@@ -64,21 +64,21 @@ void qxl_ttm_placement_from_domain(struct qxl_bo *qbo, u32 domain) qbo->placement.busy_placement = qbo->placements;if (domain ==QXL_GEM_DOMAIN_VRAM ) { qbo->placements[c].mem_type =TTM_PL_VRAM ; - qbo->placements[c++].flags =TTM_PL_FLAG_CACHED | pflag; + qbo->placements[c++].flags = pflag; }if (domain ==QXL_GEM_DOMAIN_SURFACE ) { qbo->placements[c].mem_type =TTM_PL_PRIV ; - qbo->placements[c++].flags =TTM_PL_FLAG_CACHED | pflag; + qbo->placements[c++].flags = pflag; qbo->placements[c].mem_type =TTM_PL_VRAM ; - qbo->placements[c++].flags =TTM_PL_FLAG_CACHED | pflag; + qbo->placements[c++].flags = pflag; }if (domain ==QXL_GEM_DOMAIN_CPU ) { qbo->placements[c].mem_type =TTM_PL_SYSTEM ; - qbo->placements[c++].flags =TTM_PL_MASK_CACHING | pflag; + qbo->placements[c++].flags = pflag; }if (!c) { qbo->placements[c].mem_type =TTM_PL_SYSTEM ; - qbo->placements[c++].flags =TTM_PL_MASK_CACHING ; + qbo->placements[c++].flags =0 ; } qbo->placement.num_placement = c; qbo->placement.num_busy_placement = c;
drivers/gpu/drm/qxl/qxl_ttm.c +1 -1
@@ -56,7 +56,7 @@ static void qxl_evict_flags(struct ttm_buffer_object *bo, .fpfn = 0, .lpfn = 0, .mem_type = TTM_PL_SYSTEM, - .flags = TTM_PL_MASK_CACHING + .flags = 0 };if (!qxl_ttm_bo_is_qxl_bo (bo)) {
drivers/gpu/drm/radeon/radeon_object.c +9 -37
66 lines not on this page · raw message
drivers/gpu/drm/radeon/radeon_ttm.c +4 -14
@@ -89,7 +89,7 @@ static void radeon_evict_flags(struct ttm_buffer_object *bo, .fpfn = 0, .lpfn = 0, .mem_type = TTM_PL_SYSTEM, - .flags = TTM_PL_MASK_CACHING + .flags = 0 };struct radeon_bo *rbo;
@@ -225,17 +225,12 @@ static int radeon_move_vram_ram(struct ttm_buffer_object *bo, placements.fpfn =0 ; placements.lpfn =0 ; placements.mem_type =TTM_PL_TT ; - placements.flags =TTM_PL_MASK_CACHING ; + placements.flags =0 ; r =ttm_bo_mem_space (bo, &placement, &tmp_mem, ctx);if (unlikely (r)) {return r; } - r =ttm_tt_set_placement_caching (bo->ttm, tmp_mem.placement); -if (unlikely (r)) { - goto out_cleanup; - } - r =ttm_tt_populate (bo->bdev, bo->ttm, ctx);if (unlikely (r)) { goto out_cleanup;
@@ -275,7 +270,7 @@ static int radeon_move_ram_vram(struct ttm_buffer_object *bo, placements.fpfn =0 ; placements.lpfn =0 ; placements.mem_type =TTM_PL_TT ; - placements.flags =TTM_PL_MASK_CACHING ; + placements.flags =0 ; r =ttm_bo_mem_space (bo, &placement, &tmp_mem, ctx);if (unlikely (r)) {return r;
@@ -389,12 +384,7 @@ static int radeon_ttm_io_mem_reserve(struct ttm_bo_device *bdev, struct ttm_reso* Alpha: use bus.addr to hold the ioremap() return, * so we can modify bus.base below. */ -if (mem->placement &TTM_PL_FLAG_WC ) - mem->bus.addr = -ioremap_wc (mem->bus.offset, bus_size); -else - mem->bus.addr = -ioremap (mem->bus.offset, bus_size); + mem->bus.addr =ioremap_wc (mem->bus.offset, bus_size);if (!mem->bus.addr)return -ENOMEM ;
drivers/gpu/drm/ttm/ttm_agp_backend.c +1 -1
@@ -54,7 +54,7 @@ int ttm_agp_bind(struct ttm_tt *ttm, struct ttm_resource *bo_mem)struct page *dummy_read_page = ttm_bo_glob.dummy_read_page;struct drm_mm_node *node = bo_mem->mm_node;struct agp_memory *mem; -int ret, cached = (bo_mem->placement &TTM_PL_FLAG_CACHED ); +int ret, cached = ttm->caching == ttm_cached;unsigned i;if (agp_be->mem)
drivers/gpu/drm/ttm/ttm_bo.c +4 -40
92 lines not on this page · raw message
drivers/gpu/drm/ttm/ttm_bo_util.c +3 -7
@@ -72,10 +72,6 @@ int ttm_bo_move_ttm(struct ttm_buffer_object *bo, old_mem->mem_type =TTM_PL_SYSTEM ; } - ret =ttm_tt_set_placement_caching (ttm, new_mem->placement); -if (unlikely (ret !=0 )) -return ret; -if (new_mem->mem_type !=TTM_PL_SYSTEM ) { ret =ttm_tt_populate (bo->bdev, ttm, ctx);
@@ -135,7 +131,7 @@ static int ttm_resource_ioremap(struct ttm_bo_device *bdev, }else {size_t bus_size = (size_t )mem->num_pages <<PAGE_SHIFT ; -if (mem->placement &TTM_PL_FLAG_WC ) +if (mem->bus.caching == ttm_write_combined) addr =ioremap_wc (mem->bus.offset, bus_size);else addr =ioremap (mem->bus.offset, bus_size);
@@ -427,7 +423,7 @@ static int ttm_bo_ioremap(struct ttm_buffer_object *bo, map->virtual = (void *)(((u8 *)bo->mem.bus.addr) + offset); }else { map->bo_kmap_type = ttm_bo_map_iomap; -if (mem->placement &TTM_PL_FLAG_WC ) +if (mem->bus.caching == ttm_write_combined) map->virtual =ioremap_wc (bo->mem.bus.offset + offset, size);else
@@ -457,7 +453,7 @@ static int ttm_bo_kmap_ttm(struct ttm_buffer_object *bo,if (ret)return ret; -if (num_pages ==1 && (mem->placement &TTM_PL_FLAG_CACHED )) { +if (num_pages ==1 && ttm->caching == ttm_cached) {/* * We're mapping a single page, and the desired * page protection is consistent with the bo.
drivers/gpu/drm/ttm/ttm_tt.c +0 -29
@@ -114,35 +114,6 @@ static int ttm_sg_tt_alloc_page_directory(struct ttm_dma_tt *ttm)return 0 ; } -static int ttm_tt_set_caching (struct ttm_tt *ttm,enum ttm_caching caching) -{ -if (ttm->caching == caching) -return 0 ; - -/* Can't change the caching state after TT is populated */ -if (WARN_ON_ONCE (ttm_tt_is_populated (ttm))) -return -EINVAL ; - - ttm->caching = caching; - -return 0 ; -} - -int ttm_tt_set_placement_caching (struct ttm_tt *ttm,uint32_t placement) -{ -enum ttm_caching state; - -if (placement &TTM_PL_FLAG_WC ) - state = ttm_write_combined; -else if (placement &TTM_PL_FLAG_UNCACHED ) - state = ttm_uncached; -else - state = ttm_cached; - -return ttm_tt_set_caching (ttm, state); -} -EXPORT_SYMBOL (ttm_tt_set_placement_caching); -void ttm_tt_destroy_common (struct ttm_bo_device *bdev,struct ttm_tt *ttm) {ttm_tt_unpopulate (bdev, ttm);
drivers/gpu/drm/vmwgfx/vmwgfx_ttm_buffer.c +15 -15
@@ -34,28 +34,28 @@ static const struct ttm_place vram_placement_flags = { .fpfn = 0, .lpfn = 0, .mem_type = TTM_PL_VRAM, - .flags = TTM_PL_FLAG_CACHED + .flags = 0 };static const struct ttm_place sys_placement_flags = { .fpfn =0 , .lpfn =0 , .mem_type =TTM_PL_SYSTEM , - .flags =TTM_PL_FLAG_CACHED + .flags =0 };static const struct ttm_place gmr_placement_flags = { .fpfn =0 , .lpfn =0 , .mem_type =VMW_PL_GMR , - .flags =TTM_PL_FLAG_CACHED + .flags =0 };static const struct ttm_place mob_placement_flags = { .fpfn =0 , .lpfn =0 , .mem_type =VMW_PL_MOB , - .flags =TTM_PL_FLAG_CACHED + .flags =0 };struct ttm_placement vmw_vram_placement = {
@@ -70,12 +70,12 @@ static const struct ttm_place vram_gmr_placement_flags[] = { .fpfn = 0, .lpfn = 0, .mem_type = TTM_PL_VRAM, - .flags = TTM_PL_FLAG_CACHED + .flags = 0 }, { .fpfn = 0, .lpfn = 0, .mem_type = VMW_PL_GMR, - .flags = TTM_PL_FLAG_CACHED + .flags = 0 } };
@@ -84,12 +84,12 @@ static const struct ttm_place gmr_vram_placement_flags[] = { .fpfn = 0, .lpfn = 0, .mem_type = VMW_PL_GMR, - .flags = TTM_PL_FLAG_CACHED + .flags = 0 }, { .fpfn = 0, .lpfn = 0, .mem_type = TTM_PL_VRAM, - .flags = TTM_PL_FLAG_CACHED + .flags = 0 } };
@@ -119,22 +119,22 @@ static const struct ttm_place evictable_placement_flags[] = { .fpfn = 0, .lpfn = 0, .mem_type = TTM_PL_SYSTEM, - .flags =TTM_PL_FLAG_CACHED + .flags =0 }, { .fpfn = 0, .lpfn = 0, .mem_type = TTM_PL_VRAM, - .flags =TTM_PL_FLAG_CACHED + .flags =0 }, { .fpfn = 0, .lpfn = 0, .mem_type = VMW_PL_GMR, - .flags =TTM_PL_FLAG_CACHED + .flags =0 }, { .fpfn = 0, .lpfn = 0, .mem_type = VMW_PL_MOB, - .flags = TTM_PL_FLAG_CACHED + .flags = 0 } };
@@ -143,17 +143,17 @@ static const struct ttm_place nonfixed_placement_flags[] = { .fpfn = 0, .lpfn = 0, .mem_type = TTM_PL_SYSTEM, - .flags =TTM_PL_FLAG_CACHED + .flags =0 }, { .fpfn = 0, .lpfn = 0, .mem_type = VMW_PL_GMR, - .flags =TTM_PL_FLAG_CACHED + .flags =0 }, { .fpfn = 0, .lpfn = 0, .mem_type = VMW_PL_MOB, - .flags = TTM_PL_FLAG_CACHED + .flags = 0 } };
include/drm/ttm/ttm_placement.h +0 -14
@@ -43,27 +43,13 @@#define TTM_PL_PRIV 3/* -* Other flags that affects data placement. -* TTM_PL_FLAG_CACHED indicates cache-coherent mappings -* if available. -* TTM_PL_FLAG_SHARED means that another application may -* reference the buffer. -* TTM_PL_FLAG_NO_EVICT means that the buffer may never -* be evicted to make room for other buffers. * TTM_PL_FLAG_TOPDOWN requests to be placed from the * top of the memory area, instead of the bottom. */ -#define TTM_PL_FLAG_CACHED (1 << 16) -#define TTM_PL_FLAG_UNCACHED (1 << 17) -#define TTM_PL_FLAG_WC (1 << 18)#define TTM_PL_FLAG_CONTIGUOUS (1 << 19)#define TTM_PL_FLAG_TOPDOWN (1 << 22) -#define TTM_PL_MASK_CACHING (TTM_PL_FLAG_CACHED | \ - TTM_PL_FLAG_UNCACHED | \ - TTM_PL_FLAG_WC) -/** * struct ttm_place *
include/drm/ttm/ttm_tt.h +0 -15
@@ -164,21 +164,6 @@ void ttm_tt_destroy_common(struct ttm_bo_device *bdev, struct ttm_tt *ttm);* Swap in a previously swap out ttm_tt. */ int ttm_tt_swapin (struct ttm_tt *ttm); - -/** -* ttm_tt_set_placement_caching: -* -* @ttm A struct ttm_tt the backing pages of which will change caching policy. -* @placement: Flag indicating the desired caching policy. -* -* This function will change caching policy of any default kernel mappings of -* the pages backing @ttm. If changing from cached to uncached or -* write-combined, -* all CPU caches will first be flushed to make sure the data of the pages -* hit RAM. This function may be very costly as it involves global TLB -* and cache flushes and potential page splitting / combining. -*/ -int ttm_tt_set_placement_caching (struct ttm_tt *ttm,uint32_t placement);int ttm_tt_swapout (struct ttm_bo_device *bdev,struct ttm_tt *ttm);/**
Signature · 6 lines
2.17.1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
RE: [PATCH 8/8] drm/ttm: nuke caching placement flags
Quoted 456 lines
-----Original Message-----
From: dri-devel <[email protected]> On Behalf Of Christian König
Sent: Thursday, October 1, 2020 7:28 AM
To: [email protected]; [email protected]; [email protected]; [email protected]
Subject: [PATCH 8/8] drm/ttm: nuke caching placement flagsChanging the caching on the fly never really worked flawlessly.
So stop this completely and just let drivers specific the desired caching in the tt or bus object.
Signed-off-by Christian König <[email protected]>---
drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | 20 +++------- drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 12 ++---- drivers/gpu/drm/drm_gem_vram_helper.c | 7 +--- drivers/gpu/drm/nouveau/nouveau_bo.c | 36 +++++------------ drivers/gpu/drm/qxl/qxl_object.c | 10 ++--- drivers/gpu/drm/qxl/qxl_ttm.c | 2 +- drivers/gpu/drm/radeon/radeon_object.c | 46 +++++----------------- drivers/gpu/drm/radeon/radeon_ttm.c | 18 ++------- drivers/gpu/drm/ttm/ttm_agp_backend.c | 2 +- drivers/gpu/drm/ttm/ttm_bo.c | 44 ++------------------- drivers/gpu/drm/ttm/ttm_bo_util.c | 10 ++--- drivers/gpu/drm/ttm/ttm_tt.c | 29 -------------- drivers/gpu/drm/vmwgfx/vmwgfx_ttm_buffer.c | 30 +++++++------- include/drm/ttm/ttm_placement.h | 14 ------- include/drm/ttm/ttm_tt.h | 15 ------- 15 files changed, 61 insertions(+), 234 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu_object.c +1
-1@@ -137,7 +137,7 @@ void amdgpu_bo_placement_from_domain(struct amdgpu_bo *abo, u32 domain) places[c].fpfn = 0; places[c].lpfn =0 ; places[c].mem_type =TTM_PL_VRAM ; - places[c].flags =TTM_PL_FLAG_WC |TTM_PL_FLAG_UNCACHED ; + places[c].flags =0 ;if (flags & AMDGPU_GEM_CREATE_CPU_ACCESS_REQUIRED) places[c].lpfn = visible_pfn;drivers/gpu/drm/amd/amdgpu/amdgpu_object.c +4
-14@@ -154,11 +154,6 @@ void amdgpu_bo_placement_from_domain(struct amdgpu_bo *abo, u32 domain) places[c].lpfn = 0; places[c].mem_type =TTM_PL_TT ; places[c].flags =0 ; -if (flags &AMDGPU_GEM_CREATE_CPU_GTT_USWC ) - places[c].flags |=TTM_PL_FLAG_WC | -TTM_PL_FLAG_UNCACHED ; -else - places[c].flags |=TTM_PL_FLAG_CACHED ; c++; }@@ -167,11 +162,6 @@ void amdgpu_bo_placement_from_domain(struct amdgpu_bo *abo, u32 domain) places[c].lpfn = 0; places[c].mem_type =TTM_PL_SYSTEM ; places[c].flags =0 ; -if (flags &AMDGPU_GEM_CREATE_CPU_GTT_USWC ) - places[c].flags |=TTM_PL_FLAG_WC | -TTM_PL_FLAG_UNCACHED ; -else - places[c].flags |=TTM_PL_FLAG_CACHED ; c++; }@@ -179,7 +169,7 @@ void amdgpu_bo_placement_from_domain(struct amdgpu_bo *abo, u32 domain) places[c].fpfn = 0; places[c].lpfn =0 ; places[c].mem_type =AMDGPU_PL_GDS ; - places[c].flags =TTM_PL_FLAG_UNCACHED ; + places[c].flags =0 ; c++; }@@ -187,7 +177,7 @@ void amdgpu_bo_placement_from_domain(struct amdgpu_bo *abo, u32 domain) places[c].fpfn = 0; places[c].lpfn =0 ; places[c].mem_type =AMDGPU_PL_GWS ; - places[c].flags =TTM_PL_FLAG_UNCACHED ; + places[c].flags =0 ; c++; }@@ -195,7 +185,7 @@ void amdgpu_bo_placement_from_domain(struct amdgpu_bo *abo, u32 domain) places[c].fpfn = 0; places[c].lpfn =0 ; places[c].mem_type =AMDGPU_PL_OA ; - places[c].flags =TTM_PL_FLAG_UNCACHED ; + places[c].flags =0 ; c++; }@@ -203,7 +193,7 @@ void amdgpu_bo_placement_from_domain(struct amdgpu_bo *abo, u32 domain) places[c].fpfn = 0; places[c].lpfn =0 ; places[c].mem_type =TTM_PL_SYSTEM ; - places[c].flags =TTM_PL_MASK_CACHING ; + places[c].flags =0 ; c++; }drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +1
-1@@ -92,7 +92,7 @@ static void amdgpu_evict_flags(struct ttm_buffer_object *bo, .fpfn = 0, .lpfn = 0, .mem_type = TTM_PL_SYSTEM, - .flags = TTM_PL_MASK_CACHING + .flags = 0 };/* Don't handle scatter gather BOs */drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +1
-7@@ -538,19 +538,13 @@ static int amdgpu_move_vram_ram(struct ttm_buffer_object *bo, bool evict, placements.fpfn = 0; placements.lpfn =0 ; placements.mem_type =TTM_PL_TT ; - placements.flags =TTM_PL_MASK_CACHING ; + placements.flags =0 ; r =ttm_bo_mem_space (bo, &placement, &tmp_mem, ctx);if (unlikely (r)) {pr_err ("Failed to find GTT space for blit from VRAM\n" );return r; } -/* set caching flags */ - r =ttm_tt_set_placement_caching (bo->ttm, tmp_mem.placement); -if (unlikely (r)) { - goto out_cleanup; - } - r =ttm_tt_populate (bo->bdev, bo->ttm, ctx);if (unlikely (r))goto out_cleanup;drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +1
-1@@ -599,7 +593,7 @@ static int amdgpu_move_ram_vram(struct ttm_buffer_object *bo, bool evict, placements.fpfn = 0; placements.lpfn =0 ; placements.mem_type =TTM_PL_TT ; - placements.flags =TTM_PL_MASK_CACHING ; + placements.flags =0 ; r =ttm_bo_mem_space (bo, &placement, &tmp_mem, ctx);if (unlikely (r)) {pr_err("Failed to find GTT space for blit to VRAM\n");drivers/gpu/drm/drm_gem_vram_helper.c +2
-5@@ -147,15 +147,12 @@ static void drm_gem_vram_placement(struct drm_gem_vram_object *gbo, if (pl_flag & DRM_GEM_VRAM_PL_FLAG_VRAM) { gbo->placements[c].mem_type =TTM_PL_VRAM ; - gbo->placements[c++].flags =TTM_PL_FLAG_WC | -TTM_PL_FLAG_UNCACHED | - invariant_flags; + gbo->placements[c++].flags = invariant_flags; }if (pl_flag &DRM_GEM_VRAM_PL_FLAG_SYSTEM || !c) { gbo->placements[c].mem_type =TTM_PL_SYSTEM ; - gbo->placements[c++].flags =TTM_PL_MASK_CACHING | - invariant_flags; + gbo->placements[c++].flags = invariant_flags; }gbo->placement.num_placement = c;drivers/gpu/drm/nouveau/nouveau_bo.c +0
-0@@ -343,37 +343,23 @@ nouveau_bo_new(struct nouveau_cli *cli, u64 size, int align, }static void
-set_placement_list(structnouveau_drm*drm, structttm_place*pl, unsigned *n,drivers/gpu/drm/nouveau/nouveau_bo.c +1
-1- uint32_t domain, uint32_t flags) +set_placement_list(struct ttm_place *pl, unsigned *n, uint32_t domain){ *n = 0; if (domain & NOUVEAU_GEM_DOMAIN_VRAM) {drivers/gpu/drm/nouveau/nouveau_bo.c +0
-3-struct nvif_mmu *mmu = &drm->client.mmu; -const u8 type = mmu->type[drm->ttm.type_vram].type; -pl[*n].mem_type = TTM_PL_VRAM;drivers/gpu/drm/nouveau/nouveau_bo.c +0
-4- pl[*n].flags = flags & ~TTM_PL_FLAG_CACHED ; - -/* Some BARs do not support being ioremapped WC */ - if (drm->client.device.info.family >=
NV_DEVICE_INFO_V0_TESLA&&drivers/gpu/drm/nouveau/nouveau_bo.c +1
-3- type & NVIF_MEM_UNCACHED) - pl[*n].flags &= ~TTM_PL_FLAG_WC ; - + pl[*n].flags =0 ;(*n)++; } if (domain & NOUVEAU_GEM_DOMAIN_GART) { pl[*n].mem_type = TTM_PL_TT;drivers/gpu/drm/nouveau/nouveau_bo.c +1
-5- pl[*n].flags = flags; - -if (drm->agp.bridge) - pl[*n].flags &= ~TTM_PL_FLAG_CACHED ; - + pl[*n].flags =0 ;(*n)++; } if (domain & NOUVEAU_GEM_DOMAIN_CPU) { pl[*n].mem_type = TTM_PL_SYSTEM;drivers/gpu/drm/nouveau/nouveau_bo.c +1
-1- pl[(*n)++].flags = flags; + pl[(*n)++].flags =0 ;} }drivers/gpu/drm/nouveau/nouveau_bo.c +3
-7@@ -415,18 +401,14 @@ void nouveau_bo_placement_set(struct nouveau_bo *nvbo, uint32_t domain, uint32_t busy) { - struct nouveau_drm *drm = nouveau_bdev(nvbo->bo.bdev); struct ttm_placement *pl = &nvbo->placement; -uint32_t flags = nvbo->force_coherent ?TTM_PL_FLAG_UNCACHED : -TTM_PL_MASK_CACHING ; pl->placement = nvbo->placements; -set_placement_list (drm, nvbo->placements, &pl->num_placement, - domain, flags); +set_placement_list (nvbo->placements, &pl->num_placement, domain); pl->busy_placement = nvbo->busy_placements; -set_placement_list (drm, nvbo->busy_placements, &pl- >num_busy_placement, - domain | busy, flags); +set_placement_list (nvbo->busy_placements, &pl- >num_busy_placement, + domain | busy);set_placement_range(nvbo, domain); }drivers/gpu/drm/nouveau/nouveau_bo.c +1
-1@@ -888,7 +870,7 @@ nouveau_bo_move_flipd(struct ttm_buffer_object *bo, bool evict, .fpfn = 0, .lpfn = 0, .mem_type = TTM_PL_TT, - .flags = TTM_PL_MASK_CACHING + .flags = 0 };struct ttm_placement placement;struct ttm_resource tmp_reg;drivers/gpu/drm/nouveau/nouveau_bo.c +1
-1@@ -930,7 +912,7 @@ nouveau_bo_move_flips(struct ttm_buffer_object *bo, bool evict, .fpfn = 0, .lpfn = 0, .mem_type = TTM_PL_TT, - .flags = TTM_PL_MASK_CACHING + .flags = 0 };struct ttm_placement placement;struct ttm_resource tmp_reg;drivers/gpu/drm/qxl/qxl_object.c +5
-5@@ -64,21 +64,21 @@ void qxl_ttm_placement_from_domain(struct qxl_bo *qbo, u32 domain) qbo->placement.busy_placement = qbo->placements;if (domain ==QXL_GEM_DOMAIN_VRAM ) { qbo->placements[c].mem_type =TTM_PL_VRAM ; - qbo->placements[c++].flags =TTM_PL_FLAG_CACHED | pflag; + qbo->placements[c++].flags = pflag; }if (domain ==QXL_GEM_DOMAIN_SURFACE ) { qbo->placements[c].mem_type =TTM_PL_PRIV ; - qbo->placements[c++].flags =TTM_PL_FLAG_CACHED | pflag; + qbo->placements[c++].flags = pflag; qbo->placements[c].mem_type =TTM_PL_VRAM ; - qbo->placements[c++].flags =TTM_PL_FLAG_CACHED | pflag; + qbo->placements[c++].flags = pflag; }if (domain ==QXL_GEM_DOMAIN_CPU ) { qbo->placements[c].mem_type =TTM_PL_SYSTEM ; - qbo->placements[c++].flags =TTM_PL_MASK_CACHING | pflag; + qbo->placements[c++].flags = pflag; }if (!c) { qbo->placements[c].mem_type =TTM_PL_SYSTEM ; - qbo->placements[c++].flags =TTM_PL_MASK_CACHING ; + qbo->placements[c++].flags =0 ; }qbo->placement.num_placement = c; qbo->placement.num_busy_placement = c;drivers/gpu/drm/qxl/qxl_ttm.c +1
-1@@ -56,7 +56,7 @@ static void qxl_evict_flags(struct ttm_buffer_object *bo, .fpfn = 0, .lpfn = 0, .mem_type = TTM_PL_SYSTEM, - .flags = TTM_PL_MASK_CACHING + .flags = 0 };if (!qxl_ttm_bo_is_qxl_bo (bo)) {drivers/gpu/drm/radeon/radeon_object.c +8
-36@@ -113,57 +113,29 @@ void radeon_ttm_placement_from_domain(struct radeon_bo *rbo, u32 domain) rbo->placements[c].fpfn = rbo->rdev->mc.visible_vram_size >>PAGE_SHIFT ; rbo->placements[c].mem_type =TTM_PL_VRAM ; - rbo->placements[c++].flags =TTM_PL_FLAG_WC | -TTM_PL_FLAG_UNCACHED ; + rbo->placements[c++].flags =0 ; } rbo->placements[c].fpfn =0 ; rbo->placements[c].mem_type =TTM_PL_VRAM ; - rbo->placements[c++].flags =TTM_PL_FLAG_WC | -TTM_PL_FLAG_UNCACHED ; + rbo->placements[c++].flags =0 ; }if (domain &RADEON_GEM_DOMAIN_GTT ) { -if (rbo->flags &RADEON_GEM_GTT_UC ) { - rbo->placements[c].fpfn =0 ; - rbo->placements[c].mem_type =TTM_PL_TT ; - rbo->placements[c++].flags =TTM_PL_FLAG_UNCACHED ; - - }else if ((rbo->flags &RADEON_GEM_GTT_WC ) || - (rbo->rdev->flags &RADEON_IS_AGP )) { - rbo->placements[c].fpfn =0 ; - rbo->placements[c].mem_type =TTM_PL_TT ; - rbo->placements[c++].flags =TTM_PL_FLAG_WC | -TTM_PL_FLAG_UNCACHED ; - }else { - rbo->placements[c].fpfn =0 ; - rbo->placements[c].mem_type =TTM_PL_TT ; - rbo->placements[c++].flags =TTM_PL_FLAG_CACHED ; - } + rbo->placements[c].fpfn =0 ; + rbo->placements[c].mem_type =TTM_PL_TT ; + rbo->placements[c++].flags =0 ; }if (domain &RADEON_GEM_DOMAIN_CPU ) { -if (rbo->flags &RADEON_GEM_GTT_UC ) { - rbo->placements[c].fpfn =0 ; - rbo->placements[c].mem_type =TTM_PL_SYSTEM ; - rbo->placements[c++].flags =TTM_PL_FLAG_UNCACHED ; - - }else if ((rbo->flags &RADEON_GEM_GTT_WC ) || - rbo->rdev->flags &RADEON_IS_AGP ) { - rbo->placements[c].fpfn =0 ; - rbo->placements[c].mem_type =TTM_PL_SYSTEM ; - rbo->placements[c++].flags =TTM_PL_FLAG_WC | -TTM_PL_FLAG_UNCACHED ; - }else { - rbo->placements[c].fpfn =0 ; - rbo->placements[c].mem_type =TTM_PL_SYSTEM ; - rbo->placements[c++].flags =TTM_PL_FLAG_CACHED ; - } + rbo->placements[c].fpfn =0 ; + rbo->placements[c].mem_type =TTM_PL_SYSTEM ; + rbo->placements[c++].flags =0 ; }if (!c) {rbo->placements[c].fpfn = 0; rbo->placements[c].mem_type = TTM_PL_SYSTEM;drivers/gpu/drm/radeon/radeon_object.c +1
-1- rbo->placements[c++].flags =TTM_PL_MASK_CACHING ; + rbo->placements[c++].flags =0 ;} rbo->placement.num_placement = c;drivers/gpu/drm/radeon/radeon_ttm.c +1
-1@@ -89,7 +89,7 @@ static void radeon_evict_flags(struct ttm_buffer_object *bo, .fpfn = 0, .lpfn = 0, .mem_type = TTM_PL_SYSTEM, - .flags = TTM_PL_MASK_CACHING + .flags = 0 };struct radeon_bo *rbo;drivers/gpu/drm/radeon/radeon_ttm.c +1
-6@@ -225,17 +225,12 @@ static int radeon_move_vram_ram(struct ttm_buffer_object *bo, placements.fpfn =0 ; placements.lpfn =0 ; placements.mem_type =TTM_PL_TT ; - placements.flags =TTM_PL_MASK_CACHING ; + placements.flags =0 ; r =ttm_bo_mem_space (bo, &placement, &tmp_mem, ctx);if (unlikely (r)) {return r; } - r =ttm_tt_set_placement_caching (bo->ttm, tmp_mem.placement); -if (unlikely (r)) { - goto out_cleanup; - } - r =ttm_tt_populate (bo->bdev, bo->ttm, ctx);if (unlikely (r)) {goto out_cleanup;drivers/gpu/drm/radeon/radeon_ttm.c +1
-1@@ -275,7 +270,7 @@ static int radeon_move_ram_vram(struct ttm_buffer_object *bo, placements.fpfn =0 ; placements.lpfn =0 ; placements.mem_type =TTM_PL_TT ; - placements.flags =TTM_PL_MASK_CACHING ; + placements.flags =0 ; r =ttm_bo_mem_space (bo, &placement, &tmp_mem, ctx);if (unlikely (r)) {return r;drivers/gpu/drm/radeon/radeon_ttm.c +0
-0@@ -389,12 +384,7 @@ static int radeon_ttm_io_mem_reserve(struct
ttm_bo_device*bdev, structttm_reso
* Alpha: use bus.addr to hold theioremap()return,
* so we can modify bus.base below.
*/
drivers/gpu/drm/radeon/radeon_ttm.c static int radeon_ttm_io_mem_reserve(struct ttm_bo_device *bdev, struct ttm_reso · line 387
Quoted 7 lines
drivers/gpu/drm/radeon/radeon_ttm.c +1
-6-if (mem->placement &TTM_PL_FLAG_WC ) - mem->bus.addr = -ioremap_wc (mem->bus.offset, bus_size); -else - mem->bus.addr = -ioremap (mem->bus.offset, bus_size); + mem->bus.addr =ioremap_wc (mem->bus.offset, bus_size);
Why can you eliminate the ioremap() here?
does this need to be:
if mem->bus.caching instead?
Quoted 356 lines
if (!mem->bus.addr) return -ENOMEM;drivers/gpu/drm/ttm/ttm_agp_backend.c +1
-1@@ -54,7 +54,7 @@ int ttm_agp_bind(struct ttm_tt *ttm, struct ttm_resource *bo_mem)struct page *dummy_read_page = ttm_bo_glob.dummy_read_page;struct drm_mm_node *node = bo_mem->mm_node;struct agp_memory *mem; -int ret, cached = (bo_mem->placement &TTM_PL_FLAG_CACHED ); +int ret, cached = ttm->caching == ttm_cached;unsigned i;if (agp_be->mem)drivers/gpu/drm/ttm/ttm_bo.c +0
-4@@ -252,10 +252,6 @@ static int ttm_bo_handle_move_mem(struct ttm_buffer_object *bo, if (ret) goto out_err; - ret =ttm_tt_set_placement_caching (bo->ttm, mem- >placement); -if (ret) - goto out_err; -if (mem->mem_type !=TTM_PL_SYSTEM ) {ret = ttm_tt_populate(bdev, bo->ttm, ctx); if (ret)drivers/gpu/drm/ttm/ttm_bo.c +0
-23@@ -854,29 +850,6 @@ static int ttm_bo_mem_force_space(structttm_buffer_object *bo, return ttm_bo_add_move_fence(bo, man, mem, ctx->no_wait_gpu); } -static uint32_t ttm_bo_select_caching (struct ttm_resource_manager *man, -uint32_t cur_placement, -uint32_t proposed_placement) -{ -uint32_t caching = proposed_placement &TTM_PL_MASK_CACHING ; -uint32_t result = proposed_placement & ~TTM_PL_MASK_CACHING ; - -/** -* Keep current caching if possible. -*/ - -if ((cur_placement & caching) !=0 ) - result |= (cur_placement & caching); -else if ((TTM_PL_FLAG_CACHED & caching) !=0 ) - result |=TTM_PL_FLAG_CACHED ; -else if ((TTM_PL_FLAG_WC & caching) !=0 ) - result |=TTM_PL_FLAG_WC ; -else if ((TTM_PL_FLAG_UNCACHED & caching) !=0 ) - result |=TTM_PL_FLAG_UNCACHED ; - -return result; -} -/** * ttm_bo_mem_placement - check if placement is compatible * @bo: BO to find memory for
drivers/gpu/drm/ttm/ttm_bo.c +1
-6@@ -895,18 +868,13 @@ static int ttm_bo_mem_placement(struct ttm_buffer_object *bo, {struct ttm_bo_device *bdev = bo->bdev;struct ttm_resource_manager *man; -uint32_t cur_flags =0 ; man =ttm_manager_type (bdev, place->mem_type);if (!man || !ttm_resource_manager_used (man))return -EBUSY ; - cur_flags =ttm_bo_select_caching (man, bo->mem.placement, - place->flags); - cur_flags |= place->flags & ~TTM_PL_MASK_CACHING ; - mem->mem_type = place->mem_type; - mem->placement = cur_flags; + mem->placement = place->flags;spin_lock (&ttm_bo_glob.lru_lock);ttm_bo_del_from_lru(bo);drivers/gpu/drm/ttm/ttm_bo.c +0
-1@@ -1039,8 +1007,7 @@ static bool ttm_bo_places_compat(const structttm_place *places, continue; *new_flags = heap->flags; - if ((*new_flags & mem->placement &
TTM_PL_MASK_CACHING) &&drivers/gpu/drm/ttm/ttm_bo.c +1
-1- (mem->mem_type == heap->mem_type) && + if ((mem->mem_type == heap->mem_type) &&(!(*new_flags & TTM_PL_FLAG_CONTIGUOUS) || (mem->placement & TTM_PL_FLAG_CONTIGUOUS))) return true;drivers/gpu/drm/ttm/ttm_bo.c +0
-3@@ -1094,9 +1061,6 @@ int ttm_bo_validate(struct ttm_buffer_object *bo, ret =ttm_bo_move_buffer (bo, placement, ctx);if (ret)return ret; - }else { - bo->mem.placement &=TTM_PL_MASK_CACHING ; - bo->mem.placement |= new_flags & ~TTM_PL_MASK_CACHING ; }/* * We might need to add a TTM.
drivers/gpu/drm/ttm/ttm_bo.c +1
-1@@ -1164,7 +1128,7 @@ int ttm_bo_init_reserved(struct ttm_bo_device *bdev, bo->mem.bus.offset =0 ; bo->mem.bus.addr =NULL ; bo->moving =NULL ; - bo->mem.placement =TTM_PL_FLAG_CACHED ; + bo->mem.placement =0 ; bo->acc_size = acc_size; bo->pin_count =0 ;bo->sg = sg;drivers/gpu/drm/ttm/ttm_bo.c +1
-1@@ -1512,7 +1476,7 @@ int ttm_bo_swapout(struct ttm_bo_global *glob, struct ttm_operation_ctx *ctx) evict_mem = bo->mem; evict_mem.mm_node =NULL ; - evict_mem.placement =TTM_PL_MASK_CACHING ; + evict_mem.placement =0 ; evict_mem.mem_type =TTM_PL_SYSTEM ;ret = ttm_bo_handle_move_mem(bo,
&evict_mem, true,
&ctx);drivers/gpu/drm/ttm/ttm_bo_util.c +1
-5@@ -72,10 +72,6 @@ int ttm_bo_move_ttm(struct ttm_buffer_object *bo, old_mem->mem_type =TTM_PL_SYSTEM ; } - ret =ttm_tt_set_placement_caching (ttm, new_mem->placement); -if (unlikely (ret !=0 )) -return ret; -if (new_mem->mem_type !=TTM_PL_SYSTEM ) { ret =ttm_tt_populate (bo->bdev, ttm, ctx);@@ -135,7 +131,7 @@ static int ttm_resource_ioremap(struct ttm_bo_device *bdev, }else {size_t bus_size = (size_t )mem->num_pages <<PAGE_SHIFT ; -if (mem->placement &TTM_PL_FLAG_WC ) +if (mem->bus.caching == ttm_write_combined) addr =ioremap_wc (mem->bus.offset, bus_size);else addr = ioremap(mem->bus.offset, bus_size);drivers/gpu/drm/ttm/ttm_bo_util.c +1
-1@@ -427,7 +423,7 @@ static int ttm_bo_ioremap(struct ttm_buffer_object *bo, map->virtual = (void *)(((u8 *)bo->mem.bus.addr) + offset); }else { map->bo_kmap_type = ttm_bo_map_iomap; -if (mem->placement &TTM_PL_FLAG_WC ) +if (mem->bus.caching == ttm_write_combined) map->virtual = ioremap_wc(bo->mem.bus.offset + offset,size); elsedrivers/gpu/drm/ttm/ttm_bo_util.c +1
-1@@ -457,7 +453,7 @@ static int ttm_bo_kmap_ttm(struct ttm_buffer_object *bo, if (ret)return ret; -if (num_pages ==1 && (mem->placement & TTM_PL_FLAG_CACHED)) { +if (num_pages ==1 && ttm->caching == ttm_cached) {/* * We're mapping a single page, and the desired
* page protection is consistent with the bo.drivers/gpu/drm/ttm/ttm_tt.c +0
-29@@ -114,35 +114,6 @@ static int ttm_sg_tt_alloc_page_directory(struct ttm_dma_tt *ttm)return 0 ; } -static int ttm_tt_set_caching (struct ttm_tt *ttm,enum ttm_caching caching) -{ -if (ttm->caching == caching) -return 0 ; - -/* Can't change the caching state after TT is populated */ -if (WARN_ON_ONCE (ttm_tt_is_populated (ttm))) -return -EINVAL ; - - ttm->caching = caching; - -return 0 ; -} - -int ttm_tt_set_placement_caching (struct ttm_tt *ttm,uint32_t placement) -{ -enum ttm_caching state; - -if (placement &TTM_PL_FLAG_WC ) - state = ttm_write_combined; -else if (placement &TTM_PL_FLAG_UNCACHED ) - state = ttm_uncached; -else - state = ttm_cached; - -return ttm_tt_set_caching (ttm, state); -} -EXPORT_SYMBOL (ttm_tt_set_placement_caching); -void
ttm_tt_destroy_common(struct ttm_bo_device *bdev, struct ttm_tt *ttm){ ttm_tt_unpopulate(bdev, ttm);drivers/gpu/drm/vmwgfx/vmwgfx_ttm_buffer.c +15
-15@@ -34,28 +34,28 @@ static const struct ttm_place vram_placement_flags = { .fpfn = 0, .lpfn = 0, .mem_type = TTM_PL_VRAM, - .flags = TTM_PL_FLAG_CACHED + .flags = 0 };static const struct ttm_place sys_placement_flags = { .fpfn =0 , .lpfn =0 , .mem_type =TTM_PL_SYSTEM , - .flags =TTM_PL_FLAG_CACHED + .flags =0 };static const struct ttm_place gmr_placement_flags = { .fpfn =0 , .lpfn =0 , .mem_type =VMW_PL_GMR , - .flags =TTM_PL_FLAG_CACHED + .flags =0 };static const struct ttm_place mob_placement_flags = { .fpfn =0 , .lpfn =0 , .mem_type =VMW_PL_MOB , - .flags =TTM_PL_FLAG_CACHED + .flags =0 };struct ttm_placement vmw_vram_placement = {@@ -70,12 +70,12 @@ static const struct ttm_place vram_gmr_placement_flags[] = { .fpfn =0 , .lpfn =0 , .mem_type =TTM_PL_VRAM , - .flags =TTM_PL_FLAG_CACHED + .flags =0 }, { .fpfn = 0, .lpfn = 0, .mem_type = VMW_PL_GMR, - .flags = TTM_PL_FLAG_CACHED + .flags = 0 } };@@ -84,12 +84,12 @@ static const struct ttm_place gmr_vram_placement_flags[] = { .fpfn =0 , .lpfn =0 , .mem_type =VMW_PL_GMR , - .flags =TTM_PL_FLAG_CACHED + .flags =0 }, { .fpfn = 0, .lpfn = 0, .mem_type = TTM_PL_VRAM, - .flags = TTM_PL_FLAG_CACHED + .flags = 0 } };@@ -119,22 +119,22 @@ static const struct ttm_place evictable_placement_flags[] = { .fpfn = 0, .lpfn = 0, .mem_type = TTM_PL_SYSTEM, - .flags =TTM_PL_FLAG_CACHED + .flags =0 }, { .fpfn = 0, .lpfn = 0, .mem_type = TTM_PL_VRAM, - .flags =TTM_PL_FLAG_CACHED + .flags =0 }, { .fpfn = 0, .lpfn = 0, .mem_type = VMW_PL_GMR, - .flags =TTM_PL_FLAG_CACHED + .flags =0 }, { .fpfn = 0, .lpfn = 0, .mem_type = VMW_PL_MOB, - .flags = TTM_PL_FLAG_CACHED + .flags = 0 } };@@ -143,17 +143,17 @@ static const struct ttm_place nonfixed_placement_flags[] = { .fpfn = 0, .lpfn = 0, .mem_type = TTM_PL_SYSTEM, - .flags =TTM_PL_FLAG_CACHED + .flags =0 }, { .fpfn = 0, .lpfn = 0, .mem_type = VMW_PL_GMR, - .flags =TTM_PL_FLAG_CACHED + .flags =0 }, { .fpfn = 0, .lpfn = 0, .mem_type = VMW_PL_MOB, - .flags = TTM_PL_FLAG_CACHED + .flags = 0 } };include/drm/ttm/ttm_placement.h +0
-6@@ -43,27 +43,13 @@#define TTM_PL_PRIV 3/* -* Other flags that affects data placement. -* TTM_PL_FLAG_CACHED indicates cache-coherent mappings -* if available. -* TTM_PL_FLAG_SHARED means that another application may -* reference the buffer. -* TTM_PL_FLAG_NO_EVICT means that the buffer may never
include/drm/ttm/ttm_placement.h line 51
Quoted 10 lines
include/drm/ttm/ttm_placement.h +0
-4-* be evicted to make room for other buffers. * TTM_PL_FLAG_TOPDOWN requests to be placed from the * top of the memory area, instead of the bottom. */ -#define TTM_PL_FLAG_CACHED (1 << 16) -#define TTM_PL_FLAG_UNCACHED (1 << 17) -#define TTM_PL_FLAG_WC (1 << 18)#define TTM_PL_FLAG_CONTIGUOUS (1 << 19)#define TTM_PL_FLAG_TOPDOWN (1 << 22)
Do these bit shifts mean anything anymore?
This series is a nice cleanup. For me it makes the caching mechanism a lot more clear.
If the removal of the ioremap() (comment above) is ok,:
m
Quoted 37 lines
include/drm/ttm/ttm_placement.h +0
-4-#define TTM_PL_MASK_CACHING (TTM_PL_FLAG_CACHED | \ - TTM_PL_FLAG_UNCACHED | \ - TTM_PL_FLAG_WC) -/** * struct ttm_place * include/drm/ttm/ttm_tt.h +0
-15@@ -164,21 +164,6 @@ void ttm_tt_destroy_common(struct ttm_bo_device*bdev, struct ttm_tt *ttm); * Swap in a previously swap out ttm_tt. */ int ttm_tt_swapin (struct ttm_tt *ttm); - -/** -* ttm_tt_set_placement_caching: -* -* @ttm A struct ttm_tt the backing pages of which will change caching policy. -* @placement: Flag indicating the desired caching policy. -* -* This function will change caching policy of any default kernel mappings of -* the pages backing @ttm. If changing from cached to uncached or -* write-combined, -* all CPU caches will first be flushed to make sure the data of the pages -* hit RAM. This function may be very costly as it involves global TLB -* and cache flushes and potential page splitting / combining. -*/ -int ttm_tt_set_placement_caching (struct ttm_tt *ttm,uint32_t placement);int ttm_tt_swapout (struct ttm_bo_device *bdev,struct ttm_tt *ttm);/**
--
2.17.1
Quoted 4 lines
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 8/8] drm/ttm: nuke caching placement flags
Am 05.10.20 um 18:17 schrieb Ruhl, Michael J:
Quoted 465 lines
Quoted 456 lines
-----Original Message-----
From: dri-devel <[email protected]> On Behalf Of Christian König
Sent: Thursday, October 1, 2020 7:28 AM
To: [email protected]; [email protected]; [email protected]; [email protected]
Subject: [PATCH 8/8] drm/ttm: nuke caching placement flagsChanging the caching on the fly never really worked flawlessly.
So stop this completely and just let drivers specific the desired caching in the tt or bus object.
Signed-off-by Christian König <[email protected]>---
drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | 20 +++------- drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 12 ++---- drivers/gpu/drm/drm_gem_vram_helper.c | 7 +--- drivers/gpu/drm/nouveau/nouveau_bo.c | 36 +++++------------ drivers/gpu/drm/qxl/qxl_object.c | 10 ++--- drivers/gpu/drm/qxl/qxl_ttm.c | 2 +- drivers/gpu/drm/radeon/radeon_object.c | 46 +++++----------------- drivers/gpu/drm/radeon/radeon_ttm.c | 18 ++------- drivers/gpu/drm/ttm/ttm_agp_backend.c | 2 +- drivers/gpu/drm/ttm/ttm_bo.c | 44 ++------------------- drivers/gpu/drm/ttm/ttm_bo_util.c | 10 ++--- drivers/gpu/drm/ttm/ttm_tt.c | 29 -------------- drivers/gpu/drm/vmwgfx/vmwgfx_ttm_buffer.c | 30 +++++++------- include/drm/ttm/ttm_placement.h | 14 ------- include/drm/ttm/ttm_tt.h | 15 ------- 15 files changed, 61 insertions(+), 234 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu_object.c +1
-1@@ -137,7 +137,7 @@ void amdgpu_bo_placement_from_domain(struct amdgpu_bo *abo, u32 domain) places[c].fpfn = 0; places[c].lpfn =0 ; places[c].mem_type =TTM_PL_VRAM ; - places[c].flags =TTM_PL_FLAG_WC |TTM_PL_FLAG_UNCACHED ; + places[c].flags =0 ;if (flags & AMDGPU_GEM_CREATE_CPU_ACCESS_REQUIRED) places[c].lpfn = visible_pfn;drivers/gpu/drm/amd/amdgpu/amdgpu_object.c +4
-14@@ -154,11 +154,6 @@ void amdgpu_bo_placement_from_domain(struct amdgpu_bo *abo, u32 domain) places[c].lpfn = 0; places[c].mem_type =TTM_PL_TT ; places[c].flags =0 ; -if (flags &AMDGPU_GEM_CREATE_CPU_GTT_USWC ) - places[c].flags |=TTM_PL_FLAG_WC | -TTM_PL_FLAG_UNCACHED ; -else - places[c].flags |=TTM_PL_FLAG_CACHED ; c++; }@@ -167,11 +162,6 @@ void amdgpu_bo_placement_from_domain(struct amdgpu_bo *abo, u32 domain) places[c].lpfn = 0; places[c].mem_type =TTM_PL_SYSTEM ; places[c].flags =0 ; -if (flags &AMDGPU_GEM_CREATE_CPU_GTT_USWC ) - places[c].flags |=TTM_PL_FLAG_WC | -TTM_PL_FLAG_UNCACHED ; -else - places[c].flags |=TTM_PL_FLAG_CACHED ; c++; }@@ -179,7 +169,7 @@ void amdgpu_bo_placement_from_domain(struct amdgpu_bo *abo, u32 domain) places[c].fpfn = 0; places[c].lpfn =0 ; places[c].mem_type =AMDGPU_PL_GDS ; - places[c].flags =TTM_PL_FLAG_UNCACHED ; + places[c].flags =0 ; c++; }@@ -187,7 +177,7 @@ void amdgpu_bo_placement_from_domain(struct amdgpu_bo *abo, u32 domain) places[c].fpfn = 0; places[c].lpfn =0 ; places[c].mem_type =AMDGPU_PL_GWS ; - places[c].flags =TTM_PL_FLAG_UNCACHED ; + places[c].flags =0 ; c++; }@@ -195,7 +185,7 @@ void amdgpu_bo_placement_from_domain(struct amdgpu_bo *abo, u32 domain) places[c].fpfn = 0; places[c].lpfn =0 ; places[c].mem_type =AMDGPU_PL_OA ; - places[c].flags =TTM_PL_FLAG_UNCACHED ; + places[c].flags =0 ; c++; }@@ -203,7 +193,7 @@ void amdgpu_bo_placement_from_domain(struct amdgpu_bo *abo, u32 domain) places[c].fpfn = 0; places[c].lpfn =0 ; places[c].mem_type =TTM_PL_SYSTEM ; - places[c].flags =TTM_PL_MASK_CACHING ; + places[c].flags =0 ; c++; }drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +1
-1@@ -92,7 +92,7 @@ static void amdgpu_evict_flags(struct ttm_buffer_object *bo, .fpfn = 0, .lpfn = 0, .mem_type = TTM_PL_SYSTEM, - .flags = TTM_PL_MASK_CACHING + .flags = 0 };/* Don't handle scatter gather BOs */drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +1
-7@@ -538,19 +538,13 @@ static int amdgpu_move_vram_ram(struct ttm_buffer_object *bo, bool evict, placements.fpfn = 0; placements.lpfn =0 ; placements.mem_type =TTM_PL_TT ; - placements.flags =TTM_PL_MASK_CACHING ; + placements.flags =0 ; r =ttm_bo_mem_space (bo, &placement, &tmp_mem, ctx);if (unlikely (r)) {pr_err ("Failed to find GTT space for blit from VRAM\n" );return r; } -/* set caching flags */ - r =ttm_tt_set_placement_caching (bo->ttm, tmp_mem.placement); -if (unlikely (r)) { - goto out_cleanup; - } - r =ttm_tt_populate (bo->bdev, bo->ttm, ctx);if (unlikely (r))goto out_cleanup;drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +1
-1@@ -599,7 +593,7 @@ static int amdgpu_move_ram_vram(struct ttm_buffer_object *bo, bool evict, placements.fpfn = 0; placements.lpfn =0 ; placements.mem_type =TTM_PL_TT ; - placements.flags =TTM_PL_MASK_CACHING ; + placements.flags =0 ; r =ttm_bo_mem_space (bo, &placement, &tmp_mem, ctx);if (unlikely (r)) {pr_err("Failed to find GTT space for blit to VRAM\n");drivers/gpu/drm/drm_gem_vram_helper.c +2
-5@@ -147,15 +147,12 @@ static void drm_gem_vram_placement(struct drm_gem_vram_object *gbo, if (pl_flag & DRM_GEM_VRAM_PL_FLAG_VRAM) { gbo->placements[c].mem_type =TTM_PL_VRAM ; - gbo->placements[c++].flags =TTM_PL_FLAG_WC | -TTM_PL_FLAG_UNCACHED | - invariant_flags; + gbo->placements[c++].flags = invariant_flags; }if (pl_flag &DRM_GEM_VRAM_PL_FLAG_SYSTEM || !c) { gbo->placements[c].mem_type =TTM_PL_SYSTEM ; - gbo->placements[c++].flags =TTM_PL_MASK_CACHING | - invariant_flags; + gbo->placements[c++].flags = invariant_flags; }gbo->placement.num_placement = c;drivers/gpu/drm/nouveau/nouveau_bo.c +0
-0@@ -343,37 +343,23 @@ nouveau_bo_new(struct nouveau_cli *cli, u64 size, int align, }static void
-set_placement_list(structnouveau_drm*drm, structttm_place*pl, unsigned *n,drivers/gpu/drm/nouveau/nouveau_bo.c +1
-1- uint32_t domain, uint32_t flags) +set_placement_list(struct ttm_place *pl, unsigned *n, uint32_t domain){ *n = 0; if (domain & NOUVEAU_GEM_DOMAIN_VRAM) {drivers/gpu/drm/nouveau/nouveau_bo.c +0
-3-struct nvif_mmu *mmu = &drm->client.mmu; -const u8 type = mmu->type[drm->ttm.type_vram].type; -pl[*n].mem_type = TTM_PL_VRAM;drivers/gpu/drm/nouveau/nouveau_bo.c +0
-4- pl[*n].flags = flags & ~TTM_PL_FLAG_CACHED ; - -/* Some BARs do not support being ioremapped WC */ - if (drm->client.device.info.family >=
NV_DEVICE_INFO_V0_TESLA&&drivers/gpu/drm/nouveau/nouveau_bo.c +1
-3- type & NVIF_MEM_UNCACHED) - pl[*n].flags &= ~TTM_PL_FLAG_WC ; - + pl[*n].flags =0 ;(*n)++; } if (domain & NOUVEAU_GEM_DOMAIN_GART) { pl[*n].mem_type = TTM_PL_TT;drivers/gpu/drm/nouveau/nouveau_bo.c +1
-5- pl[*n].flags = flags; - -if (drm->agp.bridge) - pl[*n].flags &= ~TTM_PL_FLAG_CACHED ; - + pl[*n].flags =0 ;(*n)++; } if (domain & NOUVEAU_GEM_DOMAIN_CPU) { pl[*n].mem_type = TTM_PL_SYSTEM;drivers/gpu/drm/nouveau/nouveau_bo.c +1
-1- pl[(*n)++].flags = flags; + pl[(*n)++].flags =0 ;} }drivers/gpu/drm/nouveau/nouveau_bo.c +3
-7@@ -415,18 +401,14 @@ void nouveau_bo_placement_set(struct nouveau_bo *nvbo, uint32_t domain, uint32_t busy) { - struct nouveau_drm *drm = nouveau_bdev(nvbo->bo.bdev); struct ttm_placement *pl = &nvbo->placement; -uint32_t flags = nvbo->force_coherent ?TTM_PL_FLAG_UNCACHED : -TTM_PL_MASK_CACHING ; pl->placement = nvbo->placements; -set_placement_list (drm, nvbo->placements, &pl->num_placement, - domain, flags); +set_placement_list (nvbo->placements, &pl->num_placement, domain); pl->busy_placement = nvbo->busy_placements; -set_placement_list (drm, nvbo->busy_placements, &pl- > num_busy_placement, - domain | busy, flags); +set_placement_list (nvbo->busy_placements, &pl- > num_busy_placement, + domain | busy);set_placement_range(nvbo, domain); }drivers/gpu/drm/nouveau/nouveau_bo.c +1
-1@@ -888,7 +870,7 @@ nouveau_bo_move_flipd(struct ttm_buffer_object *bo, bool evict, .fpfn = 0, .lpfn = 0, .mem_type = TTM_PL_TT, - .flags = TTM_PL_MASK_CACHING + .flags = 0 };struct ttm_placement placement;struct ttm_resource tmp_reg;drivers/gpu/drm/nouveau/nouveau_bo.c +1
-1@@ -930,7 +912,7 @@ nouveau_bo_move_flips(struct ttm_buffer_object *bo, bool evict, .fpfn = 0, .lpfn = 0, .mem_type = TTM_PL_TT, - .flags = TTM_PL_MASK_CACHING + .flags = 0 };struct ttm_placement placement;struct ttm_resource tmp_reg;drivers/gpu/drm/qxl/qxl_object.c +5
-5@@ -64,21 +64,21 @@ void qxl_ttm_placement_from_domain(struct qxl_bo *qbo, u32 domain) qbo->placement.busy_placement = qbo->placements;if (domain ==QXL_GEM_DOMAIN_VRAM ) { qbo->placements[c].mem_type =TTM_PL_VRAM ; - qbo->placements[c++].flags =TTM_PL_FLAG_CACHED | pflag; + qbo->placements[c++].flags = pflag; }if (domain ==QXL_GEM_DOMAIN_SURFACE ) { qbo->placements[c].mem_type =TTM_PL_PRIV ; - qbo->placements[c++].flags =TTM_PL_FLAG_CACHED | pflag; + qbo->placements[c++].flags = pflag; qbo->placements[c].mem_type =TTM_PL_VRAM ; - qbo->placements[c++].flags =TTM_PL_FLAG_CACHED | pflag; + qbo->placements[c++].flags = pflag; }if (domain ==QXL_GEM_DOMAIN_CPU ) { qbo->placements[c].mem_type =TTM_PL_SYSTEM ; - qbo->placements[c++].flags =TTM_PL_MASK_CACHING | pflag; + qbo->placements[c++].flags = pflag; }if (!c) { qbo->placements[c].mem_type =TTM_PL_SYSTEM ; - qbo->placements[c++].flags =TTM_PL_MASK_CACHING ; + qbo->placements[c++].flags =0 ; }qbo->placement.num_placement = c; qbo->placement.num_busy_placement = c;drivers/gpu/drm/qxl/qxl_ttm.c +1
-1@@ -56,7 +56,7 @@ static void qxl_evict_flags(struct ttm_buffer_object *bo, .fpfn = 0, .lpfn = 0, .mem_type = TTM_PL_SYSTEM, - .flags = TTM_PL_MASK_CACHING + .flags = 0 };if (!qxl_ttm_bo_is_qxl_bo (bo)) {drivers/gpu/drm/radeon/radeon_object.c +8
-36@@ -113,57 +113,29 @@ void radeon_ttm_placement_from_domain(struct radeon_bo *rbo, u32 domain) rbo->placements[c].fpfn = rbo->rdev->mc.visible_vram_size >>PAGE_SHIFT ; rbo->placements[c].mem_type =TTM_PL_VRAM ; - rbo->placements[c++].flags =TTM_PL_FLAG_WC | -TTM_PL_FLAG_UNCACHED ; + rbo->placements[c++].flags =0 ; } rbo->placements[c].fpfn =0 ; rbo->placements[c].mem_type =TTM_PL_VRAM ; - rbo->placements[c++].flags =TTM_PL_FLAG_WC | -TTM_PL_FLAG_UNCACHED ; + rbo->placements[c++].flags =0 ; }if (domain &RADEON_GEM_DOMAIN_GTT ) { -if (rbo->flags &RADEON_GEM_GTT_UC ) { - rbo->placements[c].fpfn =0 ; - rbo->placements[c].mem_type =TTM_PL_TT ; - rbo->placements[c++].flags =TTM_PL_FLAG_UNCACHED ; - - }else if ((rbo->flags &RADEON_GEM_GTT_WC ) || - (rbo->rdev->flags &RADEON_IS_AGP )) { - rbo->placements[c].fpfn =0 ; - rbo->placements[c].mem_type =TTM_PL_TT ; - rbo->placements[c++].flags =TTM_PL_FLAG_WC | -TTM_PL_FLAG_UNCACHED ; - }else { - rbo->placements[c].fpfn =0 ; - rbo->placements[c].mem_type =TTM_PL_TT ; - rbo->placements[c++].flags =TTM_PL_FLAG_CACHED ; - } + rbo->placements[c].fpfn =0 ; + rbo->placements[c].mem_type =TTM_PL_TT ; + rbo->placements[c++].flags =0 ; }if (domain &RADEON_GEM_DOMAIN_CPU ) { -if (rbo->flags &RADEON_GEM_GTT_UC ) { - rbo->placements[c].fpfn =0 ; - rbo->placements[c].mem_type =TTM_PL_SYSTEM ; - rbo->placements[c++].flags =TTM_PL_FLAG_UNCACHED ; - - }else if ((rbo->flags &RADEON_GEM_GTT_WC ) || - rbo->rdev->flags &RADEON_IS_AGP ) { - rbo->placements[c].fpfn =0 ; - rbo->placements[c].mem_type =TTM_PL_SYSTEM ; - rbo->placements[c++].flags =TTM_PL_FLAG_WC | -TTM_PL_FLAG_UNCACHED ; - }else { - rbo->placements[c].fpfn =0 ; - rbo->placements[c].mem_type =TTM_PL_SYSTEM ; - rbo->placements[c++].flags =TTM_PL_FLAG_CACHED ; - } + rbo->placements[c].fpfn =0 ; + rbo->placements[c].mem_type =TTM_PL_SYSTEM ; + rbo->placements[c++].flags =0 ; }if (!c) {rbo->placements[c].fpfn = 0; rbo->placements[c].mem_type = TTM_PL_SYSTEM;drivers/gpu/drm/radeon/radeon_object.c +1
-1- rbo->placements[c++].flags =TTM_PL_MASK_CACHING ; + rbo->placements[c++].flags =0 ;} rbo->placement.num_placement = c;drivers/gpu/drm/radeon/radeon_ttm.c +1
-1@@ -89,7 +89,7 @@ static void radeon_evict_flags(struct ttm_buffer_object *bo, .fpfn = 0, .lpfn = 0, .mem_type = TTM_PL_SYSTEM, - .flags = TTM_PL_MASK_CACHING + .flags = 0 };struct radeon_bo *rbo;drivers/gpu/drm/radeon/radeon_ttm.c +1
-6@@ -225,17 +225,12 @@ static int radeon_move_vram_ram(struct ttm_buffer_object *bo, placements.fpfn =0 ; placements.lpfn =0 ; placements.mem_type =TTM_PL_TT ; - placements.flags =TTM_PL_MASK_CACHING ; + placements.flags =0 ; r =ttm_bo_mem_space (bo, &placement, &tmp_mem, ctx);if (unlikely (r)) {return r; } - r =ttm_tt_set_placement_caching (bo->ttm, tmp_mem.placement); -if (unlikely (r)) { - goto out_cleanup; - } - r =ttm_tt_populate (bo->bdev, bo->ttm, ctx);if (unlikely (r)) {goto out_cleanup;drivers/gpu/drm/radeon/radeon_ttm.c +1
-1@@ -275,7 +270,7 @@ static int radeon_move_ram_vram(struct ttm_buffer_object *bo, placements.fpfn =0 ; placements.lpfn =0 ; placements.mem_type =TTM_PL_TT ; - placements.flags =TTM_PL_MASK_CACHING ; + placements.flags =0 ; r =ttm_bo_mem_space (bo, &placement, &tmp_mem, ctx);if (unlikely (r)) {return r;drivers/gpu/drm/radeon/radeon_ttm.c +0
-0@@ -389,12 +384,7 @@ static int radeon_ttm_io_mem_reserve(struct
ttm_bo_device*bdev, structttm_reso
* Alpha: use bus.addr to hold theioremap()return,
* so we can modify bus.base below.
*/drivers/gpu/drm/radeon/radeon_ttm.c static int radeon_ttm_io_mem_reserve(struct ttm_bo_device *bdev, struct ttm_reso · line 387
Quoted 7 lines
drivers/gpu/drm/radeon/radeon_ttm.c +1
-6-if (mem->placement &TTM_PL_FLAG_WC ) - mem->bus.addr = -ioremap_wc (mem->bus.offset, bus_size); -else - mem->bus.addr = -ioremap (mem->bus.offset, bus_size); + mem->bus.addr =ioremap_wc (mem->bus.offset, bus_size);Why can you eliminate the
ioremap()here?
Quoted 3 lines
does this need to be:
if
mem->bus.cachinginstead?
Radeon always uses WC for VRAM. So the uncached ioremap() path should have never been used.
But on the other hand Alpha systems are out of production for quite some time now (20 years or so?).
So I would be more than happy to just drop support for this :)
Quoted 363 lines
Quoted 363 lines
if (!mem->bus.addr) return -ENOMEM;drivers/gpu/drm/ttm/ttm_agp_backend.c +1
-1@@ -54,7 +54,7 @@ int ttm_agp_bind(struct ttm_tt *ttm, struct ttm_resource *bo_mem)struct page *dummy_read_page = ttm_bo_glob.dummy_read_page;struct drm_mm_node *node = bo_mem->mm_node;struct agp_memory *mem; -int ret, cached = (bo_mem->placement &TTM_PL_FLAG_CACHED ); +int ret, cached = ttm->caching == ttm_cached;unsigned i;if (agp_be->mem)drivers/gpu/drm/ttm/ttm_bo.c +0
-4@@ -252,10 +252,6 @@ static int ttm_bo_handle_move_mem(struct ttm_buffer_object *bo, if (ret) goto out_err; - ret =ttm_tt_set_placement_caching (bo->ttm, mem- > placement); -if (ret) - goto out_err; -if (mem->mem_type !=TTM_PL_SYSTEM ) {ret = ttm_tt_populate(bdev, bo->ttm, ctx); if (ret)drivers/gpu/drm/ttm/ttm_bo.c +0
-23@@ -854,29 +850,6 @@ static int ttm_bo_mem_force_space(structttm_buffer_object *bo, return ttm_bo_add_move_fence(bo, man, mem, ctx->no_wait_gpu); } -static uint32_t ttm_bo_select_caching (struct ttm_resource_manager *man, -uint32_t cur_placement, -uint32_t proposed_placement) -{ -uint32_t caching = proposed_placement &TTM_PL_MASK_CACHING ; -uint32_t result = proposed_placement & ~TTM_PL_MASK_CACHING ; - -/** -* Keep current caching if possible. -*/ - -if ((cur_placement & caching) !=0 ) - result |= (cur_placement & caching); -else if ((TTM_PL_FLAG_CACHED & caching) !=0 ) - result |=TTM_PL_FLAG_CACHED ; -else if ((TTM_PL_FLAG_WC & caching) !=0 ) - result |=TTM_PL_FLAG_WC ; -else if ((TTM_PL_FLAG_UNCACHED & caching) !=0 ) - result |=TTM_PL_FLAG_UNCACHED ; - -return result; -} -/** * ttm_bo_mem_placement - check if placement is compatible * @bo: BO to find memory for
drivers/gpu/drm/ttm/ttm_bo.c +1
-6@@ -895,18 +868,13 @@ static int ttm_bo_mem_placement(struct ttm_buffer_object *bo, {struct ttm_bo_device *bdev = bo->bdev;struct ttm_resource_manager *man; -uint32_t cur_flags =0 ; man =ttm_manager_type (bdev, place->mem_type);if (!man || !ttm_resource_manager_used (man))return -EBUSY ; - cur_flags =ttm_bo_select_caching (man, bo->mem.placement, - place->flags); - cur_flags |= place->flags & ~TTM_PL_MASK_CACHING ; - mem->mem_type = place->mem_type; - mem->placement = cur_flags; + mem->placement = place->flags;spin_lock (&ttm_bo_glob.lru_lock);ttm_bo_del_from_lru(bo);drivers/gpu/drm/ttm/ttm_bo.c +0
-1@@ -1039,8 +1007,7 @@ static bool ttm_bo_places_compat(const structttm_place *places, continue; *new_flags = heap->flags; - if ((*new_flags & mem->placement &
TTM_PL_MASK_CACHING) &&drivers/gpu/drm/ttm/ttm_bo.c +1
-1- (mem->mem_type == heap->mem_type) && + if ((mem->mem_type == heap->mem_type) &&(!(*new_flags & TTM_PL_FLAG_CONTIGUOUS) || (mem->placement & TTM_PL_FLAG_CONTIGUOUS))) return true;drivers/gpu/drm/ttm/ttm_bo.c +0
-3@@ -1094,9 +1061,6 @@ int ttm_bo_validate(struct ttm_buffer_object *bo, ret =ttm_bo_move_buffer (bo, placement, ctx);if (ret)return ret; - }else { - bo->mem.placement &=TTM_PL_MASK_CACHING ; - bo->mem.placement |= new_flags & ~TTM_PL_MASK_CACHING ; }/* * We might need to add a TTM.
drivers/gpu/drm/ttm/ttm_bo.c +1
-1@@ -1164,7 +1128,7 @@ int ttm_bo_init_reserved(struct ttm_bo_device *bdev, bo->mem.bus.offset =0 ; bo->mem.bus.addr =NULL ; bo->moving =NULL ; - bo->mem.placement =TTM_PL_FLAG_CACHED ; + bo->mem.placement =0 ; bo->acc_size = acc_size; bo->pin_count =0 ;bo->sg = sg;drivers/gpu/drm/ttm/ttm_bo.c +1
-1@@ -1512,7 +1476,7 @@ int ttm_bo_swapout(struct ttm_bo_global *glob, struct ttm_operation_ctx *ctx) evict_mem = bo->mem; evict_mem.mm_node =NULL ; - evict_mem.placement =TTM_PL_MASK_CACHING ; + evict_mem.placement =0 ; evict_mem.mem_type =TTM_PL_SYSTEM ;ret = ttm_bo_handle_move_mem(bo,
&evict_mem, true,
&ctx);drivers/gpu/drm/ttm/ttm_bo_util.c +1
-5@@ -72,10 +72,6 @@ int ttm_bo_move_ttm(struct ttm_buffer_object *bo, old_mem->mem_type =TTM_PL_SYSTEM ; } - ret =ttm_tt_set_placement_caching (ttm, new_mem->placement); -if (unlikely (ret !=0 )) -return ret; -if (new_mem->mem_type !=TTM_PL_SYSTEM ) { ret =ttm_tt_populate (bo->bdev, ttm, ctx);@@ -135,7 +131,7 @@ static int ttm_resource_ioremap(struct ttm_bo_device *bdev, }else {size_t bus_size = (size_t )mem->num_pages <<PAGE_SHIFT ; -if (mem->placement &TTM_PL_FLAG_WC ) +if (mem->bus.caching == ttm_write_combined) addr =ioremap_wc (mem->bus.offset, bus_size);else addr = ioremap(mem->bus.offset, bus_size);drivers/gpu/drm/ttm/ttm_bo_util.c +1
-1@@ -427,7 +423,7 @@ static int ttm_bo_ioremap(struct ttm_buffer_object *bo, map->virtual = (void *)(((u8 *)bo->mem.bus.addr) + offset); }else { map->bo_kmap_type = ttm_bo_map_iomap; -if (mem->placement &TTM_PL_FLAG_WC ) +if (mem->bus.caching == ttm_write_combined) map->virtual = ioremap_wc(bo->mem.bus.offset + offset,size); elsedrivers/gpu/drm/ttm/ttm_bo_util.c +1
-1@@ -457,7 +453,7 @@ static int ttm_bo_kmap_ttm(struct ttm_buffer_object *bo, if (ret)return ret; -if (num_pages ==1 && (mem->placement & TTM_PL_FLAG_CACHED)) { +if (num_pages ==1 && ttm->caching == ttm_cached) {/* * We're mapping a single page, and the desired
* page protection is consistent with the bo.drivers/gpu/drm/ttm/ttm_tt.c +0
-29@@ -114,35 +114,6 @@ static int ttm_sg_tt_alloc_page_directory(struct ttm_dma_tt *ttm)return 0 ; } -static int ttm_tt_set_caching (struct ttm_tt *ttm,enum ttm_caching caching) -{ -if (ttm->caching == caching) -return 0 ; - -/* Can't change the caching state after TT is populated */ -if (WARN_ON_ONCE (ttm_tt_is_populated (ttm))) -return -EINVAL ; - - ttm->caching = caching; - -return 0 ; -} - -int ttm_tt_set_placement_caching (struct ttm_tt *ttm,uint32_t placement) -{ -enum ttm_caching state; - -if (placement &TTM_PL_FLAG_WC ) - state = ttm_write_combined; -else if (placement &TTM_PL_FLAG_UNCACHED ) - state = ttm_uncached; -else - state = ttm_cached; - -return ttm_tt_set_caching (ttm, state); -} -EXPORT_SYMBOL (ttm_tt_set_placement_caching); -void
ttm_tt_destroy_common(struct ttm_bo_device *bdev, struct ttm_tt *ttm){ ttm_tt_unpopulate(bdev, ttm);drivers/gpu/drm/vmwgfx/vmwgfx_ttm_buffer.c +15
-15@@ -34,28 +34,28 @@ static const struct ttm_place vram_placement_flags = { .fpfn = 0, .lpfn = 0, .mem_type = TTM_PL_VRAM, - .flags = TTM_PL_FLAG_CACHED + .flags = 0 };static const struct ttm_place sys_placement_flags = { .fpfn =0 , .lpfn =0 , .mem_type =TTM_PL_SYSTEM , - .flags =TTM_PL_FLAG_CACHED + .flags =0 };static const struct ttm_place gmr_placement_flags = { .fpfn =0 , .lpfn =0 , .mem_type =VMW_PL_GMR , - .flags =TTM_PL_FLAG_CACHED + .flags =0 };static const struct ttm_place mob_placement_flags = { .fpfn =0 , .lpfn =0 , .mem_type =VMW_PL_MOB , - .flags =TTM_PL_FLAG_CACHED + .flags =0 };struct ttm_placement vmw_vram_placement = {@@ -70,12 +70,12 @@ static const struct ttm_place vram_gmr_placement_flags[] = { .fpfn =0 , .lpfn =0 , .mem_type =TTM_PL_VRAM , - .flags =TTM_PL_FLAG_CACHED + .flags =0 }, { .fpfn = 0, .lpfn = 0, .mem_type = VMW_PL_GMR, - .flags = TTM_PL_FLAG_CACHED + .flags = 0 } };@@ -84,12 +84,12 @@ static const struct ttm_place gmr_vram_placement_flags[] = { .fpfn =0 , .lpfn =0 , .mem_type =VMW_PL_GMR , - .flags =TTM_PL_FLAG_CACHED + .flags =0 }, { .fpfn = 0, .lpfn = 0, .mem_type = TTM_PL_VRAM, - .flags = TTM_PL_FLAG_CACHED + .flags = 0 } };@@ -119,22 +119,22 @@ static const struct ttm_place evictable_placement_flags[] = { .fpfn = 0, .lpfn = 0, .mem_type = TTM_PL_SYSTEM, - .flags =TTM_PL_FLAG_CACHED + .flags =0 }, { .fpfn = 0, .lpfn = 0, .mem_type = TTM_PL_VRAM, - .flags =TTM_PL_FLAG_CACHED + .flags =0 }, { .fpfn = 0, .lpfn = 0, .mem_type = VMW_PL_GMR, - .flags =TTM_PL_FLAG_CACHED + .flags =0 }, { .fpfn = 0, .lpfn = 0, .mem_type = VMW_PL_MOB, - .flags = TTM_PL_FLAG_CACHED + .flags = 0 } };@@ -143,17 +143,17 @@ static const struct ttm_place nonfixed_placement_flags[] = { .fpfn = 0, .lpfn = 0, .mem_type = TTM_PL_SYSTEM, - .flags =TTM_PL_FLAG_CACHED + .flags =0 }, { .fpfn = 0, .lpfn = 0, .mem_type = VMW_PL_GMR, - .flags =TTM_PL_FLAG_CACHED + .flags =0 }, { .fpfn = 0, .lpfn = 0, .mem_type = VMW_PL_MOB, - .flags = TTM_PL_FLAG_CACHED + .flags = 0 } };include/drm/ttm/ttm_placement.h +0
-7@@ -43,27 +43,13 @@#define TTM_PL_PRIV 3/* -* Other flags that affects data placement. -* TTM_PL_FLAG_CACHED indicates cache-coherent mappings -* if available. -* TTM_PL_FLAG_SHARED means that another application may -* reference the buffer. -* TTM_PL_FLAG_NO_EVICT means that the buffer may never -* be evicted to make room for other buffers. * TTM_PL_FLAG_TOPDOWN requests to be placed from the * top of the memory area, instead of the bottom. */
Quoted 6 lines
include/drm/ttm/ttm_placement.h line 51
Quoted 5 lines
include/drm/ttm/ttm_placement.h +0
-3-#define TTM_PL_FLAG_CACHED (1 << 16) -#define TTM_PL_FLAG_UNCACHED (1 << 17) -#define TTM_PL_FLAG_WC (1 << 18)#define TTM_PL_FLAG_CONTIGUOUS (1 << 19)#define TTM_PL_FLAG_TOPDOWN (1 << 22)Do these bit shifts mean anything anymore?
Nope, want to turn them into fields in the placement or encode them somehow else.
So I didn't bother renumbering them here.
Quoted 6 lines
This series is a nice cleanup. For me it makes the caching mechanism a lot more clear.
If the removal of the
ioremap()(comment above) is ok,:Reviewed-by Michael J. Ruhl <[email protected]>
Thanks,
Christian.
Quoted 36 lines
m
Quoted 33 lines
include/drm/ttm/ttm_placement.h +0
-4-#define TTM_PL_MASK_CACHING (TTM_PL_FLAG_CACHED | \ - TTM_PL_FLAG_UNCACHED | \ - TTM_PL_FLAG_WC) -/** * struct ttm_place * include/drm/ttm/ttm_tt.h +0
-15@@ -164,21 +164,6 @@ void ttm_tt_destroy_common(struct ttm_bo_device*bdev, struct ttm_tt *ttm); * Swap in a previously swap out ttm_tt. */ int ttm_tt_swapin (struct ttm_tt *ttm); - -/** -* ttm_tt_set_placement_caching: -* -* @ttm A struct ttm_tt the backing pages of which will change caching policy. -* @placement: Flag indicating the desired caching policy. -* -* This function will change caching policy of any default kernel mappings of -* the pages backing @ttm. If changing from cached to uncached or -* write-combined, -* all CPU caches will first be flushed to make sure the data of the pages -* hit RAM. This function may be very costly as it involves global TLB -* and cache flushes and potential page splitting / combining. -*/ -int ttm_tt_set_placement_caching (struct ttm_tt *ttm,uint32_t placement);int ttm_tt_swapout (struct ttm_bo_device *bdev,struct ttm_tt *ttm);
Quoted 8 lines
Quoted 8 lines
/**
--
2.17.1_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Ping? Bunch of trivial cleanups and removal of the caching placement flags.
Any comments on this?
Thanks,
Christian.
Am 01.10.20 um 13:28 schrieb Christian König:
Quoted 12 lines
Not used any more.
Signed-off-by Christian König <[email protected]>--- include/drm/ttm/ttm_tt.h | 1 - 1 file changed, 1 deletion(-)include/drm/ttm/ttm_tt.h +0
-0
include/drm/ttm/ttm_tt.h struct ttm_resource; · line 39
Quoted 7 lines
include/drm/ttm/ttm_tt.h +0
-1@@ -34,7 +34,6 @@ struct ttm_resource;struct ttm_buffer_object ;struct ttm_operation_ctx ; -#define TTM_PAGE_FLAG_WRITE (1 << 3)#define TTM_PAGE_FLAG_SWAPPED (1 << 4)#define TTM_PAGE_FLAG_ZERO_ALLOC (1 << 6)#define TTM_PAGE_FLAG_DMA32 (1 << 7)
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 10 lines
-----Original Message-----
From: dri-devel <[email protected]> On Behalf Of Christian König
Sent: Thursday, October 1, 2020 7:28 AM
To: [email protected]; [email protected]; [email protected]; [email protected]
Subject: [PATCH 1/8] drm/ttm: removeTTM_PAGE_FLAG_WRITENot used any more.
m
Quoted 20 lines
Signed-off-by Christian König <[email protected]>---
include/drm/ttm/ttm_tt.h| 1 -1 file changed, 1 deletion(-)include/drm/ttm/ttm_tt.h +0
-2@@ -34,7 +34,6 @@ struct ttm_resource;struct ttm_buffer_object ;struct ttm_operation_ctx ; -#define TTM_PAGE_FLAG_WRITE (1 << 3)#define TTM_PAGE_FLAG_SWAPPED (1 << 4)#define TTM_PAGE_FLAG_ZERO_ALLOC (1 << 6)#define TTM_PAGE_FLAG_DMA32 (1 << 7) --2.17.1
Quoted 4 lines
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel