Message ID | 20180208083238.8291-1-david1.zhou@amd.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Am 08.02.2018 um 09:32 schrieb Chunming Zhou: > it will be used to check if the driver needs swiotlb > > Change-Id: Idbe47af8f12032d4803bb3d47273e807f19169c3 > Signed-off-by: Chunming Zhou <david1.zhou@amd.com> > Reviewed-by: Monk Liu <monk.liu@amd.com> Reviewed-by: Christian König <christian.koenig@amd.com> for the whole series. > --- > 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; > +} > + > + > static inline bool drm_arch_can_wc_memory(void) > { > #if defined(CONFIG_PPC) && !defined(CONFIG_NOT_COHERENT_CACHE)
On 2018-02-08 09:32 AM, Chunming Zhou wrote: > it will be used to check if the driver needs swiotlb > > Change-Id: Idbe47af8f12032d4803bb3d47273e807f19169c3 > Signed-off-by: Chunming Zhou <david1.zhou@amd.com> > Reviewed-by: Monk Liu <monk.liu@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; > +} I don't think this needs to be an inline function, does it?
On 2018年02月08日 17:09, Michel Dänzer wrote: > On 2018-02-08 09:32 AM, Chunming Zhou wrote: >> it will be used to check if the driver needs swiotlb >> >> Change-Id: Idbe47af8f12032d4803bb3d47273e807f19169c3 >> Signed-off-by: Chunming Zhou <david1.zhou@amd.com> >> Reviewed-by: Monk Liu <monk.liu@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; >> +} > I don't think this needs to be an inline function, does it? If no inline, will report building warning that this function is defined but not used in some files including drm_cache.h Regards, David Zhou > >
Am 08.02.2018 um 10:09 schrieb Michel Dänzer: > On 2018-02-08 09:32 AM, Chunming Zhou wrote: >> it will be used to check if the driver needs swiotlb >> >> Change-Id: Idbe47af8f12032d4803bb3d47273e807f19169c3 >> Signed-off-by: Chunming Zhou <david1.zhou@amd.com> >> Reviewed-by: Monk Liu <monk.liu@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; >> +} > I don't think this needs to be an inline function, does it? Well it is defined in a header, so it must be inline because of this. But if you know a good place, we could also move it into some C file. Christian.
On 2018-02-08 10:15 AM, Chunming Zhou wrote: > On 2018年02月08日 17:09, Michel Dänzer wrote: >> On 2018-02-08 09:32 AM, Chunming Zhou wrote: >>> it will be used to check if the driver needs swiotlb >>> >>> Change-Id: Idbe47af8f12032d4803bb3d47273e807f19169c3 >>> Signed-off-by: Chunming Zhou <david1.zhou@amd.com> >>> Reviewed-by: Monk Liu <monk.liu@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; >>> +} >> I don't think this needs to be an inline function, does it? > If no inline, will report building warning that this function is defined > but not used in some files including drm_cache.h What I mean is that it can be a normal function in drivers/gpu/drm/*.c with EXPORT_SYMBOL.
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; +} + + static inline bool drm_arch_can_wc_memory(void) { #if defined(CONFIG_PPC) && !defined(CONFIG_NOT_COHERENT_CACHE)