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

Daniel Vetter daniel at ffwll.ch
Mon Feb 19 09:48:10 UTC 2018


On Thu, Feb 08, 2018 at 02:00:15PM +0800, Chunming Zhou wrote:
> it will be used to check if the driver needs swiotlb
> 
> Change-Id: Idbe47af8f12032d4803bb3d47273e807f19169c3
> Signed-off-by: Chunming Zhou <david1.zhou at amd.com>
> ---
>  include/drm/drm_cache.h | 13 +++++++++++++
>  1 file changed, 13 insertions(+)
> 
> diff --git a/include/drm/drm_cache.h b/include/drm/drm_cache.h
> index beab0f0d0cfb..442c9ba63d03 100644
> --- a/include/drm/drm_cache.h
> +++ b/include/drm/drm_cache.h
> @@ -39,6 +39,19 @@ 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 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;
> +}

linux-next noticed a compile warning on this (on some platforms, the
max_iomem has the wrong integer size I think). Also, drm_memory.c is a bit
a grab-bag of legacy stuff, not sure this is the best place. We're also
lacking kerneldoc (plus include stanza) for this new function.

Can you pls fix all that in a follow-up patch?

Thanks, Daniel

> +
> +
>  static inline bool drm_arch_can_wc_memory(void)
>  {
>  #if defined(CONFIG_PPC) && !defined(CONFIG_NOT_COHERENT_CACHE)
> -- 
> 2.14.1
> 
> _______________________________________________
> dri-devel mailing list
> dri-devel at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch


More information about the dri-devel mailing list