Skip to contentSkip to conversation

drm: add helper to check for wc memory support

PATCH In review Oded Gabbay 4 participants 12 messages Jan 30, 2016 – Feb 3, 2016

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/3 drm: add helper to check for wc memory support

From: Dave Airlie <[email protected]>

---
 include/drm/drm_cache.h | 9 +++++++++
 1 file changed, 9 insertions(+)
include/drm/drm_cache.h +9 -0
index 7bfb063..461a055 100644
@@ -35,4 +35,13 @@
 
 void drm_clflush_pages(struct page *pages[], unsigned long num_pages);
 
+static inline bool drm_arch_can_wc_memory(void)
+{
+#if defined(CONFIG_PPC) && !defined(CONFIG_NOT_COHERENT_CACHE)
+	return false;
+#else
+	return true;
+#endif
+}
+
 #endif
Signature · 6 lines
2.5.0

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

PATCH 2/3 drm/radeon: mask out WC from BO on unsupported arches

---
 drivers/gpu/drm/radeon/radeon_object.c | 8 ++++++++
 1 file changed, 8 insertions(+)
drivers/gpu/drm/radeon/radeon_object.c +8 -0
index 84d4563..255faf6 100644
@@ -33,6 +33,7 @@
 #include <linux/slab.h>
 #include <drm/drmP.h>
 #include <drm/radeon_drm.h>
+#include <drm/drm_cache.h>
 #include "radeon.h"
 #include "radeon_trace.h"
 
