Skip to contentSkip to conversation

drm: Document drm_cache interface

PATCH Superseded Gabriel Krisman Bertazi 3 participants 5 messages Jan 2, 2017 – Jan 4, 2017

Subsystems (3)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 drm: Document drm_cache interface

---
 drivers/gpu/drm/drm_cache.c | 23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)
drivers/gpu/drm/drm_cache.c +23 -0
index a7916e5f8864..b52e16e2b8ef 100644
@@ -67,6 +67,14 @@ static void drm_cache_flush_clflush(struct page *pages[],
 }
 #endif
 
+/**
+ * drm_clflush_pages - Flush dcache lines of a set of pages
+ * @pages - struct page array
+ * @num_pages - Number of pages in the array
+ *
+ * Flush every data cache line entry that points to an address belonging
+ * to a page in the array.
+ */
 void
 drm_clflush_pages(struct page *pages[], unsigned long num_pages)
 {
@@ -101,6 +109,13 @@ drm_clflush_pages(struct page *pages[], unsigned long num_pages)
 }
 EXPORT_SYMBOL(drm_clflush_pages);
 
+/**
+ * drm_clflush_sg - Flush dcache lines pointing to a scather-gather
+ * @st - struct sg_table
+ *
+ * Flush every data cache line entry that points to an address in the
+ * sg.
+ */
 void
 drm_clflush_sg(struct sg_table *st)
 {
@@ -125,6 +140,14 @@ drm_clflush_sg(struct sg_table *st)
 }
 EXPORT_SYMBOL(drm_clflush_sg);
 
+/**
+ * drm_clflush_virt_range - Flush dcache lines of a region
+ * @addr - Initial memory address
+ * @length - Region size
+ *
+ * Flush every data cache line entry that points to an address in the
+ * region requested.
+ */
 void
 drm_clflush_virt_range(void *addr, unsigned long length)
 {
Signature · 6 lines
2.11.0

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#1 lore raw

PATCH 2/2 drm: Move drm_clflush prototypes to drm_cache header file

Continue to clean up drmP.h by moving the cache flushing functions into it's own header file.

---
 drivers/gpu/drm/i915/i915_drv.h | 1 +
 drivers/gpu/drm/vgem/vgem_drv.h | 1 +
 include/drm/drmP.h              | 5 -----
 include/drm/drm_cache.h         | 4 ++++
 4 files changed, 6 insertions(+), 5 deletions(-)
drivers/gpu/drm/i915/i915_drv.h +1 -0
index 89dbe55077f5..7143f28b5cf1 100644
@@ -49,6 +49,7 @@
 #include <drm/drm_legacy.h> /* for struct drm_dma_handle */
 #include <drm/drm_gem.h>
 #include <drm/drm_auth.h>
+#include <drm/drm_cache.h>
 
 #include "i915_params.h"
 #include "i915_reg.h"
drivers/gpu/drm/vgem/vgem_drv.h +1 -0
index 1f8798ad329c..cb59c7ab98b9 100644
@@ -31,6 +31,7 @@
 
 #include <drm/drmP.h>
 #include <drm/drm_gem.h>
+#include <drm/drm_cache.h>
 
 #include <uapi/drm/vgem_drm.h>
 
include/drm/drmP.h +0 -5
index 8671ddd256fc..6d5c06bf2db1 100644
@@ -730,11 +730,6 @@ int drm_noop(struct drm_device *dev, void *data,
 int drm_invalid_op(struct drm_device *dev, void *data,
 		   struct drm_file *file_priv);
 
-/* Cache management (drm_cache.c) */
-void drm_clflush_pages(struct page *pages[], unsigned long num_pages);
-void drm_clflush_sg(struct sg_table *st);
-void drm_clflush_virt_range(void *addr, unsigned long length);
-
 /*
  * These are exported to drivers so that they can implement fencing using
  * DMA quiscent + idle. DMA quiescent usually requires the hardware lock.
include/drm/drm_cache.h +4 -0
index cebecff536a3..beab0f0d0cfb 100644
@@ -33,7 +33,11 @@
 #ifndef _DRM_CACHE_H_
 #define _DRM_CACHE_H_
 
+#include <linux/scatterlist.h>
+
 void drm_clflush_pages(struct page *pages[], unsigned long num_pages);
+void drm_clflush_sg(struct sg_table *st);
+void drm_clflush_virt_range(void *addr, unsigned long length);
 
 static inline bool drm_arch_can_wc_memory(void)
 {
Signature · 6 lines
2.11.0

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#2 lore raw
In reply to Gabriel Krisman Bertazi
Quoted 3 lines · Gabriel Krisman Bertazi
---
 drivers/gpu/drm/drm_cache.c | 23 +++++++++++++++++++++++

When adding docs, please also add a kernel-doc stanza (good place would be a new chapter in Documentation/gpu/drm-mm.rst I think) to pull it all in. Otherwise it's not built, which means not checked by 0day, which means will get out of data. Also, you can't find it when browsing the html docs ;-)

Otherwise looks pretty, thanks for the patch. One nit below. -Daniel

Quoted 36 lines
 1 file changed, 23 insertions(+)
drivers/gpu/drm/drm_cache.c +15 -0
index a7916e5f8864..b52e16e2b8ef 100644
@@ -67,6 +67,14 @@ static void drm_cache_flush_clflush(struct page *pages[],
 }
 #endif
 
+/**
+ * drm_clflush_pages - Flush dcache lines of a set of pages
+ * @pages - struct page array
+ * @num_pages - Number of pages in the array
+ *
+ * Flush every data cache line entry that points to an address belonging
+ * to a page in the array.
+ */
 void
 drm_clflush_pages(struct page *pages[], unsigned long num_pages)
 {
@@ -101,6 +109,13 @@ drm_clflush_pages(struct page *pages[], unsigned long num_pages)
 }
 EXPORT_SYMBOL(drm_clflush_pages);
 
+/**
+ * drm_clflush_sg - Flush dcache lines pointing to a scather-gather
+ * @st - struct sg_table
+ *
+ * Flush every data cache line entry that points to an address in the
+ * sg.
+ */
 void
 drm_clflush_sg(struct sg_table *st)
 {

drivers/gpu/drm/drm_cache.c drm_clflush_sg(struct sg_table *st) · line 145

Quoted 6 lines
drivers/gpu/drm/drm_cache.c +3 -0
@@ -125,6 +140,14 @@ drm_clflush_sg(struct sg_table *st)
 }
 EXPORT_SYMBOL(drm_clflush_sg);
 
+/**
+ * drm_clflush_virt_range - Flush dcache lines of a region
+ * @addr - Initial memory address

s/memory/kernel memory/ is clearer I think.

Quoted 15 lines
drivers/gpu/drm/drm_cache.c +5 -0
+ * @length - Region size
+ *
+ * Flush every data cache line entry that points to an address in the
+ * region requested.
+ */
 void
 drm_clflush_virt_range(void *addr, unsigned long length)
 {
Signature · 6 lines
2.11.0

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Signature · 7 lines
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#3 lore raw
Quoted 10 lines · Daniel Vetter
Quoted 3 lines · Gabriel Krisman Bertazi
---
 drivers/gpu/drm/drm_cache.c | 23 +++++++++++++++++++++++

When adding docs, please also add a kernel-doc stanza (good place would be a new chapter in Documentation/gpu/drm-mm.rst I think) to pull it all in. Otherwise it's not built, which means not checked by 0day, which means will get out of data. Also, you can't find it when browsing the html docs ;-)

How close are we to having the spine of the kernelbook described in Documentation/ and the indiviual chapter.rst next to the source in drivers/gpu/drm/ etc? Something like:
Documentation/gpu/drm.rst: include drivers/gpu/drm/*.rst ?
-Chris

Signature · 5 lines
Chris Wilson, Intel Open Source Technology Centre
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#4 lore raw
Quoted 12 lines · Chris Wilson
Quoted 10 lines · Daniel Vetter
Quoted 3 lines · Gabriel Krisman Bertazi
---
 drivers/gpu/drm/drm_cache.c | 23 +++++++++++++++++++++++

When adding docs, please also add a kernel-doc stanza (good place would be a new chapter in Documentation/gpu/drm-mm.rst I think) to pull it all in. Otherwise it's not built, which means not checked by 0day, which means will get out of data. Also, you can't find it when browsing the html docs ;-)

Quoted 4 lines

How close are we to having the spine of the kernelbook described in Documentation/ and the indiviual chapter.rst next to the source in drivers/gpu/drm/ etc? Something like:
Documentation/gpu/drm.rst: include drivers/gpu/drm/*.rst ?

Hm, not sure we ever discussed this ... Adding linux-doc. But pre-coffee, sounds like an intriguing idea at least.
-Daniel

Signature · 7 lines
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel