From: Dave Airlie <airlied-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
To: dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org,
amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org,
dan.j.williams-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org
Cc: shawn.starr-bJEeYj9oJeDQT0dZR+AlfA@public.gmane.org
Subject: [PATCH 2/3] drm/ttm: add API to reserve/free WC memory.
Date: Tue, 18 Oct 2016 16:13:12 +1000 [thread overview]
Message-ID: <1476771193-2759-3-git-send-email-airlied@gmail.com> (raw)
In-Reply-To: <1476771193-2759-1-git-send-email-airlied-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
From: Dave Airlie <airlied@redhat.com>
These will be used by drivers to reserve/free WC memory in the
PAT tracking tables, for VRAM BARs.
Signed-off-by: Dave Airlie <airlied@redhat.com>
---
drivers/gpu/drm/ttm/ttm_bo_util.c | 24 ++++++++++++++++++++++++
include/drm/ttm/ttm_bo_driver.h | 2 ++
2 files changed, 26 insertions(+)
diff --git a/drivers/gpu/drm/ttm/ttm_bo_util.c b/drivers/gpu/drm/ttm/ttm_bo_util.c
index bf6e216..192c003 100644
--- a/drivers/gpu/drm/ttm/ttm_bo_util.c
+++ b/drivers/gpu/drm/ttm/ttm_bo_util.c
@@ -39,6 +39,13 @@
#include <linux/module.h>
#include <linux/reservation.h>
+#ifdef CONFIG_X86
+#include <asm/pat.h>
+#else
+#define io_reserve_memtype(start, end, pcm) (0)
+#define io_free_memtype(start, end)
+#endif
+
void ttm_bo_free_old_node(struct ttm_buffer_object *bo)
{
ttm_bo_mem_put(bo, &bo->mem);
@@ -796,3 +803,20 @@ int ttm_bo_pipeline_move(struct ttm_buffer_object *bo,
return 0;
}
EXPORT_SYMBOL(ttm_bo_pipeline_move);
+
+int ttm_io_reserve_memtype_wc(resource_size_t start, resource_size_t end)
+{
+ enum page_cache_mode pcm = _PAGE_CACHE_MODE_WC;
+ int ret;
+ ret = io_reserve_memtype(start, end, &pcm);
+ if (ret)
+ return ret;
+ return 0;
+}
+EXPORT_SYMBOL(ttm_io_reserve_memtype_wc);
+
+void ttm_io_free_memtype(resource_size_t start, resource_size_t end)
+{
+ io_free_memtype(start, end);
+}
+EXPORT_SYMBOL(ttm_io_free_memtype);
diff --git a/include/drm/ttm/ttm_bo_driver.h b/include/drm/ttm/ttm_bo_driver.h
index 4f0a921..6b2d24e 100644
--- a/include/drm/ttm/ttm_bo_driver.h
+++ b/include/drm/ttm/ttm_bo_driver.h
@@ -1054,6 +1054,8 @@ int ttm_bo_pipeline_move(struct ttm_buffer_object *bo,
*/
extern pgprot_t ttm_io_prot(uint32_t caching_flags, pgprot_t tmp);
+int ttm_io_reserve_memtype_wc(resource_size_t start, resource_size_t end);
+void ttm_io_free_memtype(resource_size_t start, resource_size_t end);
extern const struct ttm_mem_type_manager_func ttm_bo_manager_func;
#if IS_ENABLED(CONFIG_AGP)
--
2.5.5
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
next prev parent reply other threads:[~2016-10-18 6:13 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-10-18 6:13 [rfc] fix for regression in pat memory tracking in 4.9-rc1 Dave Airlie
2016-10-18 6:13 ` [PATCH 1/3] x86/pat: export io memory reserve/free api Dave Airlie
[not found] ` <1476771193-2759-2-git-send-email-airlied-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2016-10-18 7:22 ` Edward O'Callaghan
[not found] ` <d5dcf484-d760-8fe6-bc00-4d6db3ef9d05-dczkZgxz+BNUPWh3PAxdjQ@public.gmane.org>
2016-10-18 8:29 ` Dave Airlie
[not found] ` <CAPM=9tx2iBaHt-bg_WjUHE3wPprs2GvNt1LZNLngF-GLH2U_Zw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2016-10-18 12:31 ` Edward O'Callaghan
2016-10-22 22:15 ` Shawn Starr
[not found] ` <1476771193-2759-1-git-send-email-airlied-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2016-10-18 6:13 ` Dave Airlie [this message]
2016-10-18 6:13 ` [PATCH 3/3] amdgpu: reserve VRAM ranges in PAT memtype tables Dave Airlie
2016-10-18 7:51 ` [rfc] fix for regression in pat memory tracking in 4.9-rc1 Daniel Vetter
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=1476771193-2759-3-git-send-email-airlied@gmail.com \
--to=airlied-re5jqeeqqe8avxtiumwx3w@public.gmane.org \
--cc=amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org \
--cc=dan.j.williams-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org \
--cc=dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org \
--cc=shawn.starr-bJEeYj9oJeDQT0dZR+AlfA@public.gmane.org \
/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