@@ -245,6 +246,13 @@ int radeon_bo_create(struct radeon_device *rdev,
 		DRM_INFO_ONCE("Please enable CONFIG_MTRR and CONFIG_X86_PAT for "
 			      "better performance thanks to write-combining\n");
 	bo->flags &= ~(RADEON_GEM_GTT_WC | RADEON_GEM_GTT_UC);
+#else
+	/*
+	 * For architectures that don't support WC memory,
+	 * mask out the WC flag from the BO
+	 */
+	if (!drm_arch_can_wc_memory())
+		bo->flags &= ~RADEON_GEM_GTT_WC;
 #endif
 
 	radeon_ttm_placement_from_domain(bo, domain);
Signature · 6 lines
2.5.0

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
Reviewed-by on v1 2/3
#2 lore raw

Re: [PATCH 2/3] drm/radeon: mask out WC from BO on unsupported arches

Quoted 19 lines · Oded Gabbay
---
 drivers/gpu/drm/radeon/radeon_object.c | 8 ++++++++
 1 file changed, 8 insertions(+)
drivers/gpu/drm/radeon/radeon_object.c +1 -0
index 84d4563..255faf6 100644
@@ -33,6 +33,7 @@
 #include <linux/slab.h>
 #include <drm/drmP.h>
 #include <drm/radeon_drm.h>
+#include <drm/drm_cache.h>
 #include "radeon.h"
 #include "radeon_trace.h"
 
@@ -245,6 +246,13 @@ int radeon_bo_create(struct radeon_device *rdev,
 		DRM_INFO_ONCE("Please enable CONFIG_MTRR and CONFIG_X86_PAT for "

drivers/gpu/drm/radeon/radeon_object.c int radeon_bo_create(struct radeon_device *rdev, · line 256

Quoted 10 lines
drivers/gpu/drm/radeon/radeon_object.c +7 -0
 			      "better performance thanks to write-combining\n");
 	bo->flags &= ~(RADEON_GEM_GTT_WC | RADEON_GEM_GTT_UC);
+#else
+	/*
+	 * For architectures that don't support WC memory,
+	 * mask out the WC flag from the BO
+	 */
+	if (!drm_arch_can_wc_memory())
+		bo->flags &= ~RADEON_GEM_GTT_WC;
 #endif

For consistency with existing multi-line comments, please start the comment on the opening line:

	/* For architectures that don't support WC memory,
	 * mask out the WC flag from the BO
	 */

With that fixed (in patch 3 as well), the series is

Signature · 6 lines
Earthling Michel Dänzer               |               http://www.amd.com
Libre software enthusiast             |             Mesa and X developer
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
#3 lore raw

Re: [PATCH 2/3] drm/radeon: mask out WC from BO on unsupported arches

Quoted 38 lines · Michel Dänzer
Quoted 19 lines · Oded Gabbay
---
 drivers/gpu/drm/radeon/radeon_object.c | 8 ++++++++
 1 file changed, 8 insertions(+)
drivers/gpu/drm/radeon/radeon_object.c +1 -0
index 84d4563..255faf6 100644
@@ -33,6 +33,7 @@
 #include <linux/slab.h>
 #include <drm/drmP.h>
 #include <drm/radeon_drm.h>
+#include <drm/drm_cache.h>
 #include "radeon.h"
 #include "radeon_trace.h"
 
@@ -245,6 +246,13 @@ int radeon_bo_create(struct radeon_device *rdev,
              DRM_INFO_ONCE("Please enable CONFIG_MTRR and CONFIG_X86_PAT for "

drivers/gpu/drm/radeon/radeon_object.c int radeon_bo_create(struct radeon_device *rdev, · line 256

Quoted 10 lines
drivers/gpu/drm/radeon/radeon_object.c +7 -0
                            "better performance thanks to write-combining\n");
      bo->flags &= ~(RADEON_GEM_GTT_WC | RADEON_GEM_GTT_UC);
+#else
+     /*
+      * For architectures that don't support WC memory,
+      * mask out the WC flag from the BO
+      */
+     if (!drm_arch_can_wc_memory())
+             bo->flags &= ~RADEON_GEM_GTT_WC;
 #endif

For consistency with existing multi-line comments, please start the comment on the opening line:

        /* For architectures that don't support WC memory,
         * mask out the WC flag from the BO
         */
Quoted 8 lines

With that fixed (in patch 3 as well), the series is

--
Earthling Michel Dänzer | http://www.amd.com
Libre software enthusiast | Mesa and X developer

Kernel coding style says differently...
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel

#4 lore raw

PATCH 3/3 drm/amdgpu: mask out WC from BO on unsupported arches

In reply to Oded Gabbay
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | 9 +++++++++
 1 file changed, 9 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_object.c +9 -0
index c3ce103..7b963e6 100644
@@ -33,6 +33,7 @@
 #include <linux/slab.h>
 #include <drm/drmP.h>
 #include <drm/amdgpu_drm.h>
+#include <drm/drm_cache.h>
 #include "amdgpu.h"
 #include "amdgpu_trace.h"
 
@@ -261,6 +262,14 @@ int amdgpu_bo_create_restricted(struct amdgpu_device *adev,
 				       AMDGPU_GEM_DOMAIN_OA);
 
 	bo->flags = flags;
+
+	/*
+	 * For architectures that don't support WC memory,
+	 * mask out the WC flag from the BO
+	 */
+	if (!drm_arch_can_wc_memory())
+		bo->flags &= ~AMDGPU_GEM_CREATE_CPU_GTT_USWC;
+
 	amdgpu_fill_placement_to_bo(bo, placement);
 	/* Kernel allocation are uninterruptible */
 	r = ttm_bo_init(&adev->mman.bdev, &bo->tbo, size, type,
Signature · 6 lines
2.5.0

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
#5 lore raw
In reply to Oded Gabbay

Am 30.01.2016 um 06:59 schrieb Oded Gabbay:

Quoted 4 lines

From: Dave Airlie <[email protected]>

With the minor issues Michel noted fixed this series is Reviewed-by: Christian König <[email protected]> as well.

Quoted 12 lines
---
  include/drm/drm_cache.h | 9 +++++++++
  1 file changed, 9 insertions(+)
include/drm/drm_cache.h +0 -0
index 7bfb063..461a055 100644
@@ -35,4 +35,13 @@
 
  void drm_clflush_pages(struct page *pages[], unsigned long num_pages);
 

include/drm/drm_cache.h line 47

Quoted 10 lines
include/drm/drm_cache.h +9 -0
+static inline bool drm_arch_can_wc_memory(void)
+{
+#if defined(CONFIG_PPC) && !defined(CONFIG_NOT_COHERENT_CACHE)
+	return false;
+#else
+	return true;
+#endif
+}
+
  #endif

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel

#6 lore raw
Quoted 10 lines · Christian König

Am 30.01.2016 um 06:59 schrieb Oded Gabbay:

Quoted 5 lines

From: Dave Airlie <[email protected]>

With the minor issues Michel noted fixed this series is Reviewed-by:
Christian König <[email protected]> as well.

Applied with the comments fixed up. Thanks!

Alex

Quoted 6 lines
Quoted 6 lines

---
  include/drm/drm_cache.h | 9 +++++++++
  1 file changed, 9 insertions(+)
Quoted 18 lines
Quoted 6 lines
include/drm/drm_cache.h +0 -0
index 7bfb063..461a055 100644
@@ -35,4 +35,13 @@
    void drm_clflush_pages(struct page *pages[], unsigned long num_pages);

include/drm/drm_cache.h line 45

Quoted 10 lines
include/drm/drm_cache.h +8 -0
  +static inline bool drm_arch_can_wc_memory(void)
+{
+#if defined(CONFIG_PPC) && !defined(CONFIG_NOT_COHERENT_CACHE)
+       return false;
+#else
+       return true;
+#endif
+}
+
  #endif

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel

#7 lore raw
Quoted 11 lines · Alex Deucher
Quoted 8 lines · Christian König

Am 30.01.2016 um 06:59 schrieb Oded Gabbay:

Quoted 5 lines

From: Dave Airlie <[email protected]>

Quoted 7 lines
Quoted 2 lines

With the minor issues Michel noted fixed this series is Reviewed-by:
Christian König <[email protected]> as well.

Applied with the comments fixed up. Thanks!

Alex

Hi Alex,
Could you please add stable tag ? I forgot to add them. Thanks,

Oded

Quoted 17 lines
Quoted 17 lines
Quoted 17 lines


---
  include/drm/drm_cache.h | 9 +++++++++
  1 file changed, 9 insertions(+)
include/drm/drm_cache.h +3 -0
index 7bfb063..461a055 100644
@@ -35,4 +35,13 @@
    void drm_clflush_pages(struct page *pages[], unsigned long num_pages);
  +static inline bool drm_arch_can_wc_memory(void)
+{
+#if defined(CONFIG_PPC) && !defined(CONFIG_NOT_COHERENT_CACHE)
+       return false;
Quoted 8 lines
Quoted 8 lines

include/drm/drm_cache.h line 47

Quoted 6 lines
include/drm/drm_cache.h +5 -0
+#else
+       return true;
+#endif
+}
+
  #endif

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel

#8 lore raw
Quoted 15 lines · Oded Gabbay
Quoted 14 lines · Alex Deucher
Quoted 10 lines · Christian König

Am 30.01.2016 um 06:59 schrieb Oded Gabbay:

Quoted 5 lines

From: Dave Airlie <[email protected]>

With the minor issues Michel noted fixed this series is Reviewed-by:
Christian König <[email protected]> as well.

Quoted 7 lines
Quoted 4 lines

Applied with the comments fixed up. Thanks!

Alex

Hi Alex,
Could you please add stable tag ? I forgot to add them.

Will do.

Alex

Quoted 30 lines

Thanks,

Oded

Quoted 25 lines
Quoted 25 lines
Quoted 23 lines


---
  include/drm/drm_cache.h | 9 +++++++++
  1 file changed, 9 insertions(+)
include/drm/drm_cache.h +8 -0
index 7bfb063..461a055 100644
@@ -35,4 +35,13 @@
    void drm_clflush_pages(struct page *pages[], unsigned long num_pages);
  +static inline bool drm_arch_can_wc_memory(void)
+{
+#if defined(CONFIG_PPC) && !defined(CONFIG_NOT_COHERENT_CACHE)
+       return false;
+#else
+       return true;
+#endif
+}
+
  #endif

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel

#9 lore raw
Quoted 21 lines · Alex Deucher
Quoted 20 lines · Oded Gabbay
Quoted 18 lines · Alex Deucher
Quoted 10 lines · Christian König

Am 30.01.2016 um 06:59 schrieb Oded Gabbay:

Quoted 5 lines

From: Dave Airlie <[email protected]>

With the minor issues Michel noted fixed this series is Reviewed-by:
Christian König <[email protected]> as well.

Applied with the comments fixed up. Thanks!

Alex

Quoted 6 lines
Quoted 2 lines

Hi Alex,
Could you please add stable tag ? I forgot to add them.

Will do.

Alex

Thanks.

Alex,
I saw you put the patches into your drm-next-4.6. As these are fixes, any chance you could instead put them to drm-fixes-4.5 ? for -rc3/4 ?

Oded

Quoted 23 lines
Quoted 23 lines

Thanks,

Oded

Quoted 17 lines
Quoted 17 lines
Quoted 17 lines


---
  include/drm/drm_cache.h | 9 +++++++++
  1 file changed, 9 insertions(+)
include/drm/drm_cache.h +3 -0
index 7bfb063..461a055 100644
@@ -35,4 +35,13 @@
    void drm_clflush_pages(struct page *pages[], unsigned long num_pages);
  +static inline bool drm_arch_can_wc_memory(void)
+{
+#if defined(CONFIG_PPC) && !defined(CONFIG_NOT_COHERENT_CACHE)
+       return false;
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

include/drm/drm_cache.h line 47

Quoted 6 lines
include/drm/drm_cache.h +5 -0
+#else
+       return true;
+#endif
+}
+
  #endif

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel

#10 lore raw
Quoted 27 lines · Oded Gabbay
Quoted 26 lines · Alex Deucher
Quoted 15 lines · Oded Gabbay
Quoted 14 lines · Alex Deucher
Quoted 10 lines · Christian König

Am 30.01.2016 um 06:59 schrieb Oded Gabbay:

Quoted 5 lines

From: Dave Airlie <[email protected]>

With the minor issues Michel noted fixed this series is Reviewed-by:
Christian König <[email protected]> as well.

Quoted 7 lines
Quoted 4 lines

Applied with the comments fixed up. Thanks!

Alex

Hi Alex,
Could you please add stable tag ? I forgot to add them.

Will do.

Quoted 8 lines
Quoted 1 line

Alex

Thanks.

Alex,
I saw you put the patches into your drm-next-4.6. As these are fixes, any chance you could instead put them to drm-fixes-4.5 ? for -rc3/4 ?

They'll be in my -fixes pull this week. I put them in my 4.6-wip tree for additional testing.

Alex

Quoted 34 lines

Oded

Quoted 31 lines
Quoted 31 lines

Thanks,

Oded

Quoted 25 lines
Quoted 25 lines
Quoted 23 lines


---
  include/drm/drm_cache.h | 9 +++++++++
  1 file changed, 9 insertions(+)
include/drm/drm_cache.h +8 -0
index 7bfb063..461a055 100644
@@ -35,4 +35,13 @@
    void drm_clflush_pages(struct page *pages[], unsigned long num_pages);
  +static inline bool drm_arch_can_wc_memory(void)
+{
+#if defined(CONFIG_PPC) && !defined(CONFIG_NOT_COHERENT_CACHE)
+       return false;
+#else
+       return true;
+#endif
+}
+
  #endif

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel

#11 lore raw
Quoted 37 lines · Alex Deucher
Quoted 27 lines · Oded Gabbay
Quoted 26 lines · Alex Deucher
Quoted 15 lines · Oded Gabbay
Quoted 14 lines · Alex Deucher
Quoted 10 lines · Christian König

Am 30.01.2016 um 06:59 schrieb Oded Gabbay:

Quoted 5 lines

From: Dave Airlie <[email protected]>

With the minor issues Michel noted fixed this series is Reviewed-by:
Christian König <[email protected]> as well.

Quoted 7 lines
Quoted 4 lines

Applied with the comments fixed up. Thanks!

Alex

Hi Alex,
Could you please add stable tag ? I forgot to add them.

Will do.

Quoted 8 lines
Quoted 1 line

Alex

Thanks.

Alex,
I saw you put the patches into your drm-next-4.6. As these are fixes, any chance you could instead put them to drm-fixes-4.5 ? for -rc3/4 ?

Quoted 5 lines

They'll be in my -fixes pull this week. I put them in my 4.6-wip tree for additional testing.

Alex

ah, great.
Thanks again
Oded

Quoted 26 lines
Quoted 26 lines

Oded

Quoted 23 lines
Quoted 23 lines

Thanks,

Oded

Quoted 17 lines
Quoted 17 lines
Quoted 17 lines


---
  include/drm/drm_cache.h | 9 +++++++++
  1 file changed, 9 insertions(+)
include/drm/drm_cache.h +3 -0
index 7bfb063..461a055 100644
@@ -35,4 +35,13 @@
    void drm_clflush_pages(struct page *pages[], unsigned long num_pages);
  +static inline bool drm_arch_can_wc_memory(void)
+{
+#if defined(CONFIG_PPC) && !defined(CONFIG_NOT_COHERENT_CACHE)
+       return false;
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

include/drm/drm_cache.h line 45

Quoted 6 lines
include/drm/drm_cache.h +5 -0
+#else
+       return true;
+#endif
+}
+
  #endif

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel