From: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
To: linux-kernel@vger.kernel.org, thellstrom@vmware.com,
thomas@shipmail.org, airlied@redhat.com, jglisse@redhat.com,
bskeggs@redhat.com
Cc: xen-devel@lists.xensource.com,
Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Subject: [PATCH 06/11] ttm/driver: Expand ttm_backend_func to include two overrides for TTM page pool.
Date: Tue, 1 Nov 2011 14:47:27 -0400 [thread overview]
Message-ID: <1320173252-2812-7-git-send-email-konrad.wilk@oracle.com> (raw)
In-Reply-To: <1320173252-2812-1-git-send-email-konrad.wilk@oracle.com>
The two overrides will be choosen by the backends whether they
want to use a different TTM page pool than the default.
If the backend does not choose a new override, the default one
will be used.
Reviewed-by: Jerome Glisse <jglisse@redhat.com>
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
---
drivers/gpu/drm/ttm/ttm_page_alloc.c | 10 +++++++---
include/drm/ttm/ttm_bo_driver.h | 31 +++++++++++++++++++++++++++++++
2 files changed, 38 insertions(+), 3 deletions(-)
diff --git a/drivers/gpu/drm/ttm/ttm_page_alloc.c b/drivers/gpu/drm/ttm/ttm_page_alloc.c
index 24c0340..360afb3 100644
--- a/drivers/gpu/drm/ttm/ttm_page_alloc.c
+++ b/drivers/gpu/drm/ttm/ttm_page_alloc.c
@@ -861,13 +861,17 @@ EXPORT_SYMBOL(ttm_page_alloc_debugfs);
int ttm_get_pages(struct ttm_tt *ttm, struct list_head *pages,
unsigned count, dma_addr_t *dma_address)
{
+ if (ttm->be && ttm->be->func && ttm->be->func->get_pages)
+ return ttm->be->func->get_pages(ttm, pages, count, dma_address);
return __ttm_get_pages(pages, ttm->page_flags, ttm->caching_state,
count, dma_address);
}
-{
void ttm_put_pages(struct ttm_tt *ttm, struct list_head *pages,
unsigned page_count, dma_addr_t *dma_address)
{
- __ttm_put_pages(pages, page_count, ttm->page_flags, ttm->caching_state,
- dma_address);
+ if (ttm->be && ttm->be->func && ttm->be->func->put_pages)
+ ttm->be->func->put_pages(ttm, pages, page_count, dma_address);
+ else
+ __ttm_put_pages(pages, page_count, ttm->page_flags,
+ ttm->caching_state, dma_address);
}
diff --git a/include/drm/ttm/ttm_bo_driver.h b/include/drm/ttm/ttm_bo_driver.h
index 09af2d7..1826c3b 100644
--- a/include/drm/ttm/ttm_bo_driver.h
+++ b/include/drm/ttm/ttm_bo_driver.h
@@ -100,6 +100,34 @@ struct ttm_backend_func {
* Destroy the backend.
*/
void (*destroy) (struct ttm_backend *backend);
+
+ /**
+ * ttm_get_pages override. The backend can override the default
+ * TTM page pool code with a different one.
+ *
+ * Get count number of pages from pool to pages list.
+ *
+ * @ttm: ttm which contains flags for page allocation and caching state.
+ * @pages: head of empty linked list where pages are filled.
+ * @dma_address: The DMA (bus) address of pages
+ */
+ int (*get_pages) (struct ttm_tt *ttm, struct list_head *pages,
+ unsigned count, dma_addr_t *dma_address);
+
+ /**
+ * ttm_put_pages override. The backend can override the default
+ * TTM page pool code with a different implementation.
+ *
+ * Put linked list of pages to pool.
+ *
+ * @ttm: ttm which contains flags for page allocation and caching state.
+ * @pages: list of pages to free.
+ * @page_count: number of pages in the list. Zero can be passed for
+ * unknown count.
+ * @dma_address: The DMA (bus) address of pages
+ */
+ void (*put_pages) (struct ttm_tt *ttm, struct list_head *pages,
+ unsigned page_count, dma_addr_t *dma_address);
};
/**
@@ -109,6 +137,8 @@ struct ttm_backend_func {
* @flags: For driver use.
* @func: Pointer to a struct ttm_backend_func that describes
* the backend methods.
+ * @dev: Pointer to a struct device which can be used by the TTM
+ * [get|put)_pages overrides in 'struct ttm_backend_func'.
*
*/
@@ -116,6 +146,7 @@ struct ttm_backend {
struct ttm_bo_device *bdev;
uint32_t flags;
struct ttm_backend_func *func;
+ struct device *dev;
};
#define TTM_PAGE_FLAG_USER (1 << 1)
--
1.7.6.4
next prev parent reply other threads:[~2011-11-01 19:03 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-11-01 18:47 [PATCH] TTM DMA pool v2.2 or [GIT PULL] (stable/ttm.dma_pool.v2.3) for 3.3 Konrad Rzeszutek Wilk
2011-11-01 18:47 ` [PATCH 01/11] swiotlb: Expose swiotlb_nr_tlb function to modules Konrad Rzeszutek Wilk
2011-11-01 18:47 ` [PATCH 02/11] nouveau/radeon: Set coherent DMA mask Konrad Rzeszutek Wilk
2011-11-01 18:47 ` [PATCH 03/11] ttm/radeon/nouveau: Check the DMA address from TTM against known value Konrad Rzeszutek Wilk
2011-11-01 18:47 ` [PATCH 04/11] ttm: Wrap ttm_[put|get]_pages and extract GFP_* and caching states from 'struct ttm_tt' Konrad Rzeszutek Wilk
2011-11-01 18:47 ` [PATCH 05/11] ttm: Get rid of temporary scaffolding Konrad Rzeszutek Wilk
2011-11-01 18:47 ` Konrad Rzeszutek Wilk [this message]
2011-11-01 18:47 ` [PATCH 07/11] ttm: Do not set the ttm->be to NULL before calling the TTM page pool to free pages Konrad Rzeszutek Wilk
2011-11-01 18:47 ` [PATCH 08/11] ttm: Provide DMA aware TTM page pool code Konrad Rzeszutek Wilk
2011-11-01 18:47 ` [PATCH 09/11] ttm: Add 'no_dma' parameter to turn the TTM DMA pool off during runtime Konrad Rzeszutek Wilk
2011-11-01 18:47 ` [PATCH 10/11] nouveau/ttm/dma: Enable the TTM DMA pool if device can only do 32-bit DMA Konrad Rzeszutek Wilk
2011-11-01 18:47 ` [PATCH 11/11] radeon/ttm/dma: Enable the TTM DMA pool if the device can only do 32-bit Konrad Rzeszutek Wilk
2011-11-04 18:31 ` [PATCH] TTM DMA pool v2.2 or [GIT PULL] (stable/ttm.dma_pool.v2.3) for 3.3 Jerome Glisse
2011-11-04 18:44 ` Konrad Rzeszutek Wilk
2011-11-04 19:24 ` Jerome Glisse
2011-11-04 19:41 ` Konrad Rzeszutek Wilk
2011-11-04 20:54 ` Jerome Glisse
2011-11-04 21:08 ` Konrad Rzeszutek Wilk
-- strict thread matches above, loose matches on Subject: below --
2011-10-19 22:19 [PATCH] TTM DMA pool v2.1 Konrad Rzeszutek Wilk
2011-10-19 22:19 ` [PATCH 06/11] ttm/driver: Expand ttm_backend_func to include two overrides for TTM page pool Konrad Rzeszutek Wilk
2011-10-22 9:40 ` Thomas Hellstrom
2011-10-24 17:27 ` Konrad Rzeszutek Wilk
2011-10-24 17:42 ` Thomas Hellstrom
2011-10-24 18:18 ` Konrad Rzeszutek Wilk
2011-11-01 14:37 ` Jerome Glisse
2011-11-01 14:48 ` Thomas Hellstrom
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1320173252-2812-7-git-send-email-konrad.wilk@oracle.com \
--to=konrad.wilk@oracle.com \
--cc=airlied@redhat.com \
--cc=bskeggs@redhat.com \
--cc=jglisse@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=thellstrom@vmware.com \
--cc=thomas@shipmail.org \
--cc=xen-devel@lists.xensource.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®