Re: [PATCH 1/3] drm: add func to get max iomem address v2

2018-02-19 Thread Daniel Vetter
On Fri, Feb 16, 2018 at 02:40:11PM +, Chris Wilson wrote:
> Quoting Chunming Zhou (2018-02-09 02:44:08)
> > it will be used to check if the driver needs swiotlb
> > v2: Don't use inline, instead, move function to drm_memory.c (Mechel 
> > Daenzer )
> > 
> > Change-Id: Idbe47af8f12032d4803bb3d47273e807f19169c3
> > Signed-off-by: Chunming Zhou 
> > Reviewed-by: Monk Liu 
> > Reviewed-by: Christian König 
> > ---
> >  drivers/gpu/drm/drm_memory.c | 13 +
> >  include/drm/drm_cache.h  |  2 ++
> >  2 files changed, 15 insertions(+)
> > 
> > diff --git a/drivers/gpu/drm/drm_memory.c b/drivers/gpu/drm/drm_memory.c
> > index fc0ebd273ef8..7ca500b8c399 100644
> > --- a/drivers/gpu/drm/drm_memory.c
> > +++ b/drivers/gpu/drm/drm_memory.c
> > @@ -149,3 +149,16 @@ void drm_legacy_ioremapfree(struct drm_local_map *map, 
> > struct drm_device *dev)
> > iounmap(map->handle);
> >  }
> >  EXPORT_SYMBOL(drm_legacy_ioremapfree);
> > +
> > +u64 drm_get_max_iomem(void)
> > +{
> > +   struct resource *tmp;
> > +   u64 max_iomem = 0;
> > +
> > +   for (tmp = iomem_resource.child; tmp; tmp = tmp->sibling) {
> > +   max_iomem = max(max_iomem,  tmp->end);
> 
> Note that resource.end is of type resource_size_t which is not u64 on
> 32b.
> 
> Either use max_t(u64) or resource_size_t max_iomem with the implicit
> cast on the return.

Yeah linux-next spotted that one too, pls fix in a follow-up with the
other things I've raised (lack of kerneldoc mostly).
-Daniel
-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH 1/3] drm: add func to get max iomem address v2

2018-02-16 Thread Chris Wilson
Quoting Chunming Zhou (2018-02-09 02:44:08)
> it will be used to check if the driver needs swiotlb
> v2: Don't use inline, instead, move function to drm_memory.c (Mechel Daenzer 
> )
> 
> Change-Id: Idbe47af8f12032d4803bb3d47273e807f19169c3
> Signed-off-by: Chunming Zhou 
> Reviewed-by: Monk Liu 
> Reviewed-by: Christian König 
> ---
>  drivers/gpu/drm/drm_memory.c | 13 +
>  include/drm/drm_cache.h  |  2 ++
>  2 files changed, 15 insertions(+)
> 
> diff --git a/drivers/gpu/drm/drm_memory.c b/drivers/gpu/drm/drm_memory.c
> index fc0ebd273ef8..7ca500b8c399 100644
> --- a/drivers/gpu/drm/drm_memory.c
> +++ b/drivers/gpu/drm/drm_memory.c
> @@ -149,3 +149,16 @@ void drm_legacy_ioremapfree(struct drm_local_map *map, 
> struct drm_device *dev)
> iounmap(map->handle);
>  }
>  EXPORT_SYMBOL(drm_legacy_ioremapfree);
> +
> +u64 drm_get_max_iomem(void)
> +{
> +   struct resource *tmp;
> +   u64 max_iomem = 0;
> +
> +   for (tmp = iomem_resource.child; tmp; tmp = tmp->sibling) {
> +   max_iomem = max(max_iomem,  tmp->end);

Note that resource.end is of type resource_size_t which is not u64 on
32b.

Either use max_t(u64) or resource_size_t max_iomem with the implicit
cast on the return.
-Chris
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH 1/3] drm: add func to get max iomem address v2

2018-02-09 Thread Michel Dänzer
On 2018-02-09 03:44 AM, Chunming Zhou wrote:
> it will be used to check if the driver needs swiotlb
> v2: Don't use inline, instead, move function to drm_memory.c (Mechel Daenzer 
> )

Typo in my first name. With that fixed,

Reviewed-by: Michel Dänzer 


-- 
Earthling Michel Dänzer   |   http://www.amd.com
Libre software enthusiast | Mesa and X developer
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH 1/3] drm: add func to get max iomem address v2

2018-02-08 Thread Chunming Zhou
it will be used to check if the driver needs swiotlb
v2: Don't use inline, instead, move function to drm_memory.c (Mechel Daenzer 
)

Change-Id: Idbe47af8f12032d4803bb3d47273e807f19169c3
Signed-off-by: Chunming Zhou 
Reviewed-by: Monk Liu 
Reviewed-by: Christian König 
---
 drivers/gpu/drm/drm_memory.c | 13 +
 include/drm/drm_cache.h  |  2 ++
 2 files changed, 15 insertions(+)

diff --git a/drivers/gpu/drm/drm_memory.c b/drivers/gpu/drm/drm_memory.c
index fc0ebd273ef8..7ca500b8c399 100644
--- a/drivers/gpu/drm/drm_memory.c
+++ b/drivers/gpu/drm/drm_memory.c
@@ -149,3 +149,16 @@ void drm_legacy_ioremapfree(struct drm_local_map *map, 
struct drm_device *dev)
iounmap(map->handle);
 }
 EXPORT_SYMBOL(drm_legacy_ioremapfree);
+
+u64 drm_get_max_iomem(void)
+{
+   struct resource *tmp;
+   u64 max_iomem = 0;
+
+   for (tmp = iomem_resource.child; tmp; tmp = tmp->sibling) {
+   max_iomem = max(max_iomem,  tmp->end);
+   }
+
+   return max_iomem;
+}
+EXPORT_SYMBOL(drm_get_max_iomem);
diff --git a/include/drm/drm_cache.h b/include/drm/drm_cache.h
index beab0f0d0cfb..bfe1639df02d 100644
--- a/include/drm/drm_cache.h
+++ b/include/drm/drm_cache.h
@@ -38,6 +38,8 @@
 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);
+u64 drm_get_max_iomem(void);
+
 
 static inline bool drm_arch_can_wc_memory(void)
 {
-- 
2.14.1

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel