All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/ttm: ioremap buffer according to TTM mem caching setting
@ 2021-03-03 21:12 ` Oak Zeng
  0 siblings, 0 replies; 49+ messages in thread
From: Oak Zeng @ 2021-03-03 21:12 UTC (permalink / raw)
  To: dri-devel, amd-gfx, brahma_sw_dev
  Cc: Felix.Kuehling, harish.kasiviswanathan, christian.koenig,
	jinhuieric.huang, Alexander.Deucher, Oak Zeng

If tbo.mem.bus.caching is cached, buffer is intended to be mapped
as cached from CPU. Map it with ioremap_cache.

This wasn't necessary before as device memory was never mapped
as cached from CPU side. It becomes necessary for aldebaran as
device memory is mapped cached from CPU.

Signed-off-by: Oak Zeng <Oak.Zeng@amd.com>
Reviewed-by: Christian Konig <Christian.Koenig@amd.com>
---
 drivers/gpu/drm/ttm/ttm_bo_util.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/drivers/gpu/drm/ttm/ttm_bo_util.c b/drivers/gpu/drm/ttm/ttm_bo_util.c
index 031e581..7c848e2 100644
--- a/drivers/gpu/drm/ttm/ttm_bo_util.c
+++ b/drivers/gpu/drm/ttm/ttm_bo_util.c
@@ -91,6 +91,10 @@ static int ttm_resource_ioremap(struct ttm_device *bdev,
 
 		if (mem->bus.caching == ttm_write_combined)
 			addr = ioremap_wc(mem->bus.offset, bus_size);
+#ifdef __x86_64__
+		else if (mem->bus.caching == ttm_cached)
+			addr = ioremap_cache(mem->bus.offset, bus_size);
+#endif
 		else
 			addr = ioremap(mem->bus.offset, bus_size);
 		if (!addr) {
@@ -372,6 +376,11 @@ static int ttm_bo_ioremap(struct ttm_buffer_object *bo,
 		if (mem->bus.caching == ttm_write_combined)
 			map->virtual = ioremap_wc(bo->mem.bus.offset + offset,
 						  size);
+#ifdef __x86_64__
+		else if (mem->bus.caching == ttm_cached)
+			map->virtual = ioremap_cache(bo->mem.bus.offset + offset,
+						  size);
+#endif
 		else
 			map->virtual = ioremap(bo->mem.bus.offset + offset,
 					       size);
@@ -490,6 +499,11 @@ int ttm_bo_vmap(struct ttm_buffer_object *bo, struct dma_buf_map *map)
 		else if (mem->bus.caching == ttm_write_combined)
 			vaddr_iomem = ioremap_wc(mem->bus.offset,
 						 bo->base.size);
+		else if (mem->bus.caching == ttm_cached)
+#ifdef __x86_64__
+			vaddr_iomem = ioremap_cache(mem->bus.offset,
+						  bo->base.size);
+#endif
 		else
 			vaddr_iomem = ioremap(mem->bus.offset, bo->base.size);
 
-- 
2.7.4

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

^ permalink raw reply related	[flat|nested] 49+ messages in thread

* [PATCH] drm/ttm: ioremap buffer according to TTM mem caching setting
@ 2021-03-03 21:12 ` Oak Zeng
  0 siblings, 0 replies; 49+ messages in thread
From: Oak Zeng @ 2021-03-03 21:12 UTC (permalink / raw)
  To: dri-devel, amd-gfx, brahma_sw_dev
  Cc: Felix.Kuehling, harish.kasiviswanathan, christian.koenig,
	jinhuieric.huang, Alexander.Deucher, Oak Zeng

If tbo.mem.bus.caching is cached, buffer is intended to be mapped
as cached from CPU. Map it with ioremap_cache.

This wasn't necessary before as device memory was never mapped
as cached from CPU side. It becomes necessary for aldebaran as
device memory is mapped cached from CPU.

Signed-off-by: Oak Zeng <Oak.Zeng@amd.com>
Reviewed-by: Christian Konig <Christian.Koenig@amd.com>
---
 drivers/gpu/drm/ttm/ttm_bo_util.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/drivers/gpu/drm/ttm/ttm_bo_util.c b/drivers/gpu/drm/ttm/ttm_bo_util.c
index 031e581..7c848e2 100644
--- a/drivers/gpu/drm/ttm/ttm_bo_util.c
+++ b/drivers/gpu/drm/ttm/ttm_bo_util.c
@@ -91,6 +91,10 @@ static int ttm_resource_ioremap(struct ttm_device *bdev,
 
 		if (mem->bus.caching == ttm_write_combined)
 			addr = ioremap_wc(mem->bus.offset, bus_size);
+#ifdef __x86_64__
+		else if (mem->bus.caching == ttm_cached)
+			addr = ioremap_cache(mem->bus.offset, bus_size);
+#endif
 		else
 			addr = ioremap(mem->bus.offset, bus_size);
 		if (!addr) {
@@ -372,6 +376,11 @@ static int ttm_bo_ioremap(struct ttm_buffer_object *bo,
 		if (mem->bus.caching == ttm_write_combined)
 			map->virtual = ioremap_wc(bo->mem.bus.offset + offset,
 						  size);
+#ifdef __x86_64__
+		else if (mem->bus.caching == ttm_cached)
+			map->virtual = ioremap_cache(bo->mem.bus.offset + offset,
+						  size);
+#endif
 		else
 			map->virtual = ioremap(bo->mem.bus.offset + offset,
 					       size);
@@ -490,6 +499,11 @@ int ttm_bo_vmap(struct ttm_buffer_object *bo, struct dma_buf_map *map)
 		else if (mem->bus.caching == ttm_write_combined)
 			vaddr_iomem = ioremap_wc(mem->bus.offset,
 						 bo->base.size);
+		else if (mem->bus.caching == ttm_cached)
+#ifdef __x86_64__
+			vaddr_iomem = ioremap_cache(mem->bus.offset,
+						  bo->base.size);
+#endif
 		else
 			vaddr_iomem = ioremap(mem->bus.offset, bo->base.size);
 
-- 
2.7.4

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply related	[flat|nested] 49+ messages in thread

* Re: [PATCH] drm/ttm: ioremap buffer according to TTM mem caching setting
  2021-03-03 21:12 ` Oak Zeng
@ 2021-03-04  7:48   ` Christian König
  -1 siblings, 0 replies; 49+ messages in thread
From: Christian König @ 2021-03-04  7:48 UTC (permalink / raw)
  To: Oak Zeng, dri-devel, amd-gfx, brahma_sw_dev
  Cc: Alexander.Deucher, jinhuieric.huang, Felix.Kuehling,
	harish.kasiviswanathan

I think we should check for CONFIG_X86 instead, but in general it sounds 
like the right approach to me for now.

Regards,
Christian.

Am 03.03.21 um 22:12 schrieb Oak Zeng:
> If tbo.mem.bus.caching is cached, buffer is intended to be mapped
> as cached from CPU. Map it with ioremap_cache.
>
> This wasn't necessary before as device memory was never mapped
> as cached from CPU side. It becomes necessary for aldebaran as
> device memory is mapped cached from CPU.
>
> Signed-off-by: Oak Zeng <Oak.Zeng@amd.com>
> Reviewed-by: Christian Konig <Christian.Koenig@amd.com>
> ---
>   drivers/gpu/drm/ttm/ttm_bo_util.c | 14 ++++++++++++++
>   1 file changed, 14 insertions(+)
>
> diff --git a/drivers/gpu/drm/ttm/ttm_bo_util.c b/drivers/gpu/drm/ttm/ttm_bo_util.c
> index 031e581..7c848e2 100644
> --- a/drivers/gpu/drm/ttm/ttm_bo_util.c
> +++ b/drivers/gpu/drm/ttm/ttm_bo_util.c
> @@ -91,6 +91,10 @@ static int ttm_resource_ioremap(struct ttm_device *bdev,
>   
>   		if (mem->bus.caching == ttm_write_combined)
>   			addr = ioremap_wc(mem->bus.offset, bus_size);
> +#ifdef __x86_64__
> +		else if (mem->bus.caching == ttm_cached)
> +			addr = ioremap_cache(mem->bus.offset, bus_size);
> +#endif
>   		else
>   			addr = ioremap(mem->bus.offset, bus_size);
>   		if (!addr) {
> @@ -372,6 +376,11 @@ static int ttm_bo_ioremap(struct ttm_buffer_object *bo,
>   		if (mem->bus.caching == ttm_write_combined)
>   			map->virtual = ioremap_wc(bo->mem.bus.offset + offset,
>   						  size);
> +#ifdef __x86_64__
> +		else if (mem->bus.caching == ttm_cached)
> +			map->virtual = ioremap_cache(bo->mem.bus.offset + offset,
> +						  size);
> +#endif
>   		else
>   			map->virtual = ioremap(bo->mem.bus.offset + offset,
>   					       size);
> @@ -490,6 +499,11 @@ int ttm_bo_vmap(struct ttm_buffer_object *bo, struct dma_buf_map *map)
>   		else if (mem->bus.caching == ttm_write_combined)
>   			vaddr_iomem = ioremap_wc(mem->bus.offset,
>   						 bo->base.size);
> +		else if (mem->bus.caching == ttm_cached)
> +#ifdef __x86_64__
> +			vaddr_iomem = ioremap_cache(mem->bus.offset,
> +						  bo->base.size);
> +#endif
>   		else
>   			vaddr_iomem = ioremap(mem->bus.offset, bo->base.size);
>   

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

^ permalink raw reply	[flat|nested] 49+ messages in thread

* Re: [PATCH] drm/ttm: ioremap buffer according to TTM mem caching setting
@ 2021-03-04  7:48   ` Christian König
  0 siblings, 0 replies; 49+ messages in thread
From: Christian König @ 2021-03-04  7:48 UTC (permalink / raw)
  To: Oak Zeng, dri-devel, amd-gfx, brahma_sw_dev
  Cc: Alexander.Deucher, jinhuieric.huang, Felix.Kuehling,
	harish.kasiviswanathan

I think we should check for CONFIG_X86 instead, but in general it sounds 
like the right approach to me for now.

Regards,
Christian.

Am 03.03.21 um 22:12 schrieb Oak Zeng:
> If tbo.mem.bus.caching is cached, buffer is intended to be mapped
> as cached from CPU. Map it with ioremap_cache.
>
> This wasn't necessary before as device memory was never mapped
> as cached from CPU side. It becomes necessary for aldebaran as
> device memory is mapped cached from CPU.
>
> Signed-off-by: Oak Zeng <Oak.Zeng@amd.com>
> Reviewed-by: Christian Konig <Christian.Koenig@amd.com>
> ---
>   drivers/gpu/drm/ttm/ttm_bo_util.c | 14 ++++++++++++++
>   1 file changed, 14 insertions(+)
>
> diff --git a/drivers/gpu/drm/ttm/ttm_bo_util.c b/drivers/gpu/drm/ttm/ttm_bo_util.c
> index 031e581..7c848e2 100644
> --- a/drivers/gpu/drm/ttm/ttm_bo_util.c
> +++ b/drivers/gpu/drm/ttm/ttm_bo_util.c
> @@ -91,6 +91,10 @@ static int ttm_resource_ioremap(struct ttm_device *bdev,
>   
>   		if (mem->bus.caching == ttm_write_combined)
>   			addr = ioremap_wc(mem->bus.offset, bus_size);
> +#ifdef __x86_64__
> +		else if (mem->bus.caching == ttm_cached)
> +			addr = ioremap_cache(mem->bus.offset, bus_size);
> +#endif
>   		else
>   			addr = ioremap(mem->bus.offset, bus_size);
>   		if (!addr) {
> @@ -372,6 +376,11 @@ static int ttm_bo_ioremap(struct ttm_buffer_object *bo,
>   		if (mem->bus.caching == ttm_write_combined)
>   			map->virtual = ioremap_wc(bo->mem.bus.offset + offset,
>   						  size);
> +#ifdef __x86_64__
> +		else if (mem->bus.caching == ttm_cached)
> +			map->virtual = ioremap_cache(bo->mem.bus.offset + offset,
> +						  size);
> +#endif
>   		else
>   			map->virtual = ioremap(bo->mem.bus.offset + offset,
>   					       size);
> @@ -490,6 +499,11 @@ int ttm_bo_vmap(struct ttm_buffer_object *bo, struct dma_buf_map *map)
>   		else if (mem->bus.caching == ttm_write_combined)
>   			vaddr_iomem = ioremap_wc(mem->bus.offset,
>   						 bo->base.size);
> +		else if (mem->bus.caching == ttm_cached)
> +#ifdef __x86_64__
> +			vaddr_iomem = ioremap_cache(mem->bus.offset,
> +						  bo->base.size);
> +#endif
>   		else
>   			vaddr_iomem = ioremap(mem->bus.offset, bo->base.size);
>   

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply	[flat|nested] 49+ messages in thread

* Re: [PATCH] drm/ttm: ioremap buffer according to TTM mem caching setting
  2021-03-04  7:46             ` Christian König
  (?)
@ 2021-03-11 13:06               ` Daniel Vetter
  -1 siblings, 0 replies; 49+ messages in thread
From: Daniel Vetter @ 2021-03-11 13:06 UTC (permalink / raw)
  To: Christian König
  Cc: kbuild-all, Zeng, Oak, Kasiviswanathan, Harish, dri-devel,
	Koenig, Christian, Huang, JinHuiEric, amd-gfx, Kuehling, Felix,
	Deucher, Alexander, Dave Airlie, dan.j.williams,
	Thomas Hellström (Intel)

On Thu, Mar 04, 2021 at 08:46:26AM +0100, Christian König wrote:
> Hi Oak,
> 
> as far as I know some architectures like PowerPC/ARM/MIPS need that. And we
> at least officially support PowerPC and ARM and MIPS is best effort and
> shouldn't break if possible.
> 
> Thomas just recently had a whole bunch of DMA-buf patches to also fix that
> up for DMA-bufs vmap as well, previously we have just been casting away the
> __iomem and hoped that it always works.

On that, rolling out struct dma_buf_map to ttm and drivers I think would
clean up a lot of this __iomem handling rather nicely.
-Daniel

> 
> Regards,
> Christian.
> 
> Am 03.03.21 um 21:59 schrieb Zeng, Oak:
> > 
> > [AMD Official Use Only - Internal Distribution Only]
> > 
> > 
> > Hi Christian,
> > 
> > Can you explain why __iomem annotation is mandatory for amdgpu driver?
> > If this is the case, we can’t switch to memremap. The only fix seems to
> > me is add a #ifdef __x86_64__ to the ioremap_cache codes.
> > 
> > Regards,
> > 
> > Oak
> > 
> > *From:* Christian König <ckoenig.leichtzumerken@gmail.com>
> > *Sent:* Wednesday, March 3, 2021 5:46 AM
> > *To:* Zeng, Oak <Oak.Zeng@amd.com>; amd-gfx@lists.freedesktop.org;
> > dri-devel@lists.freedesktop.org; Daniel Vetter <daniel@ffwll.ch>; Dave
> > Airlie <airlied@redhat.com>; Thomas Hellström (Intel)
> > <thomas_os@shipmail.org>; dan.j.williams@intel.com
> > *Cc:* kbuild-all@lists.01.org; Kuehling, Felix <Felix.Kuehling@amd.com>;
> > Kasiviswanathan, Harish <Harish.Kasiviswanathan@amd.com>; Deucher,
> > Alexander <Alexander.Deucher@amd.com>; Huang, JinHuiEric
> > <JinHuiEric.Huang@amd.com>; Koenig, Christian <Christian.Koenig@amd.com>
> > *Subject:* Re: [PATCH] drm/ttm: ioremap buffer according to TTM mem
> > caching setting
> > 
> > Hi Oak,
> > 
> > 
> >     config: parisc-randconfig-r012-20210302 (attached as .config)
> > 
> > 
> > It's not the Intel driver build which fails here, but the build bot is
> > just hosted by Intel.
> > 
> > The problem is that the parisc architecture doesn't defines the
> > ioremap_cache() function.
> > 
> > I've looked at using memremap() instead of ioremap_cache(). The problem
> > is that we do support architectures with the TTM as well as amndgpu code
> > where the __iomem annotation is mandatory and correct.
> > 
> > Regards,
> > Christian.
> > 
> > Am 02.03.21 um 23:45 schrieb Zeng, Oak:
> > 
> >     [AMD Official Use Only - Internal Distribution Only]
> > 
> >     Hi Daniel, Thomas, Dan,
> > 
> >     Does below message mean the calling ioremap_cache failed intel’s
> >     driver build? I can see both ioremap_cache and ioremap_wc are
> >     defined in arch/x86/mm/ioremap.c – why ioremap_wc doesn’t break
> >     intel driver’s build?
> > 
> >     Are we supposed to use memremap (offset, size, MEMREMAP_WB) to
> >     replace ioremap_cache? When I read here
> >     https://lwn.net/Articles/653585/
> >     <https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flwn.net%2FArticles%2F653585%2F&data=04%7C01%7COak.Zeng%40amd.com%7Cc047ecb316df47cde7ed08d8de3188d4%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637503651624296472%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=ljCFrIfrYbb%2FXmKKS2TJ7dSQ7oCRNWoUhWS4gEBv%2FW4%3D&reserved=0>
> >     I felt that ioremap_cache returns an address annotated with _iomem
> >     while memremap returns an address without __iomem annotation. In
> >     our use case, GPU memory is treated as UEFI SPM (specific purpose
> >     memory). I am not very sure whether memremap (thus no __iomem
> >     annotation) is the right thing to do. What I am sure is, we have
> >     tested ioremap_cache and it works fine on AMD system.
> > 
> >     I will send out a test patch replacing ioremap_cache with
> >     ioremap_wc, to trigger Intel build robot to see whether it fails
> >     Intel build. I suppose it will not fail Intel build.
> > 
> >     Regards,
> > 
> >     Oak
> > 
> >     *From:* Christian König <ckoenig.leichtzumerken@gmail.com>
> >     <mailto:ckoenig.leichtzumerken@gmail.com>
> >     *Sent:* Tuesday, March 2, 2021 6:31 AM
> >     *To:* amd-gfx@lists.freedesktop.org
> >     <mailto:amd-gfx@lists.freedesktop.org>;
> >     dri-devel@lists.freedesktop.org
> >     <mailto:dri-devel@lists.freedesktop.org>; Daniel Vetter
> >     <daniel@ffwll.ch> <mailto:daniel@ffwll.ch>; Dave Airlie
> >     <airlied@redhat.com> <mailto:airlied@redhat.com>; Thomas Hellström
> >     (Intel) <thomas_os@shipmail.org> <mailto:thomas_os@shipmail.org>
> >     *Cc:* Zeng, Oak <Oak.Zeng@amd.com> <mailto:Oak.Zeng@amd.com>;
> >     kbuild-all@lists.01.org <mailto:kbuild-all@lists.01.org>;
> >     Kuehling, Felix <Felix.Kuehling@amd.com>
> >     <mailto:Felix.Kuehling@amd.com>; Kasiviswanathan, Harish
> >     <Harish.Kasiviswanathan@amd.com>
> >     <mailto:Harish.Kasiviswanathan@amd.com>; Deucher, Alexander
> >     <Alexander.Deucher@amd.com> <mailto:Alexander.Deucher@amd.com>;
> >     Huang, JinHuiEric <JinHuiEric.Huang@amd.com>
> >     <mailto:JinHuiEric.Huang@amd.com>; Koenig, Christian
> >     <Christian.Koenig@amd.com> <mailto:Christian.Koenig@amd.com>
> >     *Subject:* Re: [PATCH] drm/ttm: ioremap buffer according to TTM
> >     mem caching setting
> > 
> >     Hi guys,
> > 
> >     adding the usual suspects direct. Does anybody of hand know how to
> >     check if an architecture supports ioremap_cache()?
> > 
> >     For now we only need this on X86, but I would feel better if we
> >     don't use an #ifdef here.
> > 
> >     Regards,
> >     Christian.
> > 
> >     Am 02.03.21 um 05:12 schrieb kernel test robot:
> > 
> >         Hi Oak,
> > 
> > 
> >         Thank you for the patch! Yet something to improve:
> > 
> > 
> >         [auto build test ERROR on drm-intel/for-linux-next]
> > 
> >         [also build test ERROR on drm-tip/drm-tip linus/master v5.12-rc1 next-20210302]
> > 
> >         [cannot apply to tegra-drm/drm/tegra/for-next drm-exynos/exynos-drm-next drm/drm-next]
> > 
> >         [If your patch is applied to the wrong git tree, kindly drop us a note.
> > 
> >         And when submitting patch, we suggest to use '--base' as documented in
> > 
> >         https://git-scm.com/docs/git-format-patch  <https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgit-scm.com%2Fdocs%2Fgit-format-patch&data=04%7C01%7COak.Zeng%40amd.com%7Cc047ecb316df47cde7ed08d8de3188d4%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637503651624306464%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=3f5ib%2FlZ6DXXF%2Bk1rXPKGu1IkOhXHdkUmX3obtuIRtA%3D&reserved=0>]
> > 
> > 
> >         url:https://github.com/0day-ci/linux/commits/Oak-Zeng/drm-ttm-ioremap-buffer-according-to-TTM-mem-caching-setting/20210302-064500  <https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2F0day-ci%2Flinux%2Fcommits%2FOak-Zeng%2Fdrm-ttm-ioremap-buffer-according-to-TTM-mem-caching-setting%2F20210302-064500&data=04%7C01%7COak.Zeng%40amd.com%7Cc047ecb316df47cde7ed08d8de3188d4%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637503651624306464%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=Y9h9ZHM7d2Sqo3XQWr%2Frpb2DAk9SkHFIm5nD4ABFNbE%3D&reserved=0>
> > 
> >         base:   git://anongit.freedesktop.org/drm-intel for-linux-next
> > 
> >         config: parisc-randconfig-r012-20210302 (attached as .config)
> > 
> >         compiler: hppa-linux-gcc (GCC) 9.3.0
> > 
> >         reproduce (this is a W=1 build):
> > 
> >                  wgethttps://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross  <https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fraw.githubusercontent.com%2Fintel%2Flkp-tests%2Fmaster%2Fsbin%2Fmake.cross&data=04%7C01%7COak.Zeng%40amd.com%7Cc047ecb316df47cde7ed08d8de3188d4%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637503651624316464%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=wGo3Nwk4mWZjb2W3E7qKf3FtKzLOxCVmQu1zd2rmzRU%3D&reserved=0>  -O ~/bin/make.cross
> > 
> >                  chmod +x ~/bin/make.cross
> > 
> >                  #https://github.com/0day-ci/linux/commit/225bb3711439ec559dd72ae5af8e62d34ea60a64  <https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2F0day-ci%2Flinux%2Fcommit%2F225bb3711439ec559dd72ae5af8e62d34ea60a64&data=04%7C01%7COak.Zeng%40amd.com%7Cc047ecb316df47cde7ed08d8de3188d4%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637503651624316464%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=kOz18UAawmA4SZ6IrCGRt4HISfsmmjfGN2TUgAtm0Ak%3D&reserved=0>
> > 
> >                  git remote add linux-reviewhttps://github.com/0day-ci/linux  <https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2F0day-ci%2Flinux&data=04%7C01%7COak.Zeng%40amd.com%7Cc047ecb316df47cde7ed08d8de3188d4%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637503651624326458%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=QnKs47gjzAz%2Fjv%2FAO6H%2BwYNQF6mdk1D8dCNveW0YHuM%3D&reserved=0>
> > 
> >                  git fetch --no-tags linux-review Oak-Zeng/drm-ttm-ioremap-buffer-according-to-TTM-mem-caching-setting/20210302-064500
> > 
> >                  git checkout 225bb3711439ec559dd72ae5af8e62d34ea60a64
> > 
> >                  # save the attached .config to linux build tree
> > 
> >                  COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=parisc
> > 
> > 
> >         If you fix the issue, kindly add following tag as appropriate
> > 
> >         Reported-by: kernel test robot<lkp@intel.com>  <mailto:lkp@intel.com>
> > 
> > 
> >         All errors (new ones prefixed by >>):
> > 
> > 
> >             drivers/gpu/drm/ttm/ttm_bo_util.c: In function 'ttm_resource_ioremap':
> > 
> >                 drivers/gpu/drm/ttm/ttm_bo_util.c:95:11: error: implicit declaration of function 'ioremap_cache'; did you mean 'ioremap_uc'? [-Werror=implicit-function-declaration]
> > 
> >                95 |    addr = ioremap_cache(mem->bus.offset, bus_size);
> > 
> >                   |           ^~~~~~~~~~~~~
> > 
> >                   |           ioremap_uc
> > 
> >             drivers/gpu/drm/ttm/ttm_bo_util.c:95:9: warning: assignment to 'void *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
> > 
> >                95 |    addr = ioremap_cache(mem->bus.offset, bus_size);
> > 
> >                   |         ^
> > 
> >             drivers/gpu/drm/ttm/ttm_bo_util.c: In function 'ttm_bo_ioremap':
> > 
> >             drivers/gpu/drm/ttm/ttm_bo_util.c:379:17: warning: assignment to 'void *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
> > 
> >               379 |    map->virtual = ioremap_cache(bo->mem.bus.offset + offset,
> > 
> >                   |                 ^
> > 
> >             drivers/gpu/drm/ttm/ttm_bo_util.c: In function 'ttm_bo_vmap':
> > 
> >             drivers/gpu/drm/ttm/ttm_bo_util.c:500:16: warning: assignment to 'void *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
> > 
> >               500 |    vaddr_iomem = ioremap_cache(mem->bus.offset,
> > 
> >                   |                ^
> > 
> >             cc1: some warnings being treated as errors
> > 
> > 
> > 
> >         vim +95 drivers/gpu/drm/ttm/ttm_bo_util.c
> > 
> > 
> >              74
> > 
> >              75  static int ttm_resource_ioremap(struct ttm_bo_device *bdev,
> > 
> >              76                                struct ttm_resource *mem,
> > 
> >              77                                void **virtual)
> > 
> >              78  {
> > 
> >              79          int ret;
> > 
> >              80          void *addr;
> > 
> >              81
> > 
> >              82          *virtual = NULL;
> > 
> >              83          ret = ttm_mem_io_reserve(bdev, mem);
> > 
> >              84          if (ret || !mem->bus.is_iomem)
> > 
> >              85                  return ret;
> > 
> >              86
> > 
> >              87          if (mem->bus.addr) {
> > 
> >              88                  addr = mem->bus.addr;
> > 
> >              89          } else {
> > 
> >              90                  size_t bus_size = (size_t)mem->num_pages << PAGE_SHIFT;
> > 
> >              91
> > 
> >              92                  if (mem->bus.caching == ttm_write_combined)
> > 
> >              93                         addr = ioremap_wc(mem->bus.offset, bus_size);
> > 
> >              94                  else if (mem->bus.caching == ttm_cached)
> > 
> >            > 95                         addr = ioremap_cache(mem->bus.offset, bus_size);
> > 
> >              96                  else
> > 
> >              97                         addr = ioremap(mem->bus.offset, bus_size);
> > 
> >              98                  if (!addr) {
> > 
> >              99                         ttm_mem_io_free(bdev, mem);
> > 
> >             100                         return -ENOMEM;
> > 
> >             101                  }
> > 
> >             102          }
> > 
> >             103          *virtual = addr;
> > 
> >             104          return 0;
> > 
> >             105  }
> > 
> >             106
> > 
> > 
> >         ---
> > 
> >         0-DAY CI Kernel Test Service, Intel Corporation
> > 
> >         https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org  <https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.01.org%2Fhyperkitty%2Flist%2Fkbuild-all%40lists.01.org&data=04%7C01%7COak.Zeng%40amd.com%7Cc047ecb316df47cde7ed08d8de3188d4%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637503651624326458%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=MY6tEGVY0X4VyS750dYmsfVoR71Zp78YdxuqqRljnsI%3D&reserved=0>
> > 
> > 
> > 
> > 
> >         _______________________________________________
> > 
> >         amd-gfx mailing list
> > 
> >         amd-gfx@lists.freedesktop.org  <mailto:amd-gfx@lists.freedesktop.org>
> > 
> >         https://lists.freedesktop.org/mailman/listinfo/amd-gfx  <https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&data=04%7C01%7COak.Zeng%40amd.com%7Cc047ecb316df47cde7ed08d8de3188d4%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637503651624336455%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=Or3tWmS5M6mXOaFP4FHsEbg0rqoizNGpTl6JEkD6fac%3D&reserved=0>
> > 
> 

-- 
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

^ permalink raw reply	[flat|nested] 49+ messages in thread

* Re: [PATCH] drm/ttm: ioremap buffer according to TTM mem caching setting
@ 2021-03-11 13:06               ` Daniel Vetter
  0 siblings, 0 replies; 49+ messages in thread
From: Daniel Vetter @ 2021-03-11 13:06 UTC (permalink / raw)
  To: Christian König
  Cc: kbuild-all, Zeng, Oak, Kasiviswanathan, Harish, dri-devel,
	Koenig, Christian, Huang, JinHuiEric, amd-gfx, Daniel Vetter,
	Kuehling, Felix, Deucher, Alexander, Dave Airlie, dan.j.williams,
	Thomas Hellström (Intel)

On Thu, Mar 04, 2021 at 08:46:26AM +0100, Christian König wrote:
> Hi Oak,
> 
> as far as I know some architectures like PowerPC/ARM/MIPS need that. And we
> at least officially support PowerPC and ARM and MIPS is best effort and
> shouldn't break if possible.
> 
> Thomas just recently had a whole bunch of DMA-buf patches to also fix that
> up for DMA-bufs vmap as well, previously we have just been casting away the
> __iomem and hoped that it always works.

On that, rolling out struct dma_buf_map to ttm and drivers I think would
clean up a lot of this __iomem handling rather nicely.
-Daniel

> 
> Regards,
> Christian.
> 
> Am 03.03.21 um 21:59 schrieb Zeng, Oak:
> > 
> > [AMD Official Use Only - Internal Distribution Only]
> > 
> > 
> > Hi Christian,
> > 
> > Can you explain why __iomem annotation is mandatory for amdgpu driver?
> > If this is the case, we can’t switch to memremap. The only fix seems to
> > me is add a #ifdef __x86_64__ to the ioremap_cache codes.
> > 
> > Regards,
> > 
> > Oak
> > 
> > *From:* Christian König <ckoenig.leichtzumerken@gmail.com>
> > *Sent:* Wednesday, March 3, 2021 5:46 AM
> > *To:* Zeng, Oak <Oak.Zeng@amd.com>; amd-gfx@lists.freedesktop.org;
> > dri-devel@lists.freedesktop.org; Daniel Vetter <daniel@ffwll.ch>; Dave
> > Airlie <airlied@redhat.com>; Thomas Hellström (Intel)
> > <thomas_os@shipmail.org>; dan.j.williams@intel.com
> > *Cc:* kbuild-all@lists.01.org; Kuehling, Felix <Felix.Kuehling@amd.com>;
> > Kasiviswanathan, Harish <Harish.Kasiviswanathan@amd.com>; Deucher,
> > Alexander <Alexander.Deucher@amd.com>; Huang, JinHuiEric
> > <JinHuiEric.Huang@amd.com>; Koenig, Christian <Christian.Koenig@amd.com>
> > *Subject:* Re: [PATCH] drm/ttm: ioremap buffer according to TTM mem
> > caching setting
> > 
> > Hi Oak,
> > 
> > 
> >     config: parisc-randconfig-r012-20210302 (attached as .config)
> > 
> > 
> > It's not the Intel driver build which fails here, but the build bot is
> > just hosted by Intel.
> > 
> > The problem is that the parisc architecture doesn't defines the
> > ioremap_cache() function.
> > 
> > I've looked at using memremap() instead of ioremap_cache(). The problem
> > is that we do support architectures with the TTM as well as amndgpu code
> > where the __iomem annotation is mandatory and correct.
> > 
> > Regards,
> > Christian.
> > 
> > Am 02.03.21 um 23:45 schrieb Zeng, Oak:
> > 
> >     [AMD Official Use Only - Internal Distribution Only]
> > 
> >     Hi Daniel, Thomas, Dan,
> > 
> >     Does below message mean the calling ioremap_cache failed intel’s
> >     driver build? I can see both ioremap_cache and ioremap_wc are
> >     defined in arch/x86/mm/ioremap.c – why ioremap_wc doesn’t break
> >     intel driver’s build?
> > 
> >     Are we supposed to use memremap (offset, size, MEMREMAP_WB) to
> >     replace ioremap_cache? When I read here
> >     https://lwn.net/Articles/653585/
> >     <https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flwn.net%2FArticles%2F653585%2F&data=04%7C01%7COak.Zeng%40amd.com%7Cc047ecb316df47cde7ed08d8de3188d4%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637503651624296472%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=ljCFrIfrYbb%2FXmKKS2TJ7dSQ7oCRNWoUhWS4gEBv%2FW4%3D&reserved=0>
> >     I felt that ioremap_cache returns an address annotated with _iomem
> >     while memremap returns an address without __iomem annotation. In
> >     our use case, GPU memory is treated as UEFI SPM (specific purpose
> >     memory). I am not very sure whether memremap (thus no __iomem
> >     annotation) is the right thing to do. What I am sure is, we have
> >     tested ioremap_cache and it works fine on AMD system.
> > 
> >     I will send out a test patch replacing ioremap_cache with
> >     ioremap_wc, to trigger Intel build robot to see whether it fails
> >     Intel build. I suppose it will not fail Intel build.
> > 
> >     Regards,
> > 
> >     Oak
> > 
> >     *From:* Christian König <ckoenig.leichtzumerken@gmail.com>
> >     <mailto:ckoenig.leichtzumerken@gmail.com>
> >     *Sent:* Tuesday, March 2, 2021 6:31 AM
> >     *To:* amd-gfx@lists.freedesktop.org
> >     <mailto:amd-gfx@lists.freedesktop.org>;
> >     dri-devel@lists.freedesktop.org
> >     <mailto:dri-devel@lists.freedesktop.org>; Daniel Vetter
> >     <daniel@ffwll.ch> <mailto:daniel@ffwll.ch>; Dave Airlie
> >     <airlied@redhat.com> <mailto:airlied@redhat.com>; Thomas Hellström
> >     (Intel) <thomas_os@shipmail.org> <mailto:thomas_os@shipmail.org>
> >     *Cc:* Zeng, Oak <Oak.Zeng@amd.com> <mailto:Oak.Zeng@amd.com>;
> >     kbuild-all@lists.01.org <mailto:kbuild-all@lists.01.org>;
> >     Kuehling, Felix <Felix.Kuehling@amd.com>
> >     <mailto:Felix.Kuehling@amd.com>; Kasiviswanathan, Harish
> >     <Harish.Kasiviswanathan@amd.com>
> >     <mailto:Harish.Kasiviswanathan@amd.com>; Deucher, Alexander
> >     <Alexander.Deucher@amd.com> <mailto:Alexander.Deucher@amd.com>;
> >     Huang, JinHuiEric <JinHuiEric.Huang@amd.com>
> >     <mailto:JinHuiEric.Huang@amd.com>; Koenig, Christian
> >     <Christian.Koenig@amd.com> <mailto:Christian.Koenig@amd.com>
> >     *Subject:* Re: [PATCH] drm/ttm: ioremap buffer according to TTM
> >     mem caching setting
> > 
> >     Hi guys,
> > 
> >     adding the usual suspects direct. Does anybody of hand know how to
> >     check if an architecture supports ioremap_cache()?
> > 
> >     For now we only need this on X86, but I would feel better if we
> >     don't use an #ifdef here.
> > 
> >     Regards,
> >     Christian.
> > 
> >     Am 02.03.21 um 05:12 schrieb kernel test robot:
> > 
> >         Hi Oak,
> > 
> > 
> >         Thank you for the patch! Yet something to improve:
> > 
> > 
> >         [auto build test ERROR on drm-intel/for-linux-next]
> > 
> >         [also build test ERROR on drm-tip/drm-tip linus/master v5.12-rc1 next-20210302]
> > 
> >         [cannot apply to tegra-drm/drm/tegra/for-next drm-exynos/exynos-drm-next drm/drm-next]
> > 
> >         [If your patch is applied to the wrong git tree, kindly drop us a note.
> > 
> >         And when submitting patch, we suggest to use '--base' as documented in
> > 
> >         https://git-scm.com/docs/git-format-patch  <https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgit-scm.com%2Fdocs%2Fgit-format-patch&data=04%7C01%7COak.Zeng%40amd.com%7Cc047ecb316df47cde7ed08d8de3188d4%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637503651624306464%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=3f5ib%2FlZ6DXXF%2Bk1rXPKGu1IkOhXHdkUmX3obtuIRtA%3D&reserved=0>]
> > 
> > 
> >         url:https://github.com/0day-ci/linux/commits/Oak-Zeng/drm-ttm-ioremap-buffer-according-to-TTM-mem-caching-setting/20210302-064500  <https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2F0day-ci%2Flinux%2Fcommits%2FOak-Zeng%2Fdrm-ttm-ioremap-buffer-according-to-TTM-mem-caching-setting%2F20210302-064500&data=04%7C01%7COak.Zeng%40amd.com%7Cc047ecb316df47cde7ed08d8de3188d4%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637503651624306464%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=Y9h9ZHM7d2Sqo3XQWr%2Frpb2DAk9SkHFIm5nD4ABFNbE%3D&reserved=0>
> > 
> >         base:   git://anongit.freedesktop.org/drm-intel for-linux-next
> > 
> >         config: parisc-randconfig-r012-20210302 (attached as .config)
> > 
> >         compiler: hppa-linux-gcc (GCC) 9.3.0
> > 
> >         reproduce (this is a W=1 build):
> > 
> >                  wgethttps://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross  <https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fraw.githubusercontent.com%2Fintel%2Flkp-tests%2Fmaster%2Fsbin%2Fmake.cross&data=04%7C01%7COak.Zeng%40amd.com%7Cc047ecb316df47cde7ed08d8de3188d4%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637503651624316464%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=wGo3Nwk4mWZjb2W3E7qKf3FtKzLOxCVmQu1zd2rmzRU%3D&reserved=0>  -O ~/bin/make.cross
> > 
> >                  chmod +x ~/bin/make.cross
> > 
> >                  #https://github.com/0day-ci/linux/commit/225bb3711439ec559dd72ae5af8e62d34ea60a64  <https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2F0day-ci%2Flinux%2Fcommit%2F225bb3711439ec559dd72ae5af8e62d34ea60a64&data=04%7C01%7COak.Zeng%40amd.com%7Cc047ecb316df47cde7ed08d8de3188d4%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637503651624316464%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=kOz18UAawmA4SZ6IrCGRt4HISfsmmjfGN2TUgAtm0Ak%3D&reserved=0>
> > 
> >                  git remote add linux-reviewhttps://github.com/0day-ci/linux  <https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2F0day-ci%2Flinux&data=04%7C01%7COak.Zeng%40amd.com%7Cc047ecb316df47cde7ed08d8de3188d4%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637503651624326458%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=QnKs47gjzAz%2Fjv%2FAO6H%2BwYNQF6mdk1D8dCNveW0YHuM%3D&reserved=0>
> > 
> >                  git fetch --no-tags linux-review Oak-Zeng/drm-ttm-ioremap-buffer-according-to-TTM-mem-caching-setting/20210302-064500
> > 
> >                  git checkout 225bb3711439ec559dd72ae5af8e62d34ea60a64
> > 
> >                  # save the attached .config to linux build tree
> > 
> >                  COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=parisc
> > 
> > 
> >         If you fix the issue, kindly add following tag as appropriate
> > 
> >         Reported-by: kernel test robot<lkp@intel.com>  <mailto:lkp@intel.com>
> > 
> > 
> >         All errors (new ones prefixed by >>):
> > 
> > 
> >             drivers/gpu/drm/ttm/ttm_bo_util.c: In function 'ttm_resource_ioremap':
> > 
> >                 drivers/gpu/drm/ttm/ttm_bo_util.c:95:11: error: implicit declaration of function 'ioremap_cache'; did you mean 'ioremap_uc'? [-Werror=implicit-function-declaration]
> > 
> >                95 |    addr = ioremap_cache(mem->bus.offset, bus_size);
> > 
> >                   |           ^~~~~~~~~~~~~
> > 
> >                   |           ioremap_uc
> > 
> >             drivers/gpu/drm/ttm/ttm_bo_util.c:95:9: warning: assignment to 'void *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
> > 
> >                95 |    addr = ioremap_cache(mem->bus.offset, bus_size);
> > 
> >                   |         ^
> > 
> >             drivers/gpu/drm/ttm/ttm_bo_util.c: In function 'ttm_bo_ioremap':
> > 
> >             drivers/gpu/drm/ttm/ttm_bo_util.c:379:17: warning: assignment to 'void *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
> > 
> >               379 |    map->virtual = ioremap_cache(bo->mem.bus.offset + offset,
> > 
> >                   |                 ^
> > 
> >             drivers/gpu/drm/ttm/ttm_bo_util.c: In function 'ttm_bo_vmap':
> > 
> >             drivers/gpu/drm/ttm/ttm_bo_util.c:500:16: warning: assignment to 'void *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
> > 
> >               500 |    vaddr_iomem = ioremap_cache(mem->bus.offset,
> > 
> >                   |                ^
> > 
> >             cc1: some warnings being treated as errors
> > 
> > 
> > 
> >         vim +95 drivers/gpu/drm/ttm/ttm_bo_util.c
> > 
> > 
> >              74
> > 
> >              75  static int ttm_resource_ioremap(struct ttm_bo_device *bdev,
> > 
> >              76                                struct ttm_resource *mem,
> > 
> >              77                                void **virtual)
> > 
> >              78  {
> > 
> >              79          int ret;
> > 
> >              80          void *addr;
> > 
> >              81
> > 
> >              82          *virtual = NULL;
> > 
> >              83          ret = ttm_mem_io_reserve(bdev, mem);
> > 
> >              84          if (ret || !mem->bus.is_iomem)
> > 
> >              85                  return ret;
> > 
> >              86
> > 
> >              87          if (mem->bus.addr) {
> > 
> >              88                  addr = mem->bus.addr;
> > 
> >              89          } else {
> > 
> >              90                  size_t bus_size = (size_t)mem->num_pages << PAGE_SHIFT;
> > 
> >              91
> > 
> >              92                  if (mem->bus.caching == ttm_write_combined)
> > 
> >              93                         addr = ioremap_wc(mem->bus.offset, bus_size);
> > 
> >              94                  else if (mem->bus.caching == ttm_cached)
> > 
> >            > 95                         addr = ioremap_cache(mem->bus.offset, bus_size);
> > 
> >              96                  else
> > 
> >              97                         addr = ioremap(mem->bus.offset, bus_size);
> > 
> >              98                  if (!addr) {
> > 
> >              99                         ttm_mem_io_free(bdev, mem);
> > 
> >             100                         return -ENOMEM;
> > 
> >             101                  }
> > 
> >             102          }
> > 
> >             103          *virtual = addr;
> > 
> >             104          return 0;
> > 
> >             105  }
> > 
> >             106
> > 
> > 
> >         ---
> > 
> >         0-DAY CI Kernel Test Service, Intel Corporation
> > 
> >         https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org  <https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.01.org%2Fhyperkitty%2Flist%2Fkbuild-all%40lists.01.org&data=04%7C01%7COak.Zeng%40amd.com%7Cc047ecb316df47cde7ed08d8de3188d4%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637503651624326458%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=MY6tEGVY0X4VyS750dYmsfVoR71Zp78YdxuqqRljnsI%3D&reserved=0>
> > 
> > 
> > 
> > 
> >         _______________________________________________
> > 
> >         amd-gfx mailing list
> > 
> >         amd-gfx@lists.freedesktop.org  <mailto:amd-gfx@lists.freedesktop.org>
> > 
> >         https://lists.freedesktop.org/mailman/listinfo/amd-gfx  <https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&data=04%7C01%7COak.Zeng%40amd.com%7Cc047ecb316df47cde7ed08d8de3188d4%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637503651624336455%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=Or3tWmS5M6mXOaFP4FHsEbg0rqoizNGpTl6JEkD6fac%3D&reserved=0>
> > 
> 

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply	[flat|nested] 49+ messages in thread

* Re: [PATCH] drm/ttm: ioremap buffer according to TTM mem caching setting
@ 2021-03-11 13:06               ` Daniel Vetter
  0 siblings, 0 replies; 49+ messages in thread
From: Daniel Vetter @ 2021-03-11 13:06 UTC (permalink / raw)
  To: kbuild-all

[-- Attachment #1: Type: text/plain, Size: 15800 bytes --]

On Thu, Mar 04, 2021 at 08:46:26AM +0100, Christian König wrote:
> Hi Oak,
> 
> as far as I know some architectures like PowerPC/ARM/MIPS need that. And we
> at least officially support PowerPC and ARM and MIPS is best effort and
> shouldn't break if possible.
> 
> Thomas just recently had a whole bunch of DMA-buf patches to also fix that
> up for DMA-bufs vmap as well, previously we have just been casting away the
> __iomem and hoped that it always works.

On that, rolling out struct dma_buf_map to ttm and drivers I think would
clean up a lot of this __iomem handling rather nicely.
-Daniel

> 
> Regards,
> Christian.
> 
> Am 03.03.21 um 21:59 schrieb Zeng, Oak:
> > 
> > [AMD Official Use Only - Internal Distribution Only]
> > 
> > 
> > Hi Christian,
> > 
> > Can you explain why __iomem annotation is mandatory for amdgpu driver?
> > If this is the case, we can’t switch to memremap. The only fix seems to
> > me is add a #ifdef __x86_64__ to the ioremap_cache codes.
> > 
> > Regards,
> > 
> > Oak
> > 
> > *From:* Christian König <ckoenig.leichtzumerken@gmail.com>
> > *Sent:* Wednesday, March 3, 2021 5:46 AM
> > *To:* Zeng, Oak <Oak.Zeng@amd.com>; amd-gfx(a)lists.freedesktop.org;
> > dri-devel(a)lists.freedesktop.org; Daniel Vetter <daniel@ffwll.ch>; Dave
> > Airlie <airlied@redhat.com>; Thomas Hellström (Intel)
> > <thomas_os@shipmail.org>; dan.j.williams(a)intel.com
> > *Cc:* kbuild-all(a)lists.01.org; Kuehling, Felix <Felix.Kuehling@amd.com>;
> > Kasiviswanathan, Harish <Harish.Kasiviswanathan@amd.com>; Deucher,
> > Alexander <Alexander.Deucher@amd.com>; Huang, JinHuiEric
> > <JinHuiEric.Huang@amd.com>; Koenig, Christian <Christian.Koenig@amd.com>
> > *Subject:* Re: [PATCH] drm/ttm: ioremap buffer according to TTM mem
> > caching setting
> > 
> > Hi Oak,
> > 
> > 
> >     config: parisc-randconfig-r012-20210302 (attached as .config)
> > 
> > 
> > It's not the Intel driver build which fails here, but the build bot is
> > just hosted by Intel.
> > 
> > The problem is that the parisc architecture doesn't defines the
> > ioremap_cache() function.
> > 
> > I've looked at using memremap() instead of ioremap_cache(). The problem
> > is that we do support architectures with the TTM as well as amndgpu code
> > where the __iomem annotation is mandatory and correct.
> > 
> > Regards,
> > Christian.
> > 
> > Am 02.03.21 um 23:45 schrieb Zeng, Oak:
> > 
> >     [AMD Official Use Only - Internal Distribution Only]
> > 
> >     Hi Daniel, Thomas, Dan,
> > 
> >     Does below message mean the calling ioremap_cache failed intel’s
> >     driver build? I can see both ioremap_cache and ioremap_wc are
> >     defined in arch/x86/mm/ioremap.c – why ioremap_wc doesn’t break
> >     intel driver’s build?
> > 
> >     Are we supposed to use memremap (offset, size, MEMREMAP_WB) to
> >     replace ioremap_cache? When I read here
> >     https://lwn.net/Articles/653585/
> >     <https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flwn.net%2FArticles%2F653585%2F&data=04%7C01%7COak.Zeng%40amd.com%7Cc047ecb316df47cde7ed08d8de3188d4%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637503651624296472%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=ljCFrIfrYbb%2FXmKKS2TJ7dSQ7oCRNWoUhWS4gEBv%2FW4%3D&reserved=0>
> >     I felt that ioremap_cache returns an address annotated with _iomem
> >     while memremap returns an address without __iomem annotation. In
> >     our use case, GPU memory is treated as UEFI SPM (specific purpose
> >     memory). I am not very sure whether memremap (thus no __iomem
> >     annotation) is the right thing to do. What I am sure is, we have
> >     tested ioremap_cache and it works fine on AMD system.
> > 
> >     I will send out a test patch replacing ioremap_cache with
> >     ioremap_wc, to trigger Intel build robot to see whether it fails
> >     Intel build. I suppose it will not fail Intel build.
> > 
> >     Regards,
> > 
> >     Oak
> > 
> >     *From:* Christian König <ckoenig.leichtzumerken@gmail.com>
> >     <mailto:ckoenig.leichtzumerken@gmail.com>
> >     *Sent:* Tuesday, March 2, 2021 6:31 AM
> >     *To:* amd-gfx(a)lists.freedesktop.org
> >     <mailto:amd-gfx@lists.freedesktop.org>;
> >     dri-devel(a)lists.freedesktop.org
> >     <mailto:dri-devel@lists.freedesktop.org>; Daniel Vetter
> >     <daniel@ffwll.ch> <mailto:daniel@ffwll.ch>; Dave Airlie
> >     <airlied@redhat.com> <mailto:airlied@redhat.com>; Thomas Hellström
> >     (Intel) <thomas_os@shipmail.org> <mailto:thomas_os@shipmail.org>
> >     *Cc:* Zeng, Oak <Oak.Zeng@amd.com> <mailto:Oak.Zeng@amd.com>;
> >     kbuild-all(a)lists.01.org <mailto:kbuild-all@lists.01.org>;
> >     Kuehling, Felix <Felix.Kuehling@amd.com>
> >     <mailto:Felix.Kuehling@amd.com>; Kasiviswanathan, Harish
> >     <Harish.Kasiviswanathan@amd.com>
> >     <mailto:Harish.Kasiviswanathan@amd.com>; Deucher, Alexander
> >     <Alexander.Deucher@amd.com> <mailto:Alexander.Deucher@amd.com>;
> >     Huang, JinHuiEric <JinHuiEric.Huang@amd.com>
> >     <mailto:JinHuiEric.Huang@amd.com>; Koenig, Christian
> >     <Christian.Koenig@amd.com> <mailto:Christian.Koenig@amd.com>
> >     *Subject:* Re: [PATCH] drm/ttm: ioremap buffer according to TTM
> >     mem caching setting
> > 
> >     Hi guys,
> > 
> >     adding the usual suspects direct. Does anybody of hand know how to
> >     check if an architecture supports ioremap_cache()?
> > 
> >     For now we only need this on X86, but I would feel better if we
> >     don't use an #ifdef here.
> > 
> >     Regards,
> >     Christian.
> > 
> >     Am 02.03.21 um 05:12 schrieb kernel test robot:
> > 
> >         Hi Oak,
> > 
> > 
> >         Thank you for the patch! Yet something to improve:
> > 
> > 
> >         [auto build test ERROR on drm-intel/for-linux-next]
> > 
> >         [also build test ERROR on drm-tip/drm-tip linus/master v5.12-rc1 next-20210302]
> > 
> >         [cannot apply to tegra-drm/drm/tegra/for-next drm-exynos/exynos-drm-next drm/drm-next]
> > 
> >         [If your patch is applied to the wrong git tree, kindly drop us a note.
> > 
> >         And when submitting patch, we suggest to use '--base' as documented in
> > 
> >         https://git-scm.com/docs/git-format-patch  <https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgit-scm.com%2Fdocs%2Fgit-format-patch&data=04%7C01%7COak.Zeng%40amd.com%7Cc047ecb316df47cde7ed08d8de3188d4%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637503651624306464%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=3f5ib%2FlZ6DXXF%2Bk1rXPKGu1IkOhXHdkUmX3obtuIRtA%3D&reserved=0>]
> > 
> > 
> >         url:https://github.com/0day-ci/linux/commits/Oak-Zeng/drm-ttm-ioremap-buffer-according-to-TTM-mem-caching-setting/20210302-064500  <https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2F0day-ci%2Flinux%2Fcommits%2FOak-Zeng%2Fdrm-ttm-ioremap-buffer-according-to-TTM-mem-caching-setting%2F20210302-064500&data=04%7C01%7COak.Zeng%40amd.com%7Cc047ecb316df47cde7ed08d8de3188d4%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637503651624306464%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=Y9h9ZHM7d2Sqo3XQWr%2Frpb2DAk9SkHFIm5nD4ABFNbE%3D&reserved=0>
> > 
> >         base:   git://anongit.freedesktop.org/drm-intel for-linux-next
> > 
> >         config: parisc-randconfig-r012-20210302 (attached as .config)
> > 
> >         compiler: hppa-linux-gcc (GCC) 9.3.0
> > 
> >         reproduce (this is a W=1 build):
> > 
> >                  wgethttps://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross  <https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fraw.githubusercontent.com%2Fintel%2Flkp-tests%2Fmaster%2Fsbin%2Fmake.cross&data=04%7C01%7COak.Zeng%40amd.com%7Cc047ecb316df47cde7ed08d8de3188d4%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637503651624316464%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=wGo3Nwk4mWZjb2W3E7qKf3FtKzLOxCVmQu1zd2rmzRU%3D&reserved=0>  -O ~/bin/make.cross
> > 
> >                  chmod +x ~/bin/make.cross
> > 
> >                  #https://github.com/0day-ci/linux/commit/225bb3711439ec559dd72ae5af8e62d34ea60a64  <https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2F0day-ci%2Flinux%2Fcommit%2F225bb3711439ec559dd72ae5af8e62d34ea60a64&data=04%7C01%7COak.Zeng%40amd.com%7Cc047ecb316df47cde7ed08d8de3188d4%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637503651624316464%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=kOz18UAawmA4SZ6IrCGRt4HISfsmmjfGN2TUgAtm0Ak%3D&reserved=0>
> > 
> >                  git remote add linux-reviewhttps://github.com/0day-ci/linux  <https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2F0day-ci%2Flinux&data=04%7C01%7COak.Zeng%40amd.com%7Cc047ecb316df47cde7ed08d8de3188d4%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637503651624326458%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=QnKs47gjzAz%2Fjv%2FAO6H%2BwYNQF6mdk1D8dCNveW0YHuM%3D&reserved=0>
> > 
> >                  git fetch --no-tags linux-review Oak-Zeng/drm-ttm-ioremap-buffer-according-to-TTM-mem-caching-setting/20210302-064500
> > 
> >                  git checkout 225bb3711439ec559dd72ae5af8e62d34ea60a64
> > 
> >                  # save the attached .config to linux build tree
> > 
> >                  COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=parisc
> > 
> > 
> >         If you fix the issue, kindly add following tag as appropriate
> > 
> >         Reported-by: kernel test robot<lkp@intel.com>  <mailto:lkp@intel.com>
> > 
> > 
> >         All errors (new ones prefixed by >>):
> > 
> > 
> >             drivers/gpu/drm/ttm/ttm_bo_util.c: In function 'ttm_resource_ioremap':
> > 
> >                 drivers/gpu/drm/ttm/ttm_bo_util.c:95:11: error: implicit declaration of function 'ioremap_cache'; did you mean 'ioremap_uc'? [-Werror=implicit-function-declaration]
> > 
> >                95 |    addr = ioremap_cache(mem->bus.offset, bus_size);
> > 
> >                   |           ^~~~~~~~~~~~~
> > 
> >                   |           ioremap_uc
> > 
> >             drivers/gpu/drm/ttm/ttm_bo_util.c:95:9: warning: assignment to 'void *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
> > 
> >                95 |    addr = ioremap_cache(mem->bus.offset, bus_size);
> > 
> >                   |         ^
> > 
> >             drivers/gpu/drm/ttm/ttm_bo_util.c: In function 'ttm_bo_ioremap':
> > 
> >             drivers/gpu/drm/ttm/ttm_bo_util.c:379:17: warning: assignment to 'void *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
> > 
> >               379 |    map->virtual = ioremap_cache(bo->mem.bus.offset + offset,
> > 
> >                   |                 ^
> > 
> >             drivers/gpu/drm/ttm/ttm_bo_util.c: In function 'ttm_bo_vmap':
> > 
> >             drivers/gpu/drm/ttm/ttm_bo_util.c:500:16: warning: assignment to 'void *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
> > 
> >               500 |    vaddr_iomem = ioremap_cache(mem->bus.offset,
> > 
> >                   |                ^
> > 
> >             cc1: some warnings being treated as errors
> > 
> > 
> > 
> >         vim +95 drivers/gpu/drm/ttm/ttm_bo_util.c
> > 
> > 
> >              74
> > 
> >              75  static int ttm_resource_ioremap(struct ttm_bo_device *bdev,
> > 
> >              76                                struct ttm_resource *mem,
> > 
> >              77                                void **virtual)
> > 
> >              78  {
> > 
> >              79          int ret;
> > 
> >              80          void *addr;
> > 
> >              81
> > 
> >              82          *virtual = NULL;
> > 
> >              83          ret = ttm_mem_io_reserve(bdev, mem);
> > 
> >              84          if (ret || !mem->bus.is_iomem)
> > 
> >              85                  return ret;
> > 
> >              86
> > 
> >              87          if (mem->bus.addr) {
> > 
> >              88                  addr = mem->bus.addr;
> > 
> >              89          } else {
> > 
> >              90                  size_t bus_size = (size_t)mem->num_pages << PAGE_SHIFT;
> > 
> >              91
> > 
> >              92                  if (mem->bus.caching == ttm_write_combined)
> > 
> >              93                         addr = ioremap_wc(mem->bus.offset, bus_size);
> > 
> >              94                  else if (mem->bus.caching == ttm_cached)
> > 
> >            > 95                         addr = ioremap_cache(mem->bus.offset, bus_size);
> > 
> >              96                  else
> > 
> >              97                         addr = ioremap(mem->bus.offset, bus_size);
> > 
> >              98                  if (!addr) {
> > 
> >              99                         ttm_mem_io_free(bdev, mem);
> > 
> >             100                         return -ENOMEM;
> > 
> >             101                  }
> > 
> >             102          }
> > 
> >             103          *virtual = addr;
> > 
> >             104          return 0;
> > 
> >             105  }
> > 
> >             106
> > 
> > 
> >         ---
> > 
> >         0-DAY CI Kernel Test Service, Intel Corporation
> > 
> >         https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org  <https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.01.org%2Fhyperkitty%2Flist%2Fkbuild-all%40lists.01.org&data=04%7C01%7COak.Zeng%40amd.com%7Cc047ecb316df47cde7ed08d8de3188d4%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637503651624326458%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=MY6tEGVY0X4VyS750dYmsfVoR71Zp78YdxuqqRljnsI%3D&reserved=0>
> > 
> > 
> > 
> > 
> >         _______________________________________________
> > 
> >         amd-gfx mailing list
> > 
> >         amd-gfx(a)lists.freedesktop.org  <mailto:amd-gfx@lists.freedesktop.org>
> > 
> >         https://lists.freedesktop.org/mailman/listinfo/amd-gfx  <https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&data=04%7C01%7COak.Zeng%40amd.com%7Cc047ecb316df47cde7ed08d8de3188d4%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637503651624336455%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=Or3tWmS5M6mXOaFP4FHsEbg0rqoizNGpTl6JEkD6fac%3D&reserved=0>
> > 
> 

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

^ permalink raw reply	[flat|nested] 49+ messages in thread

* [PATCH] drm/ttm: ioremap buffer according to TTM mem caching setting
@ 2021-03-04 19:16 Oak Zeng
  0 siblings, 0 replies; 49+ messages in thread
From: Oak Zeng @ 2021-03-04 19:16 UTC (permalink / raw)
  To: dri-devel; +Cc: Oak Zeng

If tbo.mem.bus.caching is cached, buffer is intended to be mapped
as cached from CPU. Map it with ioremap_cache.

This wasn't necessary before as device memory was never mapped
as cached from CPU side. It becomes necessary for aldebaran as
device memory is mapped cached from CPU.

Signed-off-by: Oak Zeng <Oak.Zeng@amd.com>
Reviewed-by: Christian Konig <Christian.Koenig@amd.com>
---
 drivers/gpu/drm/ttm/ttm_bo_util.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/drivers/gpu/drm/ttm/ttm_bo_util.c b/drivers/gpu/drm/ttm/ttm_bo_util.c
index 031e581..296bb20 100644
--- a/drivers/gpu/drm/ttm/ttm_bo_util.c
+++ b/drivers/gpu/drm/ttm/ttm_bo_util.c
@@ -91,6 +91,10 @@ static int ttm_resource_ioremap(struct ttm_device *bdev,
 
 		if (mem->bus.caching == ttm_write_combined)
 			addr = ioremap_wc(mem->bus.offset, bus_size);
+#ifdef CONFIG_X86
+		else if (mem->bus.caching == ttm_cached)
+			addr = ioremap_cache(mem->bus.offset, bus_size);
+#endif
 		else
 			addr = ioremap(mem->bus.offset, bus_size);
 		if (!addr) {
@@ -372,6 +376,11 @@ static int ttm_bo_ioremap(struct ttm_buffer_object *bo,
 		if (mem->bus.caching == ttm_write_combined)
 			map->virtual = ioremap_wc(bo->mem.bus.offset + offset,
 						  size);
+#ifdef CONFIG_X86
+		else if (mem->bus.caching == ttm_cached)
+			map->virtual = ioremap_cache(bo->mem.bus.offset + offset,
+						  size);
+#endif
 		else
 			map->virtual = ioremap(bo->mem.bus.offset + offset,
 					       size);
@@ -490,6 +499,11 @@ int ttm_bo_vmap(struct ttm_buffer_object *bo, struct dma_buf_map *map)
 		else if (mem->bus.caching == ttm_write_combined)
 			vaddr_iomem = ioremap_wc(mem->bus.offset,
 						 bo->base.size);
+#ifdef CONFIG_X86
+		else if (mem->bus.caching == ttm_cached)
+			vaddr_iomem = ioremap_cache(mem->bus.offset,
+						  bo->base.size);
+#endif
 		else
 			vaddr_iomem = ioremap(mem->bus.offset, bo->base.size);
 
-- 
2.7.4

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

^ permalink raw reply related	[flat|nested] 49+ messages in thread

* Re: [PATCH] drm/ttm: ioremap buffer according to TTM mem caching setting
  2021-03-04 16:04 ` Oak Zeng
@ 2021-03-04 19:04   ` kernel test robot
  -1 siblings, 0 replies; 49+ messages in thread
From: kernel test robot @ 2021-03-04 19:04 UTC (permalink / raw)
  To: Oak Zeng, dri-devel, amd-gfx, brahma_sw_dev
  Cc: Oak Zeng, Felix.Kuehling, harish.kasiviswanathan,
	clang-built-linux, jinhuieric.huang, Alexander.Deucher,
	christian.koenig

[-- Attachment #1: Type: text/plain, Size: 6479 bytes --]

Hi Oak,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on drm-intel/for-linux-next]
[also build test ERROR on drm-tip/drm-tip linus/master v5.12-rc1 next-20210304]
[cannot apply to tegra-drm/drm/tegra/for-next drm-exynos/exynos-drm-next drm/drm-next]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Oak-Zeng/drm-ttm-ioremap-buffer-according-to-TTM-mem-caching-setting/20210305-000626
base:   git://anongit.freedesktop.org/drm-intel for-linux-next
config: arm64-randconfig-r021-20210304 (attached as .config)
compiler: clang version 13.0.0 (https://github.com/llvm/llvm-project eec7f8f7b1226be422a76542cb403d02538f453a)
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # install arm64 cross compiling tool for clang build
        # apt-get install binutils-aarch64-linux-gnu
        # https://github.com/0day-ci/linux/commit/e89ba86e56d95eb097cacfac83b667a92acbf56b
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Oak-Zeng/drm-ttm-ioremap-buffer-according-to-TTM-mem-caching-setting/20210305-000626
        git checkout e89ba86e56d95eb097cacfac83b667a92acbf56b
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=arm64 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All errors (new ones prefixed by >>):

>> drivers/gpu/drm/ttm/ttm_bo_util.c:508:3: error: expected expression
                   else
                   ^
   1 error generated.


vim +508 drivers/gpu/drm/ttm/ttm_bo_util.c

ba4e7d973dd09b66 Thomas Hellstrom  2009-06-10  485  
43676605f890b218 Thomas Zimmermann 2020-11-03  486  int ttm_bo_vmap(struct ttm_buffer_object *bo, struct dma_buf_map *map)
43676605f890b218 Thomas Zimmermann 2020-11-03  487  {
43676605f890b218 Thomas Zimmermann 2020-11-03  488  	struct ttm_resource *mem = &bo->mem;
43676605f890b218 Thomas Zimmermann 2020-11-03  489  	int ret;
43676605f890b218 Thomas Zimmermann 2020-11-03  490  
43676605f890b218 Thomas Zimmermann 2020-11-03  491  	ret = ttm_mem_io_reserve(bo->bdev, mem);
43676605f890b218 Thomas Zimmermann 2020-11-03  492  	if (ret)
43676605f890b218 Thomas Zimmermann 2020-11-03  493  		return ret;
43676605f890b218 Thomas Zimmermann 2020-11-03  494  
43676605f890b218 Thomas Zimmermann 2020-11-03  495  	if (mem->bus.is_iomem) {
43676605f890b218 Thomas Zimmermann 2020-11-03  496  		void __iomem *vaddr_iomem;
43676605f890b218 Thomas Zimmermann 2020-11-03  497  
43676605f890b218 Thomas Zimmermann 2020-11-03  498  		if (mem->bus.addr)
43676605f890b218 Thomas Zimmermann 2020-11-03  499  			vaddr_iomem = (void __iomem *)mem->bus.addr;
43676605f890b218 Thomas Zimmermann 2020-11-03  500  		else if (mem->bus.caching == ttm_write_combined)
e11bfb99d6ece23b Christian König   2020-12-09  501  			vaddr_iomem = ioremap_wc(mem->bus.offset,
e11bfb99d6ece23b Christian König   2020-12-09  502  						 bo->base.size);
e89ba86e56d95eb0 Oak Zeng          2021-03-04  503  		else if (mem->bus.caching == ttm_cached)
e89ba86e56d95eb0 Oak Zeng          2021-03-04  504  #ifdef CONFIG_X86
e89ba86e56d95eb0 Oak Zeng          2021-03-04  505  			vaddr_iomem = ioremap_cache(mem->bus.offset,
e89ba86e56d95eb0 Oak Zeng          2021-03-04  506  						  bo->base.size);
e89ba86e56d95eb0 Oak Zeng          2021-03-04  507  #endif
43676605f890b218 Thomas Zimmermann 2020-11-03 @508  		else
e11bfb99d6ece23b Christian König   2020-12-09  509  			vaddr_iomem = ioremap(mem->bus.offset, bo->base.size);
43676605f890b218 Thomas Zimmermann 2020-11-03  510  
43676605f890b218 Thomas Zimmermann 2020-11-03  511  		if (!vaddr_iomem)
43676605f890b218 Thomas Zimmermann 2020-11-03  512  			return -ENOMEM;
43676605f890b218 Thomas Zimmermann 2020-11-03  513  
43676605f890b218 Thomas Zimmermann 2020-11-03  514  		dma_buf_map_set_vaddr_iomem(map, vaddr_iomem);
43676605f890b218 Thomas Zimmermann 2020-11-03  515  
43676605f890b218 Thomas Zimmermann 2020-11-03  516  	} else {
43676605f890b218 Thomas Zimmermann 2020-11-03  517  		struct ttm_operation_ctx ctx = {
43676605f890b218 Thomas Zimmermann 2020-11-03  518  			.interruptible = false,
43676605f890b218 Thomas Zimmermann 2020-11-03  519  			.no_wait_gpu = false
43676605f890b218 Thomas Zimmermann 2020-11-03  520  		};
43676605f890b218 Thomas Zimmermann 2020-11-03  521  		struct ttm_tt *ttm = bo->ttm;
43676605f890b218 Thomas Zimmermann 2020-11-03  522  		pgprot_t prot;
43676605f890b218 Thomas Zimmermann 2020-11-03  523  		void *vaddr;
43676605f890b218 Thomas Zimmermann 2020-11-03  524  
43676605f890b218 Thomas Zimmermann 2020-11-03  525  		ret = ttm_tt_populate(bo->bdev, ttm, &ctx);
43676605f890b218 Thomas Zimmermann 2020-11-03  526  		if (ret)
43676605f890b218 Thomas Zimmermann 2020-11-03  527  			return ret;
43676605f890b218 Thomas Zimmermann 2020-11-03  528  
43676605f890b218 Thomas Zimmermann 2020-11-03  529  		/*
43676605f890b218 Thomas Zimmermann 2020-11-03  530  		 * We need to use vmap to get the desired page protection
43676605f890b218 Thomas Zimmermann 2020-11-03  531  		 * or to make the buffer object look contiguous.
43676605f890b218 Thomas Zimmermann 2020-11-03  532  		 */
43676605f890b218 Thomas Zimmermann 2020-11-03  533  		prot = ttm_io_prot(bo, mem, PAGE_KERNEL);
e11bfb99d6ece23b Christian König   2020-12-09  534  		vaddr = vmap(ttm->pages, ttm->num_pages, 0, prot);
43676605f890b218 Thomas Zimmermann 2020-11-03  535  		if (!vaddr)
43676605f890b218 Thomas Zimmermann 2020-11-03  536  			return -ENOMEM;
43676605f890b218 Thomas Zimmermann 2020-11-03  537  
43676605f890b218 Thomas Zimmermann 2020-11-03  538  		dma_buf_map_set_vaddr(map, vaddr);
43676605f890b218 Thomas Zimmermann 2020-11-03  539  	}
43676605f890b218 Thomas Zimmermann 2020-11-03  540  
43676605f890b218 Thomas Zimmermann 2020-11-03  541  	return 0;
43676605f890b218 Thomas Zimmermann 2020-11-03  542  }
43676605f890b218 Thomas Zimmermann 2020-11-03  543  EXPORT_SYMBOL(ttm_bo_vmap);
43676605f890b218 Thomas Zimmermann 2020-11-03  544  

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 32097 bytes --]

[-- Attachment #3: Type: text/plain, Size: 160 bytes --]

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

^ permalink raw reply	[flat|nested] 49+ messages in thread

* Re: [PATCH] drm/ttm: ioremap buffer according to TTM mem caching setting
@ 2021-03-04 19:04   ` kernel test robot
  0 siblings, 0 replies; 49+ messages in thread
From: kernel test robot @ 2021-03-04 19:04 UTC (permalink / raw)
  To: Oak Zeng, dri-devel, amd-gfx, brahma_sw_dev
  Cc: Oak Zeng, Felix.Kuehling, harish.kasiviswanathan,
	clang-built-linux, jinhuieric.huang, Alexander.Deucher,
	christian.koenig

[-- Attachment #1: Type: text/plain, Size: 6479 bytes --]

Hi Oak,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on drm-intel/for-linux-next]
[also build test ERROR on drm-tip/drm-tip linus/master v5.12-rc1 next-20210304]
[cannot apply to tegra-drm/drm/tegra/for-next drm-exynos/exynos-drm-next drm/drm-next]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Oak-Zeng/drm-ttm-ioremap-buffer-according-to-TTM-mem-caching-setting/20210305-000626
base:   git://anongit.freedesktop.org/drm-intel for-linux-next
config: arm64-randconfig-r021-20210304 (attached as .config)
compiler: clang version 13.0.0 (https://github.com/llvm/llvm-project eec7f8f7b1226be422a76542cb403d02538f453a)
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # install arm64 cross compiling tool for clang build
        # apt-get install binutils-aarch64-linux-gnu
        # https://github.com/0day-ci/linux/commit/e89ba86e56d95eb097cacfac83b667a92acbf56b
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Oak-Zeng/drm-ttm-ioremap-buffer-according-to-TTM-mem-caching-setting/20210305-000626
        git checkout e89ba86e56d95eb097cacfac83b667a92acbf56b
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=arm64 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All errors (new ones prefixed by >>):

>> drivers/gpu/drm/ttm/ttm_bo_util.c:508:3: error: expected expression
                   else
                   ^
   1 error generated.


vim +508 drivers/gpu/drm/ttm/ttm_bo_util.c

ba4e7d973dd09b66 Thomas Hellstrom  2009-06-10  485  
43676605f890b218 Thomas Zimmermann 2020-11-03  486  int ttm_bo_vmap(struct ttm_buffer_object *bo, struct dma_buf_map *map)
43676605f890b218 Thomas Zimmermann 2020-11-03  487  {
43676605f890b218 Thomas Zimmermann 2020-11-03  488  	struct ttm_resource *mem = &bo->mem;
43676605f890b218 Thomas Zimmermann 2020-11-03  489  	int ret;
43676605f890b218 Thomas Zimmermann 2020-11-03  490  
43676605f890b218 Thomas Zimmermann 2020-11-03  491  	ret = ttm_mem_io_reserve(bo->bdev, mem);
43676605f890b218 Thomas Zimmermann 2020-11-03  492  	if (ret)
43676605f890b218 Thomas Zimmermann 2020-11-03  493  		return ret;
43676605f890b218 Thomas Zimmermann 2020-11-03  494  
43676605f890b218 Thomas Zimmermann 2020-11-03  495  	if (mem->bus.is_iomem) {
43676605f890b218 Thomas Zimmermann 2020-11-03  496  		void __iomem *vaddr_iomem;
43676605f890b218 Thomas Zimmermann 2020-11-03  497  
43676605f890b218 Thomas Zimmermann 2020-11-03  498  		if (mem->bus.addr)
43676605f890b218 Thomas Zimmermann 2020-11-03  499  			vaddr_iomem = (void __iomem *)mem->bus.addr;
43676605f890b218 Thomas Zimmermann 2020-11-03  500  		else if (mem->bus.caching == ttm_write_combined)
e11bfb99d6ece23b Christian König   2020-12-09  501  			vaddr_iomem = ioremap_wc(mem->bus.offset,
e11bfb99d6ece23b Christian König   2020-12-09  502  						 bo->base.size);
e89ba86e56d95eb0 Oak Zeng          2021-03-04  503  		else if (mem->bus.caching == ttm_cached)
e89ba86e56d95eb0 Oak Zeng          2021-03-04  504  #ifdef CONFIG_X86
e89ba86e56d95eb0 Oak Zeng          2021-03-04  505  			vaddr_iomem = ioremap_cache(mem->bus.offset,
e89ba86e56d95eb0 Oak Zeng          2021-03-04  506  						  bo->base.size);
e89ba86e56d95eb0 Oak Zeng          2021-03-04  507  #endif
43676605f890b218 Thomas Zimmermann 2020-11-03 @508  		else
e11bfb99d6ece23b Christian König   2020-12-09  509  			vaddr_iomem = ioremap(mem->bus.offset, bo->base.size);
43676605f890b218 Thomas Zimmermann 2020-11-03  510  
43676605f890b218 Thomas Zimmermann 2020-11-03  511  		if (!vaddr_iomem)
43676605f890b218 Thomas Zimmermann 2020-11-03  512  			return -ENOMEM;
43676605f890b218 Thomas Zimmermann 2020-11-03  513  
43676605f890b218 Thomas Zimmermann 2020-11-03  514  		dma_buf_map_set_vaddr_iomem(map, vaddr_iomem);
43676605f890b218 Thomas Zimmermann 2020-11-03  515  
43676605f890b218 Thomas Zimmermann 2020-11-03  516  	} else {
43676605f890b218 Thomas Zimmermann 2020-11-03  517  		struct ttm_operation_ctx ctx = {
43676605f890b218 Thomas Zimmermann 2020-11-03  518  			.interruptible = false,
43676605f890b218 Thomas Zimmermann 2020-11-03  519  			.no_wait_gpu = false
43676605f890b218 Thomas Zimmermann 2020-11-03  520  		};
43676605f890b218 Thomas Zimmermann 2020-11-03  521  		struct ttm_tt *ttm = bo->ttm;
43676605f890b218 Thomas Zimmermann 2020-11-03  522  		pgprot_t prot;
43676605f890b218 Thomas Zimmermann 2020-11-03  523  		void *vaddr;
43676605f890b218 Thomas Zimmermann 2020-11-03  524  
43676605f890b218 Thomas Zimmermann 2020-11-03  525  		ret = ttm_tt_populate(bo->bdev, ttm, &ctx);
43676605f890b218 Thomas Zimmermann 2020-11-03  526  		if (ret)
43676605f890b218 Thomas Zimmermann 2020-11-03  527  			return ret;
43676605f890b218 Thomas Zimmermann 2020-11-03  528  
43676605f890b218 Thomas Zimmermann 2020-11-03  529  		/*
43676605f890b218 Thomas Zimmermann 2020-11-03  530  		 * We need to use vmap to get the desired page protection
43676605f890b218 Thomas Zimmermann 2020-11-03  531  		 * or to make the buffer object look contiguous.
43676605f890b218 Thomas Zimmermann 2020-11-03  532  		 */
43676605f890b218 Thomas Zimmermann 2020-11-03  533  		prot = ttm_io_prot(bo, mem, PAGE_KERNEL);
e11bfb99d6ece23b Christian König   2020-12-09  534  		vaddr = vmap(ttm->pages, ttm->num_pages, 0, prot);
43676605f890b218 Thomas Zimmermann 2020-11-03  535  		if (!vaddr)
43676605f890b218 Thomas Zimmermann 2020-11-03  536  			return -ENOMEM;
43676605f890b218 Thomas Zimmermann 2020-11-03  537  
43676605f890b218 Thomas Zimmermann 2020-11-03  538  		dma_buf_map_set_vaddr(map, vaddr);
43676605f890b218 Thomas Zimmermann 2020-11-03  539  	}
43676605f890b218 Thomas Zimmermann 2020-11-03  540  
43676605f890b218 Thomas Zimmermann 2020-11-03  541  	return 0;
43676605f890b218 Thomas Zimmermann 2020-11-03  542  }
43676605f890b218 Thomas Zimmermann 2020-11-03  543  EXPORT_SYMBOL(ttm_bo_vmap);
43676605f890b218 Thomas Zimmermann 2020-11-03  544  

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 32097 bytes --]

[-- Attachment #3: Type: text/plain, Size: 154 bytes --]

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply	[flat|nested] 49+ messages in thread

* Re: [PATCH] drm/ttm: ioremap buffer according to TTM mem caching setting
  2021-03-04 16:04 ` Oak Zeng
@ 2021-03-04 19:00   ` kernel test robot
  -1 siblings, 0 replies; 49+ messages in thread
From: kernel test robot @ 2021-03-04 19:00 UTC (permalink / raw)
  To: Oak Zeng, dri-devel, amd-gfx, brahma_sw_dev
  Cc: Felix.Kuehling, harish.kasiviswanathan, christian.koenig,
	Alexander.Deucher, jinhuieric.huang, Oak Zeng

[-- Attachment #1: Type: text/plain, Size: 6218 bytes --]

Hi Oak,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on drm-intel/for-linux-next]
[also build test ERROR on drm-tip/drm-tip linus/master v5.12-rc1 next-20210304]
[cannot apply to tegra-drm/drm/tegra/for-next drm-exynos/exynos-drm-next drm/drm-next]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Oak-Zeng/drm-ttm-ioremap-buffer-according-to-TTM-mem-caching-setting/20210305-000626
base:   git://anongit.freedesktop.org/drm-intel for-linux-next
config: arm-defconfig (attached as .config)
compiler: arm-linux-gnueabi-gcc (GCC) 9.3.0
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # https://github.com/0day-ci/linux/commit/e89ba86e56d95eb097cacfac83b667a92acbf56b
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Oak-Zeng/drm-ttm-ioremap-buffer-according-to-TTM-mem-caching-setting/20210305-000626
        git checkout e89ba86e56d95eb097cacfac83b667a92acbf56b
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=arm 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All errors (new ones prefixed by >>):

   drivers/gpu/drm/ttm/ttm_bo_util.c: In function 'ttm_bo_vmap':
>> drivers/gpu/drm/ttm/ttm_bo_util.c:508:3: error: expected expression before 'else'
     508 |   else
         |   ^~~~


vim +/else +508 drivers/gpu/drm/ttm/ttm_bo_util.c

ba4e7d973dd09b Thomas Hellstrom  2009-06-10  485  
43676605f890b2 Thomas Zimmermann 2020-11-03  486  int ttm_bo_vmap(struct ttm_buffer_object *bo, struct dma_buf_map *map)
43676605f890b2 Thomas Zimmermann 2020-11-03  487  {
43676605f890b2 Thomas Zimmermann 2020-11-03  488  	struct ttm_resource *mem = &bo->mem;
43676605f890b2 Thomas Zimmermann 2020-11-03  489  	int ret;
43676605f890b2 Thomas Zimmermann 2020-11-03  490  
43676605f890b2 Thomas Zimmermann 2020-11-03  491  	ret = ttm_mem_io_reserve(bo->bdev, mem);
43676605f890b2 Thomas Zimmermann 2020-11-03  492  	if (ret)
43676605f890b2 Thomas Zimmermann 2020-11-03  493  		return ret;
43676605f890b2 Thomas Zimmermann 2020-11-03  494  
43676605f890b2 Thomas Zimmermann 2020-11-03  495  	if (mem->bus.is_iomem) {
43676605f890b2 Thomas Zimmermann 2020-11-03  496  		void __iomem *vaddr_iomem;
43676605f890b2 Thomas Zimmermann 2020-11-03  497  
43676605f890b2 Thomas Zimmermann 2020-11-03  498  		if (mem->bus.addr)
43676605f890b2 Thomas Zimmermann 2020-11-03  499  			vaddr_iomem = (void __iomem *)mem->bus.addr;
43676605f890b2 Thomas Zimmermann 2020-11-03  500  		else if (mem->bus.caching == ttm_write_combined)
e11bfb99d6ece2 Christian König   2020-12-09  501  			vaddr_iomem = ioremap_wc(mem->bus.offset,
e11bfb99d6ece2 Christian König   2020-12-09  502  						 bo->base.size);
e89ba86e56d95e Oak Zeng          2021-03-04  503  		else if (mem->bus.caching == ttm_cached)
e89ba86e56d95e Oak Zeng          2021-03-04  504  #ifdef CONFIG_X86
e89ba86e56d95e Oak Zeng          2021-03-04  505  			vaddr_iomem = ioremap_cache(mem->bus.offset,
e89ba86e56d95e Oak Zeng          2021-03-04  506  						  bo->base.size);
e89ba86e56d95e Oak Zeng          2021-03-04  507  #endif
43676605f890b2 Thomas Zimmermann 2020-11-03 @508  		else
e11bfb99d6ece2 Christian König   2020-12-09  509  			vaddr_iomem = ioremap(mem->bus.offset, bo->base.size);
43676605f890b2 Thomas Zimmermann 2020-11-03  510  
43676605f890b2 Thomas Zimmermann 2020-11-03  511  		if (!vaddr_iomem)
43676605f890b2 Thomas Zimmermann 2020-11-03  512  			return -ENOMEM;
43676605f890b2 Thomas Zimmermann 2020-11-03  513  
43676605f890b2 Thomas Zimmermann 2020-11-03  514  		dma_buf_map_set_vaddr_iomem(map, vaddr_iomem);
43676605f890b2 Thomas Zimmermann 2020-11-03  515  
43676605f890b2 Thomas Zimmermann 2020-11-03  516  	} else {
43676605f890b2 Thomas Zimmermann 2020-11-03  517  		struct ttm_operation_ctx ctx = {
43676605f890b2 Thomas Zimmermann 2020-11-03  518  			.interruptible = false,
43676605f890b2 Thomas Zimmermann 2020-11-03  519  			.no_wait_gpu = false
43676605f890b2 Thomas Zimmermann 2020-11-03  520  		};
43676605f890b2 Thomas Zimmermann 2020-11-03  521  		struct ttm_tt *ttm = bo->ttm;
43676605f890b2 Thomas Zimmermann 2020-11-03  522  		pgprot_t prot;
43676605f890b2 Thomas Zimmermann 2020-11-03  523  		void *vaddr;
43676605f890b2 Thomas Zimmermann 2020-11-03  524  
43676605f890b2 Thomas Zimmermann 2020-11-03  525  		ret = ttm_tt_populate(bo->bdev, ttm, &ctx);
43676605f890b2 Thomas Zimmermann 2020-11-03  526  		if (ret)
43676605f890b2 Thomas Zimmermann 2020-11-03  527  			return ret;
43676605f890b2 Thomas Zimmermann 2020-11-03  528  
43676605f890b2 Thomas Zimmermann 2020-11-03  529  		/*
43676605f890b2 Thomas Zimmermann 2020-11-03  530  		 * We need to use vmap to get the desired page protection
43676605f890b2 Thomas Zimmermann 2020-11-03  531  		 * or to make the buffer object look contiguous.
43676605f890b2 Thomas Zimmermann 2020-11-03  532  		 */
43676605f890b2 Thomas Zimmermann 2020-11-03  533  		prot = ttm_io_prot(bo, mem, PAGE_KERNEL);
e11bfb99d6ece2 Christian König   2020-12-09  534  		vaddr = vmap(ttm->pages, ttm->num_pages, 0, prot);
43676605f890b2 Thomas Zimmermann 2020-11-03  535  		if (!vaddr)
43676605f890b2 Thomas Zimmermann 2020-11-03  536  			return -ENOMEM;
43676605f890b2 Thomas Zimmermann 2020-11-03  537  
43676605f890b2 Thomas Zimmermann 2020-11-03  538  		dma_buf_map_set_vaddr(map, vaddr);
43676605f890b2 Thomas Zimmermann 2020-11-03  539  	}
43676605f890b2 Thomas Zimmermann 2020-11-03  540  
43676605f890b2 Thomas Zimmermann 2020-11-03  541  	return 0;
43676605f890b2 Thomas Zimmermann 2020-11-03  542  }
43676605f890b2 Thomas Zimmermann 2020-11-03  543  EXPORT_SYMBOL(ttm_bo_vmap);
43676605f890b2 Thomas Zimmermann 2020-11-03  544  

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 54144 bytes --]

[-- Attachment #3: Type: text/plain, Size: 160 bytes --]

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

^ permalink raw reply	[flat|nested] 49+ messages in thread

* Re: [PATCH] drm/ttm: ioremap buffer according to TTM mem caching setting
@ 2021-03-04 19:00   ` kernel test robot
  0 siblings, 0 replies; 49+ messages in thread
From: kernel test robot @ 2021-03-04 19:00 UTC (permalink / raw)
  To: Oak Zeng, dri-devel, amd-gfx, brahma_sw_dev
  Cc: Felix.Kuehling, harish.kasiviswanathan, christian.koenig,
	Alexander.Deucher, jinhuieric.huang, Oak Zeng

[-- Attachment #1: Type: text/plain, Size: 6218 bytes --]

Hi Oak,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on drm-intel/for-linux-next]
[also build test ERROR on drm-tip/drm-tip linus/master v5.12-rc1 next-20210304]
[cannot apply to tegra-drm/drm/tegra/for-next drm-exynos/exynos-drm-next drm/drm-next]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Oak-Zeng/drm-ttm-ioremap-buffer-according-to-TTM-mem-caching-setting/20210305-000626
base:   git://anongit.freedesktop.org/drm-intel for-linux-next
config: arm-defconfig (attached as .config)
compiler: arm-linux-gnueabi-gcc (GCC) 9.3.0
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # https://github.com/0day-ci/linux/commit/e89ba86e56d95eb097cacfac83b667a92acbf56b
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Oak-Zeng/drm-ttm-ioremap-buffer-according-to-TTM-mem-caching-setting/20210305-000626
        git checkout e89ba86e56d95eb097cacfac83b667a92acbf56b
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=arm 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All errors (new ones prefixed by >>):

   drivers/gpu/drm/ttm/ttm_bo_util.c: In function 'ttm_bo_vmap':
>> drivers/gpu/drm/ttm/ttm_bo_util.c:508:3: error: expected expression before 'else'
     508 |   else
         |   ^~~~


vim +/else +508 drivers/gpu/drm/ttm/ttm_bo_util.c

ba4e7d973dd09b Thomas Hellstrom  2009-06-10  485  
43676605f890b2 Thomas Zimmermann 2020-11-03  486  int ttm_bo_vmap(struct ttm_buffer_object *bo, struct dma_buf_map *map)
43676605f890b2 Thomas Zimmermann 2020-11-03  487  {
43676605f890b2 Thomas Zimmermann 2020-11-03  488  	struct ttm_resource *mem = &bo->mem;
43676605f890b2 Thomas Zimmermann 2020-11-03  489  	int ret;
43676605f890b2 Thomas Zimmermann 2020-11-03  490  
43676605f890b2 Thomas Zimmermann 2020-11-03  491  	ret = ttm_mem_io_reserve(bo->bdev, mem);
43676605f890b2 Thomas Zimmermann 2020-11-03  492  	if (ret)
43676605f890b2 Thomas Zimmermann 2020-11-03  493  		return ret;
43676605f890b2 Thomas Zimmermann 2020-11-03  494  
43676605f890b2 Thomas Zimmermann 2020-11-03  495  	if (mem->bus.is_iomem) {
43676605f890b2 Thomas Zimmermann 2020-11-03  496  		void __iomem *vaddr_iomem;
43676605f890b2 Thomas Zimmermann 2020-11-03  497  
43676605f890b2 Thomas Zimmermann 2020-11-03  498  		if (mem->bus.addr)
43676605f890b2 Thomas Zimmermann 2020-11-03  499  			vaddr_iomem = (void __iomem *)mem->bus.addr;
43676605f890b2 Thomas Zimmermann 2020-11-03  500  		else if (mem->bus.caching == ttm_write_combined)
e11bfb99d6ece2 Christian König   2020-12-09  501  			vaddr_iomem = ioremap_wc(mem->bus.offset,
e11bfb99d6ece2 Christian König   2020-12-09  502  						 bo->base.size);
e89ba86e56d95e Oak Zeng          2021-03-04  503  		else if (mem->bus.caching == ttm_cached)
e89ba86e56d95e Oak Zeng          2021-03-04  504  #ifdef CONFIG_X86
e89ba86e56d95e Oak Zeng          2021-03-04  505  			vaddr_iomem = ioremap_cache(mem->bus.offset,
e89ba86e56d95e Oak Zeng          2021-03-04  506  						  bo->base.size);
e89ba86e56d95e Oak Zeng          2021-03-04  507  #endif
43676605f890b2 Thomas Zimmermann 2020-11-03 @508  		else
e11bfb99d6ece2 Christian König   2020-12-09  509  			vaddr_iomem = ioremap(mem->bus.offset, bo->base.size);
43676605f890b2 Thomas Zimmermann 2020-11-03  510  
43676605f890b2 Thomas Zimmermann 2020-11-03  511  		if (!vaddr_iomem)
43676605f890b2 Thomas Zimmermann 2020-11-03  512  			return -ENOMEM;
43676605f890b2 Thomas Zimmermann 2020-11-03  513  
43676605f890b2 Thomas Zimmermann 2020-11-03  514  		dma_buf_map_set_vaddr_iomem(map, vaddr_iomem);
43676605f890b2 Thomas Zimmermann 2020-11-03  515  
43676605f890b2 Thomas Zimmermann 2020-11-03  516  	} else {
43676605f890b2 Thomas Zimmermann 2020-11-03  517  		struct ttm_operation_ctx ctx = {
43676605f890b2 Thomas Zimmermann 2020-11-03  518  			.interruptible = false,
43676605f890b2 Thomas Zimmermann 2020-11-03  519  			.no_wait_gpu = false
43676605f890b2 Thomas Zimmermann 2020-11-03  520  		};
43676605f890b2 Thomas Zimmermann 2020-11-03  521  		struct ttm_tt *ttm = bo->ttm;
43676605f890b2 Thomas Zimmermann 2020-11-03  522  		pgprot_t prot;
43676605f890b2 Thomas Zimmermann 2020-11-03  523  		void *vaddr;
43676605f890b2 Thomas Zimmermann 2020-11-03  524  
43676605f890b2 Thomas Zimmermann 2020-11-03  525  		ret = ttm_tt_populate(bo->bdev, ttm, &ctx);
43676605f890b2 Thomas Zimmermann 2020-11-03  526  		if (ret)
43676605f890b2 Thomas Zimmermann 2020-11-03  527  			return ret;
43676605f890b2 Thomas Zimmermann 2020-11-03  528  
43676605f890b2 Thomas Zimmermann 2020-11-03  529  		/*
43676605f890b2 Thomas Zimmermann 2020-11-03  530  		 * We need to use vmap to get the desired page protection
43676605f890b2 Thomas Zimmermann 2020-11-03  531  		 * or to make the buffer object look contiguous.
43676605f890b2 Thomas Zimmermann 2020-11-03  532  		 */
43676605f890b2 Thomas Zimmermann 2020-11-03  533  		prot = ttm_io_prot(bo, mem, PAGE_KERNEL);
e11bfb99d6ece2 Christian König   2020-12-09  534  		vaddr = vmap(ttm->pages, ttm->num_pages, 0, prot);
43676605f890b2 Thomas Zimmermann 2020-11-03  535  		if (!vaddr)
43676605f890b2 Thomas Zimmermann 2020-11-03  536  			return -ENOMEM;
43676605f890b2 Thomas Zimmermann 2020-11-03  537  
43676605f890b2 Thomas Zimmermann 2020-11-03  538  		dma_buf_map_set_vaddr(map, vaddr);
43676605f890b2 Thomas Zimmermann 2020-11-03  539  	}
43676605f890b2 Thomas Zimmermann 2020-11-03  540  
43676605f890b2 Thomas Zimmermann 2020-11-03  541  	return 0;
43676605f890b2 Thomas Zimmermann 2020-11-03  542  }
43676605f890b2 Thomas Zimmermann 2020-11-03  543  EXPORT_SYMBOL(ttm_bo_vmap);
43676605f890b2 Thomas Zimmermann 2020-11-03  544  

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 54144 bytes --]

[-- Attachment #3: Type: text/plain, Size: 154 bytes --]

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply	[flat|nested] 49+ messages in thread

* Re: [PATCH] drm/ttm: ioremap buffer according to TTM mem caching setting
  2021-03-04 17:40       ` Bhardwaj, Rajneesh
@ 2021-03-04 18:05         ` Christian König
  -1 siblings, 0 replies; 49+ messages in thread
From: Christian König @ 2021-03-04 18:05 UTC (permalink / raw)
  To: Bhardwaj, Rajneesh, Oak Zeng, dri-devel, amd-gfx, brahma_sw_dev
  Cc: Alexander.Deucher, jinhuieric.huang, Felix.Kuehling,
	harish.kasiviswanathan, christian.koenig



Am 04.03.21 um 18:40 schrieb Bhardwaj, Rajneesh:
>
> On 3/4/2021 12:31 PM, Christian König wrote:
>> [CAUTION: External Email]
>>
>> Am 04.03.21 um 18:01 schrieb Bhardwaj, Rajneesh:
>>> I was wondering if a managed version of such API exists but looks like
>>> none. We only have devm_ioremap_wc but that is valid only for
>>> PAGE_CACHE_MODE_WC whereas ioremap_cache uses _WB. One more small
>>> comment below.
>>>
>>>
>>> Acked-by: Rajneesh Bhardwaj <rajneesh.bhardwaj@amd.com>
>>>
>>> On 3/4/2021 11:04 AM, Oak Zeng wrote:
>>>> If tbo.mem.bus.caching is cached, buffer is intended to be mapped
>>>> as cached from CPU. Map it with ioremap_cache.
>>>>
>>>> This wasn't necessary before as device memory was never mapped
>>>> as cached from CPU side. It becomes necessary for aldebaran as
>>>> device memory is mapped cached from CPU.
>>>>
>>>> Signed-off-by: Oak Zeng <Oak.Zeng@amd.com>
>>>> Reviewed-by: Christian Konig <Christian.Koenig@amd.com>
>>>> ---
>>>>   drivers/gpu/drm/ttm/ttm_bo_util.c | 14 ++++++++++++++
>>>>   1 file changed, 14 insertions(+)
>>>>
>>>> diff --git a/drivers/gpu/drm/ttm/ttm_bo_util.c
>>>> b/drivers/gpu/drm/ttm/ttm_bo_util.c
>>>> index 031e581..7429464 100644
>>>> --- a/drivers/gpu/drm/ttm/ttm_bo_util.c
>>>> +++ b/drivers/gpu/drm/ttm/ttm_bo_util.c
>>>> @@ -91,6 +91,10 @@ static int ttm_resource_ioremap(struct ttm_device
>>>> *bdev,
>>>>             if (mem->bus.caching == ttm_write_combined)
>>>>               addr = ioremap_wc(mem->bus.offset, bus_size);
>>>> +#ifdef CONFIG_X86
>>>
>>>
>>> Please use #if defined (CONFIG_X86)
>>
>> Actually #ifdef is usually preferred.
>
> oops, i was referring to IS_ENABLED (CONFIG) and not if defined.

Well, that is indeed a good idea for most config options.

But in this case #ifdef alone should work as well.

Christian.

>
>
>>
>> Christian.
>>
>>>
>>>> +        else if (mem->bus.caching == ttm_cached)
>>>> +            addr = ioremap_cache(mem->bus.offset, bus_size);
>>>> +#endif
>>>>           else
>>>>               addr = ioremap(mem->bus.offset, bus_size);
>>>>           if (!addr) {
>>>> @@ -372,6 +376,11 @@ static int ttm_bo_ioremap(struct
>>>> ttm_buffer_object *bo,
>>>>           if (mem->bus.caching == ttm_write_combined)
>>>>               map->virtual = ioremap_wc(bo->mem.bus.offset + offset,
>>>>                             size);
>>>> +#ifdef CONFIG_X86
>>>> +        else if (mem->bus.caching == ttm_cached)
>>>> +            map->virtual = ioremap_cache(bo->mem.bus.offset + offset,
>>>> +                          size);
>>>> +#endif
>>>>           else
>>>>               map->virtual = ioremap(bo->mem.bus.offset + offset,
>>>>                              size);
>>>> @@ -490,6 +499,11 @@ int ttm_bo_vmap(struct ttm_buffer_object *bo,
>>>> struct dma_buf_map *map)
>>>>           else if (mem->bus.caching == ttm_write_combined)
>>>>               vaddr_iomem = ioremap_wc(mem->bus.offset,
>>>>                            bo->base.size);
>>>> +        else if (mem->bus.caching == ttm_cached)
>>>> +#ifdef CONFIG_X86
>>>> +            vaddr_iomem = ioremap_cache(mem->bus.offset,
>>>> +                          bo->base.size);
>>>> +#endif
>>>>           else
>>>>               vaddr_iomem = ioremap(mem->bus.offset, bo->base.size);
>>> _______________________________________________
>>> amd-gfx mailing list
>>> amd-gfx@lists.freedesktop.org
>>> https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&amp;data=04%7C01%7Crajneesh.bhardwaj%40amd.com%7Cc4386544ea10487d3a0c08d8df3363a1%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637504759264793970%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&amp;sdata=nM2UtQQdActyapfZSrhfx%2BoJ%2BdszV4Yp62LTehsUWwY%3D&amp;reserved=0 
>>>
>>

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

^ permalink raw reply	[flat|nested] 49+ messages in thread

* Re: [PATCH] drm/ttm: ioremap buffer according to TTM mem caching setting
@ 2021-03-04 18:05         ` Christian König
  0 siblings, 0 replies; 49+ messages in thread
From: Christian König @ 2021-03-04 18:05 UTC (permalink / raw)
  To: Bhardwaj, Rajneesh, Oak Zeng, dri-devel, amd-gfx, brahma_sw_dev
  Cc: Alexander.Deucher, jinhuieric.huang, Felix.Kuehling,
	harish.kasiviswanathan, christian.koenig



Am 04.03.21 um 18:40 schrieb Bhardwaj, Rajneesh:
>
> On 3/4/2021 12:31 PM, Christian König wrote:
>> [CAUTION: External Email]
>>
>> Am 04.03.21 um 18:01 schrieb Bhardwaj, Rajneesh:
>>> I was wondering if a managed version of such API exists but looks like
>>> none. We only have devm_ioremap_wc but that is valid only for
>>> PAGE_CACHE_MODE_WC whereas ioremap_cache uses _WB. One more small
>>> comment below.
>>>
>>>
>>> Acked-by: Rajneesh Bhardwaj <rajneesh.bhardwaj@amd.com>
>>>
>>> On 3/4/2021 11:04 AM, Oak Zeng wrote:
>>>> If tbo.mem.bus.caching is cached, buffer is intended to be mapped
>>>> as cached from CPU. Map it with ioremap_cache.
>>>>
>>>> This wasn't necessary before as device memory was never mapped
>>>> as cached from CPU side. It becomes necessary for aldebaran as
>>>> device memory is mapped cached from CPU.
>>>>
>>>> Signed-off-by: Oak Zeng <Oak.Zeng@amd.com>
>>>> Reviewed-by: Christian Konig <Christian.Koenig@amd.com>
>>>> ---
>>>>   drivers/gpu/drm/ttm/ttm_bo_util.c | 14 ++++++++++++++
>>>>   1 file changed, 14 insertions(+)
>>>>
>>>> diff --git a/drivers/gpu/drm/ttm/ttm_bo_util.c
>>>> b/drivers/gpu/drm/ttm/ttm_bo_util.c
>>>> index 031e581..7429464 100644
>>>> --- a/drivers/gpu/drm/ttm/ttm_bo_util.c
>>>> +++ b/drivers/gpu/drm/ttm/ttm_bo_util.c
>>>> @@ -91,6 +91,10 @@ static int ttm_resource_ioremap(struct ttm_device
>>>> *bdev,
>>>>             if (mem->bus.caching == ttm_write_combined)
>>>>               addr = ioremap_wc(mem->bus.offset, bus_size);
>>>> +#ifdef CONFIG_X86
>>>
>>>
>>> Please use #if defined (CONFIG_X86)
>>
>> Actually #ifdef is usually preferred.
>
> oops, i was referring to IS_ENABLED (CONFIG) and not if defined.

Well, that is indeed a good idea for most config options.

But in this case #ifdef alone should work as well.

Christian.

>
>
>>
>> Christian.
>>
>>>
>>>> +        else if (mem->bus.caching == ttm_cached)
>>>> +            addr = ioremap_cache(mem->bus.offset, bus_size);
>>>> +#endif
>>>>           else
>>>>               addr = ioremap(mem->bus.offset, bus_size);
>>>>           if (!addr) {
>>>> @@ -372,6 +376,11 @@ static int ttm_bo_ioremap(struct
>>>> ttm_buffer_object *bo,
>>>>           if (mem->bus.caching == ttm_write_combined)
>>>>               map->virtual = ioremap_wc(bo->mem.bus.offset + offset,
>>>>                             size);
>>>> +#ifdef CONFIG_X86
>>>> +        else if (mem->bus.caching == ttm_cached)
>>>> +            map->virtual = ioremap_cache(bo->mem.bus.offset + offset,
>>>> +                          size);
>>>> +#endif
>>>>           else
>>>>               map->virtual = ioremap(bo->mem.bus.offset + offset,
>>>>                              size);
>>>> @@ -490,6 +499,11 @@ int ttm_bo_vmap(struct ttm_buffer_object *bo,
>>>> struct dma_buf_map *map)
>>>>           else if (mem->bus.caching == ttm_write_combined)
>>>>               vaddr_iomem = ioremap_wc(mem->bus.offset,
>>>>                            bo->base.size);
>>>> +        else if (mem->bus.caching == ttm_cached)
>>>> +#ifdef CONFIG_X86
>>>> +            vaddr_iomem = ioremap_cache(mem->bus.offset,
>>>> +                          bo->base.size);
>>>> +#endif
>>>>           else
>>>>               vaddr_iomem = ioremap(mem->bus.offset, bo->base.size);
>>> _______________________________________________
>>> amd-gfx mailing list
>>> amd-gfx@lists.freedesktop.org
>>> https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&amp;data=04%7C01%7Crajneesh.bhardwaj%40amd.com%7Cc4386544ea10487d3a0c08d8df3363a1%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637504759264793970%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&amp;sdata=nM2UtQQdActyapfZSrhfx%2BoJ%2BdszV4Yp62LTehsUWwY%3D&amp;reserved=0 
>>>
>>

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply	[flat|nested] 49+ messages in thread

* Re: [PATCH] drm/ttm: ioremap buffer according to TTM mem caching setting
  2021-03-04 17:31     ` Christian König
@ 2021-03-04 17:40       ` Bhardwaj, Rajneesh
  -1 siblings, 0 replies; 49+ messages in thread
From: Bhardwaj, Rajneesh @ 2021-03-04 17:40 UTC (permalink / raw)
  To: Christian König, Oak Zeng, dri-devel, amd-gfx, brahma_sw_dev
  Cc: Alexander.Deucher, jinhuieric.huang, Felix.Kuehling,
	harish.kasiviswanathan, christian.koenig


On 3/4/2021 12:31 PM, Christian König wrote:
> [CAUTION: External Email]
>
> Am 04.03.21 um 18:01 schrieb Bhardwaj, Rajneesh:
>> I was wondering if a managed version of such API exists but looks like
>> none. We only have devm_ioremap_wc but that is valid only for
>> PAGE_CACHE_MODE_WC whereas ioremap_cache uses _WB. One more small
>> comment below.
>>
>>
>> Acked-by: Rajneesh Bhardwaj <rajneesh.bhardwaj@amd.com>
>>
>> On 3/4/2021 11:04 AM, Oak Zeng wrote:
>>> If tbo.mem.bus.caching is cached, buffer is intended to be mapped
>>> as cached from CPU. Map it with ioremap_cache.
>>>
>>> This wasn't necessary before as device memory was never mapped
>>> as cached from CPU side. It becomes necessary for aldebaran as
>>> device memory is mapped cached from CPU.
>>>
>>> Signed-off-by: Oak Zeng <Oak.Zeng@amd.com>
>>> Reviewed-by: Christian Konig <Christian.Koenig@amd.com>
>>> ---
>>>   drivers/gpu/drm/ttm/ttm_bo_util.c | 14 ++++++++++++++
>>>   1 file changed, 14 insertions(+)
>>>
>>> diff --git a/drivers/gpu/drm/ttm/ttm_bo_util.c
>>> b/drivers/gpu/drm/ttm/ttm_bo_util.c
>>> index 031e581..7429464 100644
>>> --- a/drivers/gpu/drm/ttm/ttm_bo_util.c
>>> +++ b/drivers/gpu/drm/ttm/ttm_bo_util.c
>>> @@ -91,6 +91,10 @@ static int ttm_resource_ioremap(struct ttm_device
>>> *bdev,
>>>             if (mem->bus.caching == ttm_write_combined)
>>>               addr = ioremap_wc(mem->bus.offset, bus_size);
>>> +#ifdef CONFIG_X86
>>
>>
>> Please use #if defined (CONFIG_X86)
>
> Actually #ifdef is usually preferred.

oops, i was referring to IS_ENABLED (CONFIG) and not if defined.


>
> Christian.
>
>>
>>> +        else if (mem->bus.caching == ttm_cached)
>>> +            addr = ioremap_cache(mem->bus.offset, bus_size);
>>> +#endif
>>>           else
>>>               addr = ioremap(mem->bus.offset, bus_size);
>>>           if (!addr) {
>>> @@ -372,6 +376,11 @@ static int ttm_bo_ioremap(struct
>>> ttm_buffer_object *bo,
>>>           if (mem->bus.caching == ttm_write_combined)
>>>               map->virtual = ioremap_wc(bo->mem.bus.offset + offset,
>>>                             size);
>>> +#ifdef CONFIG_X86
>>> +        else if (mem->bus.caching == ttm_cached)
>>> +            map->virtual = ioremap_cache(bo->mem.bus.offset + offset,
>>> +                          size);
>>> +#endif
>>>           else
>>>               map->virtual = ioremap(bo->mem.bus.offset + offset,
>>>                              size);
>>> @@ -490,6 +499,11 @@ int ttm_bo_vmap(struct ttm_buffer_object *bo,
>>> struct dma_buf_map *map)
>>>           else if (mem->bus.caching == ttm_write_combined)
>>>               vaddr_iomem = ioremap_wc(mem->bus.offset,
>>>                            bo->base.size);
>>> +        else if (mem->bus.caching == ttm_cached)
>>> +#ifdef CONFIG_X86
>>> +            vaddr_iomem = ioremap_cache(mem->bus.offset,
>>> +                          bo->base.size);
>>> +#endif
>>>           else
>>>               vaddr_iomem = ioremap(mem->bus.offset, bo->base.size);
>> _______________________________________________
>> amd-gfx mailing list
>> amd-gfx@lists.freedesktop.org
>> https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&amp;data=04%7C01%7Crajneesh.bhardwaj%40amd.com%7Cc4386544ea10487d3a0c08d8df3363a1%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637504759264793970%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&amp;sdata=nM2UtQQdActyapfZSrhfx%2BoJ%2BdszV4Yp62LTehsUWwY%3D&amp;reserved=0 
>>
>
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 49+ messages in thread

* Re: [PATCH] drm/ttm: ioremap buffer according to TTM mem caching setting
@ 2021-03-04 17:40       ` Bhardwaj, Rajneesh
  0 siblings, 0 replies; 49+ messages in thread
From: Bhardwaj, Rajneesh @ 2021-03-04 17:40 UTC (permalink / raw)
  To: Christian König, Oak Zeng, dri-devel, amd-gfx, brahma_sw_dev
  Cc: Alexander.Deucher, jinhuieric.huang, Felix.Kuehling,
	harish.kasiviswanathan, christian.koenig


On 3/4/2021 12:31 PM, Christian König wrote:
> [CAUTION: External Email]
>
> Am 04.03.21 um 18:01 schrieb Bhardwaj, Rajneesh:
>> I was wondering if a managed version of such API exists but looks like
>> none. We only have devm_ioremap_wc but that is valid only for
>> PAGE_CACHE_MODE_WC whereas ioremap_cache uses _WB. One more small
>> comment below.
>>
>>
>> Acked-by: Rajneesh Bhardwaj <rajneesh.bhardwaj@amd.com>
>>
>> On 3/4/2021 11:04 AM, Oak Zeng wrote:
>>> If tbo.mem.bus.caching is cached, buffer is intended to be mapped
>>> as cached from CPU. Map it with ioremap_cache.
>>>
>>> This wasn't necessary before as device memory was never mapped
>>> as cached from CPU side. It becomes necessary for aldebaran as
>>> device memory is mapped cached from CPU.
>>>
>>> Signed-off-by: Oak Zeng <Oak.Zeng@amd.com>
>>> Reviewed-by: Christian Konig <Christian.Koenig@amd.com>
>>> ---
>>>   drivers/gpu/drm/ttm/ttm_bo_util.c | 14 ++++++++++++++
>>>   1 file changed, 14 insertions(+)
>>>
>>> diff --git a/drivers/gpu/drm/ttm/ttm_bo_util.c
>>> b/drivers/gpu/drm/ttm/ttm_bo_util.c
>>> index 031e581..7429464 100644
>>> --- a/drivers/gpu/drm/ttm/ttm_bo_util.c
>>> +++ b/drivers/gpu/drm/ttm/ttm_bo_util.c
>>> @@ -91,6 +91,10 @@ static int ttm_resource_ioremap(struct ttm_device
>>> *bdev,
>>>             if (mem->bus.caching == ttm_write_combined)
>>>               addr = ioremap_wc(mem->bus.offset, bus_size);
>>> +#ifdef CONFIG_X86
>>
>>
>> Please use #if defined (CONFIG_X86)
>
> Actually #ifdef is usually preferred.

oops, i was referring to IS_ENABLED (CONFIG) and not if defined.


>
> Christian.
>
>>
>>> +        else if (mem->bus.caching == ttm_cached)
>>> +            addr = ioremap_cache(mem->bus.offset, bus_size);
>>> +#endif
>>>           else
>>>               addr = ioremap(mem->bus.offset, bus_size);
>>>           if (!addr) {
>>> @@ -372,6 +376,11 @@ static int ttm_bo_ioremap(struct
>>> ttm_buffer_object *bo,
>>>           if (mem->bus.caching == ttm_write_combined)
>>>               map->virtual = ioremap_wc(bo->mem.bus.offset + offset,
>>>                             size);
>>> +#ifdef CONFIG_X86
>>> +        else if (mem->bus.caching == ttm_cached)
>>> +            map->virtual = ioremap_cache(bo->mem.bus.offset + offset,
>>> +                          size);
>>> +#endif
>>>           else
>>>               map->virtual = ioremap(bo->mem.bus.offset + offset,
>>>                              size);
>>> @@ -490,6 +499,11 @@ int ttm_bo_vmap(struct ttm_buffer_object *bo,
>>> struct dma_buf_map *map)
>>>           else if (mem->bus.caching == ttm_write_combined)
>>>               vaddr_iomem = ioremap_wc(mem->bus.offset,
>>>                            bo->base.size);
>>> +        else if (mem->bus.caching == ttm_cached)
>>> +#ifdef CONFIG_X86
>>> +            vaddr_iomem = ioremap_cache(mem->bus.offset,
>>> +                          bo->base.size);
>>> +#endif
>>>           else
>>>               vaddr_iomem = ioremap(mem->bus.offset, bo->base.size);
>> _______________________________________________
>> amd-gfx mailing list
>> amd-gfx@lists.freedesktop.org
>> https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&amp;data=04%7C01%7Crajneesh.bhardwaj%40amd.com%7Cc4386544ea10487d3a0c08d8df3363a1%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637504759264793970%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&amp;sdata=nM2UtQQdActyapfZSrhfx%2BoJ%2BdszV4Yp62LTehsUWwY%3D&amp;reserved=0 
>>
>
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply	[flat|nested] 49+ messages in thread

* Re: [PATCH] drm/ttm: ioremap buffer according to TTM mem caching setting
  2021-03-04 17:01   ` Bhardwaj, Rajneesh
@ 2021-03-04 17:31     ` Christian König
  -1 siblings, 0 replies; 49+ messages in thread
From: Christian König @ 2021-03-04 17:31 UTC (permalink / raw)
  To: Bhardwaj, Rajneesh, Oak Zeng, dri-devel, amd-gfx, brahma_sw_dev
  Cc: Alexander.Deucher, jinhuieric.huang, Felix.Kuehling,
	harish.kasiviswanathan, christian.koenig

Am 04.03.21 um 18:01 schrieb Bhardwaj, Rajneesh:
> I was wondering if a managed version of such API exists but looks like 
> none. We only have devm_ioremap_wc but that is valid only for 
> PAGE_CACHE_MODE_WC whereas ioremap_cache uses _WB. One more small 
> comment below.
>
>
> Acked-by: Rajneesh Bhardwaj <rajneesh.bhardwaj@amd.com>
>
> On 3/4/2021 11:04 AM, Oak Zeng wrote:
>> If tbo.mem.bus.caching is cached, buffer is intended to be mapped
>> as cached from CPU. Map it with ioremap_cache.
>>
>> This wasn't necessary before as device memory was never mapped
>> as cached from CPU side. It becomes necessary for aldebaran as
>> device memory is mapped cached from CPU.
>>
>> Signed-off-by: Oak Zeng <Oak.Zeng@amd.com>
>> Reviewed-by: Christian Konig <Christian.Koenig@amd.com>
>> ---
>>   drivers/gpu/drm/ttm/ttm_bo_util.c | 14 ++++++++++++++
>>   1 file changed, 14 insertions(+)
>>
>> diff --git a/drivers/gpu/drm/ttm/ttm_bo_util.c 
>> b/drivers/gpu/drm/ttm/ttm_bo_util.c
>> index 031e581..7429464 100644
>> --- a/drivers/gpu/drm/ttm/ttm_bo_util.c
>> +++ b/drivers/gpu/drm/ttm/ttm_bo_util.c
>> @@ -91,6 +91,10 @@ static int ttm_resource_ioremap(struct ttm_device 
>> *bdev,
>>             if (mem->bus.caching == ttm_write_combined)
>>               addr = ioremap_wc(mem->bus.offset, bus_size);
>> +#ifdef CONFIG_X86
>
>
> Please use #if defined (CONFIG_X86)

Actually #ifdef is usually preferred.

Christian.

>
>> +        else if (mem->bus.caching == ttm_cached)
>> +            addr = ioremap_cache(mem->bus.offset, bus_size);
>> +#endif
>>           else
>>               addr = ioremap(mem->bus.offset, bus_size);
>>           if (!addr) {
>> @@ -372,6 +376,11 @@ static int ttm_bo_ioremap(struct 
>> ttm_buffer_object *bo,
>>           if (mem->bus.caching == ttm_write_combined)
>>               map->virtual = ioremap_wc(bo->mem.bus.offset + offset,
>>                             size);
>> +#ifdef CONFIG_X86
>> +        else if (mem->bus.caching == ttm_cached)
>> +            map->virtual = ioremap_cache(bo->mem.bus.offset + offset,
>> +                          size);
>> +#endif
>>           else
>>               map->virtual = ioremap(bo->mem.bus.offset + offset,
>>                              size);
>> @@ -490,6 +499,11 @@ int ttm_bo_vmap(struct ttm_buffer_object *bo, 
>> struct dma_buf_map *map)
>>           else if (mem->bus.caching == ttm_write_combined)
>>               vaddr_iomem = ioremap_wc(mem->bus.offset,
>>                            bo->base.size);
>> +        else if (mem->bus.caching == ttm_cached)
>> +#ifdef CONFIG_X86
>> +            vaddr_iomem = ioremap_cache(mem->bus.offset,
>> +                          bo->base.size);
>> +#endif
>>           else
>>               vaddr_iomem = ioremap(mem->bus.offset, bo->base.size);
> _______________________________________________
> amd-gfx mailing list
> amd-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx

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

^ permalink raw reply	[flat|nested] 49+ messages in thread

* Re: [PATCH] drm/ttm: ioremap buffer according to TTM mem caching setting
@ 2021-03-04 17:31     ` Christian König
  0 siblings, 0 replies; 49+ messages in thread
From: Christian König @ 2021-03-04 17:31 UTC (permalink / raw)
  To: Bhardwaj, Rajneesh, Oak Zeng, dri-devel, amd-gfx, brahma_sw_dev
  Cc: Alexander.Deucher, jinhuieric.huang, Felix.Kuehling,
	harish.kasiviswanathan, christian.koenig

Am 04.03.21 um 18:01 schrieb Bhardwaj, Rajneesh:
> I was wondering if a managed version of such API exists but looks like 
> none. We only have devm_ioremap_wc but that is valid only for 
> PAGE_CACHE_MODE_WC whereas ioremap_cache uses _WB. One more small 
> comment below.
>
>
> Acked-by: Rajneesh Bhardwaj <rajneesh.bhardwaj@amd.com>
>
> On 3/4/2021 11:04 AM, Oak Zeng wrote:
>> If tbo.mem.bus.caching is cached, buffer is intended to be mapped
>> as cached from CPU. Map it with ioremap_cache.
>>
>> This wasn't necessary before as device memory was never mapped
>> as cached from CPU side. It becomes necessary for aldebaran as
>> device memory is mapped cached from CPU.
>>
>> Signed-off-by: Oak Zeng <Oak.Zeng@amd.com>
>> Reviewed-by: Christian Konig <Christian.Koenig@amd.com>
>> ---
>>   drivers/gpu/drm/ttm/ttm_bo_util.c | 14 ++++++++++++++
>>   1 file changed, 14 insertions(+)
>>
>> diff --git a/drivers/gpu/drm/ttm/ttm_bo_util.c 
>> b/drivers/gpu/drm/ttm/ttm_bo_util.c
>> index 031e581..7429464 100644
>> --- a/drivers/gpu/drm/ttm/ttm_bo_util.c
>> +++ b/drivers/gpu/drm/ttm/ttm_bo_util.c
>> @@ -91,6 +91,10 @@ static int ttm_resource_ioremap(struct ttm_device 
>> *bdev,
>>             if (mem->bus.caching == ttm_write_combined)
>>               addr = ioremap_wc(mem->bus.offset, bus_size);
>> +#ifdef CONFIG_X86
>
>
> Please use #if defined (CONFIG_X86)

Actually #ifdef is usually preferred.

Christian.

>
>> +        else if (mem->bus.caching == ttm_cached)
>> +            addr = ioremap_cache(mem->bus.offset, bus_size);
>> +#endif
>>           else
>>               addr = ioremap(mem->bus.offset, bus_size);
>>           if (!addr) {
>> @@ -372,6 +376,11 @@ static int ttm_bo_ioremap(struct 
>> ttm_buffer_object *bo,
>>           if (mem->bus.caching == ttm_write_combined)
>>               map->virtual = ioremap_wc(bo->mem.bus.offset + offset,
>>                             size);
>> +#ifdef CONFIG_X86
>> +        else if (mem->bus.caching == ttm_cached)
>> +            map->virtual = ioremap_cache(bo->mem.bus.offset + offset,
>> +                          size);
>> +#endif
>>           else
>>               map->virtual = ioremap(bo->mem.bus.offset + offset,
>>                              size);
>> @@ -490,6 +499,11 @@ int ttm_bo_vmap(struct ttm_buffer_object *bo, 
>> struct dma_buf_map *map)
>>           else if (mem->bus.caching == ttm_write_combined)
>>               vaddr_iomem = ioremap_wc(mem->bus.offset,
>>                            bo->base.size);
>> +        else if (mem->bus.caching == ttm_cached)
>> +#ifdef CONFIG_X86
>> +            vaddr_iomem = ioremap_cache(mem->bus.offset,
>> +                          bo->base.size);
>> +#endif
>>           else
>>               vaddr_iomem = ioremap(mem->bus.offset, bo->base.size);
> _______________________________________________
> amd-gfx mailing list
> amd-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply	[flat|nested] 49+ messages in thread

* Re: [PATCH] drm/ttm: ioremap buffer according to TTM mem caching setting
  2021-03-04 16:04 ` Oak Zeng
@ 2021-03-04 17:01   ` Bhardwaj, Rajneesh
  -1 siblings, 0 replies; 49+ messages in thread
From: Bhardwaj, Rajneesh @ 2021-03-04 17:01 UTC (permalink / raw)
  To: Oak Zeng, dri-devel, amd-gfx, brahma_sw_dev
  Cc: Alexander.Deucher, jinhuieric.huang, Felix.Kuehling,
	harish.kasiviswanathan, christian.koenig

I was wondering if a managed version of such API exists but looks like 
none. We only have devm_ioremap_wc but that is valid only for 
PAGE_CACHE_MODE_WC whereas ioremap_cache uses _WB. One more small 
comment below.


Acked-by: Rajneesh Bhardwaj <rajneesh.bhardwaj@amd.com>

On 3/4/2021 11:04 AM, Oak Zeng wrote:
> If tbo.mem.bus.caching is cached, buffer is intended to be mapped
> as cached from CPU. Map it with ioremap_cache.
>
> This wasn't necessary before as device memory was never mapped
> as cached from CPU side. It becomes necessary for aldebaran as
> device memory is mapped cached from CPU.
>
> Signed-off-by: Oak Zeng <Oak.Zeng@amd.com>
> Reviewed-by: Christian Konig <Christian.Koenig@amd.com>
> ---
>   drivers/gpu/drm/ttm/ttm_bo_util.c | 14 ++++++++++++++
>   1 file changed, 14 insertions(+)
>
> diff --git a/drivers/gpu/drm/ttm/ttm_bo_util.c b/drivers/gpu/drm/ttm/ttm_bo_util.c
> index 031e581..7429464 100644
> --- a/drivers/gpu/drm/ttm/ttm_bo_util.c
> +++ b/drivers/gpu/drm/ttm/ttm_bo_util.c
> @@ -91,6 +91,10 @@ static int ttm_resource_ioremap(struct ttm_device *bdev,
>   
>   		if (mem->bus.caching == ttm_write_combined)
>   			addr = ioremap_wc(mem->bus.offset, bus_size);
> +#ifdef CONFIG_X86


Please use #if defined (CONFIG_X86)

> +		else if (mem->bus.caching == ttm_cached)
> +			addr = ioremap_cache(mem->bus.offset, bus_size);
> +#endif
>   		else
>   			addr = ioremap(mem->bus.offset, bus_size);
>   		if (!addr) {
> @@ -372,6 +376,11 @@ static int ttm_bo_ioremap(struct ttm_buffer_object *bo,
>   		if (mem->bus.caching == ttm_write_combined)
>   			map->virtual = ioremap_wc(bo->mem.bus.offset + offset,
>   						  size);
> +#ifdef CONFIG_X86
> +		else if (mem->bus.caching == ttm_cached)
> +			map->virtual = ioremap_cache(bo->mem.bus.offset + offset,
> +						  size);
> +#endif
>   		else
>   			map->virtual = ioremap(bo->mem.bus.offset + offset,
>   					       size);
> @@ -490,6 +499,11 @@ int ttm_bo_vmap(struct ttm_buffer_object *bo, struct dma_buf_map *map)
>   		else if (mem->bus.caching == ttm_write_combined)
>   			vaddr_iomem = ioremap_wc(mem->bus.offset,
>   						 bo->base.size);
> +		else if (mem->bus.caching == ttm_cached)
> +#ifdef CONFIG_X86
> +			vaddr_iomem = ioremap_cache(mem->bus.offset,
> +						  bo->base.size);
> +#endif
>   		else
>   			vaddr_iomem = ioremap(mem->bus.offset, bo->base.size);
>   
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 49+ messages in thread

* Re: [PATCH] drm/ttm: ioremap buffer according to TTM mem caching setting
@ 2021-03-04 17:01   ` Bhardwaj, Rajneesh
  0 siblings, 0 replies; 49+ messages in thread
From: Bhardwaj, Rajneesh @ 2021-03-04 17:01 UTC (permalink / raw)
  To: Oak Zeng, dri-devel, amd-gfx, brahma_sw_dev
  Cc: Alexander.Deucher, jinhuieric.huang, Felix.Kuehling,
	harish.kasiviswanathan, christian.koenig

I was wondering if a managed version of such API exists but looks like 
none. We only have devm_ioremap_wc but that is valid only for 
PAGE_CACHE_MODE_WC whereas ioremap_cache uses _WB. One more small 
comment below.


Acked-by: Rajneesh Bhardwaj <rajneesh.bhardwaj@amd.com>

On 3/4/2021 11:04 AM, Oak Zeng wrote:
> If tbo.mem.bus.caching is cached, buffer is intended to be mapped
> as cached from CPU. Map it with ioremap_cache.
>
> This wasn't necessary before as device memory was never mapped
> as cached from CPU side. It becomes necessary for aldebaran as
> device memory is mapped cached from CPU.
>
> Signed-off-by: Oak Zeng <Oak.Zeng@amd.com>
> Reviewed-by: Christian Konig <Christian.Koenig@amd.com>
> ---
>   drivers/gpu/drm/ttm/ttm_bo_util.c | 14 ++++++++++++++
>   1 file changed, 14 insertions(+)
>
> diff --git a/drivers/gpu/drm/ttm/ttm_bo_util.c b/drivers/gpu/drm/ttm/ttm_bo_util.c
> index 031e581..7429464 100644
> --- a/drivers/gpu/drm/ttm/ttm_bo_util.c
> +++ b/drivers/gpu/drm/ttm/ttm_bo_util.c
> @@ -91,6 +91,10 @@ static int ttm_resource_ioremap(struct ttm_device *bdev,
>   
>   		if (mem->bus.caching == ttm_write_combined)
>   			addr = ioremap_wc(mem->bus.offset, bus_size);
> +#ifdef CONFIG_X86


Please use #if defined (CONFIG_X86)

> +		else if (mem->bus.caching == ttm_cached)
> +			addr = ioremap_cache(mem->bus.offset, bus_size);
> +#endif
>   		else
>   			addr = ioremap(mem->bus.offset, bus_size);
>   		if (!addr) {
> @@ -372,6 +376,11 @@ static int ttm_bo_ioremap(struct ttm_buffer_object *bo,
>   		if (mem->bus.caching == ttm_write_combined)
>   			map->virtual = ioremap_wc(bo->mem.bus.offset + offset,
>   						  size);
> +#ifdef CONFIG_X86
> +		else if (mem->bus.caching == ttm_cached)
> +			map->virtual = ioremap_cache(bo->mem.bus.offset + offset,
> +						  size);
> +#endif
>   		else
>   			map->virtual = ioremap(bo->mem.bus.offset + offset,
>   					       size);
> @@ -490,6 +499,11 @@ int ttm_bo_vmap(struct ttm_buffer_object *bo, struct dma_buf_map *map)
>   		else if (mem->bus.caching == ttm_write_combined)
>   			vaddr_iomem = ioremap_wc(mem->bus.offset,
>   						 bo->base.size);
> +		else if (mem->bus.caching == ttm_cached)
> +#ifdef CONFIG_X86
> +			vaddr_iomem = ioremap_cache(mem->bus.offset,
> +						  bo->base.size);
> +#endif
>   		else
>   			vaddr_iomem = ioremap(mem->bus.offset, bo->base.size);
>   
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply	[flat|nested] 49+ messages in thread

* [PATCH] drm/ttm: ioremap buffer according to TTM mem caching setting
@ 2021-03-04 16:04 ` Oak Zeng
  0 siblings, 0 replies; 49+ messages in thread
From: Oak Zeng @ 2021-03-04 16:04 UTC (permalink / raw)
  To: dri-devel, amd-gfx, brahma_sw_dev
  Cc: Felix.Kuehling, harish.kasiviswanathan, christian.koenig,
	jinhuieric.huang, Alexander.Deucher, Oak Zeng

If tbo.mem.bus.caching is cached, buffer is intended to be mapped
as cached from CPU. Map it with ioremap_cache.

This wasn't necessary before as device memory was never mapped
as cached from CPU side. It becomes necessary for aldebaran as
device memory is mapped cached from CPU.

Signed-off-by: Oak Zeng <Oak.Zeng@amd.com>
Reviewed-by: Christian Konig <Christian.Koenig@amd.com>
---
 drivers/gpu/drm/ttm/ttm_bo_util.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/drivers/gpu/drm/ttm/ttm_bo_util.c b/drivers/gpu/drm/ttm/ttm_bo_util.c
index 031e581..7429464 100644
--- a/drivers/gpu/drm/ttm/ttm_bo_util.c
+++ b/drivers/gpu/drm/ttm/ttm_bo_util.c
@@ -91,6 +91,10 @@ static int ttm_resource_ioremap(struct ttm_device *bdev,
 
 		if (mem->bus.caching == ttm_write_combined)
 			addr = ioremap_wc(mem->bus.offset, bus_size);
+#ifdef CONFIG_X86
+		else if (mem->bus.caching == ttm_cached)
+			addr = ioremap_cache(mem->bus.offset, bus_size);
+#endif
 		else
 			addr = ioremap(mem->bus.offset, bus_size);
 		if (!addr) {
@@ -372,6 +376,11 @@ static int ttm_bo_ioremap(struct ttm_buffer_object *bo,
 		if (mem->bus.caching == ttm_write_combined)
 			map->virtual = ioremap_wc(bo->mem.bus.offset + offset,
 						  size);
+#ifdef CONFIG_X86
+		else if (mem->bus.caching == ttm_cached)
+			map->virtual = ioremap_cache(bo->mem.bus.offset + offset,
+						  size);
+#endif
 		else
 			map->virtual = ioremap(bo->mem.bus.offset + offset,
 					       size);
@@ -490,6 +499,11 @@ int ttm_bo_vmap(struct ttm_buffer_object *bo, struct dma_buf_map *map)
 		else if (mem->bus.caching == ttm_write_combined)
 			vaddr_iomem = ioremap_wc(mem->bus.offset,
 						 bo->base.size);
+		else if (mem->bus.caching == ttm_cached)
+#ifdef CONFIG_X86
+			vaddr_iomem = ioremap_cache(mem->bus.offset,
+						  bo->base.size);
+#endif
 		else
 			vaddr_iomem = ioremap(mem->bus.offset, bo->base.size);
 
-- 
2.7.4

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

^ permalink raw reply related	[flat|nested] 49+ messages in thread

* [PATCH] drm/ttm: ioremap buffer according to TTM mem caching setting
@ 2021-03-04 16:04 ` Oak Zeng
  0 siblings, 0 replies; 49+ messages in thread
From: Oak Zeng @ 2021-03-04 16:04 UTC (permalink / raw)
  To: dri-devel, amd-gfx, brahma_sw_dev
  Cc: Felix.Kuehling, harish.kasiviswanathan, christian.koenig,
	jinhuieric.huang, Alexander.Deucher, Oak Zeng

If tbo.mem.bus.caching is cached, buffer is intended to be mapped
as cached from CPU. Map it with ioremap_cache.

This wasn't necessary before as device memory was never mapped
as cached from CPU side. It becomes necessary for aldebaran as
device memory is mapped cached from CPU.

Signed-off-by: Oak Zeng <Oak.Zeng@amd.com>
Reviewed-by: Christian Konig <Christian.Koenig@amd.com>
---
 drivers/gpu/drm/ttm/ttm_bo_util.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/drivers/gpu/drm/ttm/ttm_bo_util.c b/drivers/gpu/drm/ttm/ttm_bo_util.c
index 031e581..7429464 100644
--- a/drivers/gpu/drm/ttm/ttm_bo_util.c
+++ b/drivers/gpu/drm/ttm/ttm_bo_util.c
@@ -91,6 +91,10 @@ static int ttm_resource_ioremap(struct ttm_device *bdev,
 
 		if (mem->bus.caching == ttm_write_combined)
 			addr = ioremap_wc(mem->bus.offset, bus_size);
+#ifdef CONFIG_X86
+		else if (mem->bus.caching == ttm_cached)
+			addr = ioremap_cache(mem->bus.offset, bus_size);
+#endif
 		else
 			addr = ioremap(mem->bus.offset, bus_size);
 		if (!addr) {
@@ -372,6 +376,11 @@ static int ttm_bo_ioremap(struct ttm_buffer_object *bo,
 		if (mem->bus.caching == ttm_write_combined)
 			map->virtual = ioremap_wc(bo->mem.bus.offset + offset,
 						  size);
+#ifdef CONFIG_X86
+		else if (mem->bus.caching == ttm_cached)
+			map->virtual = ioremap_cache(bo->mem.bus.offset + offset,
+						  size);
+#endif
 		else
 			map->virtual = ioremap(bo->mem.bus.offset + offset,
 					       size);
@@ -490,6 +499,11 @@ int ttm_bo_vmap(struct ttm_buffer_object *bo, struct dma_buf_map *map)
 		else if (mem->bus.caching == ttm_write_combined)
 			vaddr_iomem = ioremap_wc(mem->bus.offset,
 						 bo->base.size);
+		else if (mem->bus.caching == ttm_cached)
+#ifdef CONFIG_X86
+			vaddr_iomem = ioremap_cache(mem->bus.offset,
+						  bo->base.size);
+#endif
 		else
 			vaddr_iomem = ioremap(mem->bus.offset, bo->base.size);
 
-- 
2.7.4

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply related	[flat|nested] 49+ messages in thread

* Re: [PATCH] drm/ttm: ioremap buffer according to TTM mem caching setting
  2021-03-03 20:59           ` Zeng, Oak
@ 2021-03-04  7:46             ` Christian König
  -1 siblings, 0 replies; 49+ messages in thread
From: Christian König @ 2021-03-04  7:46 UTC (permalink / raw)
  To: Zeng, Oak, amd-gfx, dri-devel, Daniel Vetter, Dave Airlie,
	Thomas Hellström (Intel),
	dan.j.williams
  Cc: kbuild-all, Kuehling, Felix, Kasiviswanathan, Harish, Huang,
	JinHuiEric, Deucher, Alexander, Koenig, Christian


[-- Attachment #1.1: Type: text/plain, Size: 13891 bytes --]

Hi Oak,

as far as I know some architectures like PowerPC/ARM/MIPS need that. And 
we at least officially support PowerPC and ARM and MIPS is best effort 
and shouldn't break if possible.

Thomas just recently had a whole bunch of DMA-buf patches to also fix 
that up for DMA-bufs vmap as well, previously we have just been casting 
away the __iomem and hoped that it always works.

Regards,
Christian.

Am 03.03.21 um 21:59 schrieb Zeng, Oak:
>
> [AMD Official Use Only - Internal Distribution Only]
>
>
> Hi Christian,
>
> Can you explain why __iomem annotation is mandatory for amdgpu driver? 
> If this is the case, we can’t switch to memremap. The only fix seems 
> to me is add a #ifdef __x86_64__ to the ioremap_cache codes.
>
> Regards,
>
> Oak
>
> *From:* Christian König <ckoenig.leichtzumerken@gmail.com>
> *Sent:* Wednesday, March 3, 2021 5:46 AM
> *To:* Zeng, Oak <Oak.Zeng@amd.com>; amd-gfx@lists.freedesktop.org; 
> dri-devel@lists.freedesktop.org; Daniel Vetter <daniel@ffwll.ch>; Dave 
> Airlie <airlied@redhat.com>; Thomas Hellström (Intel) 
> <thomas_os@shipmail.org>; dan.j.williams@intel.com
> *Cc:* kbuild-all@lists.01.org; Kuehling, Felix 
> <Felix.Kuehling@amd.com>; Kasiviswanathan, Harish 
> <Harish.Kasiviswanathan@amd.com>; Deucher, Alexander 
> <Alexander.Deucher@amd.com>; Huang, JinHuiEric 
> <JinHuiEric.Huang@amd.com>; Koenig, Christian <Christian.Koenig@amd.com>
> *Subject:* Re: [PATCH] drm/ttm: ioremap buffer according to TTM mem 
> caching setting
>
> Hi Oak,
>
>
>     config: parisc-randconfig-r012-20210302 (attached as .config)
>
>
> It's not the Intel driver build which fails here, but the build bot is 
> just hosted by Intel.
>
> The problem is that the parisc architecture doesn't defines the 
> ioremap_cache() function.
>
> I've looked at using memremap() instead of ioremap_cache(). The 
> problem is that we do support architectures with the TTM as well as 
> amndgpu code where the __iomem annotation is mandatory and correct.
>
> Regards,
> Christian.
>
> Am 02.03.21 um 23:45 schrieb Zeng, Oak:
>
>     [AMD Official Use Only - Internal Distribution Only]
>
>     Hi Daniel, Thomas, Dan,
>
>     Does below message mean the calling ioremap_cache failed intel’s
>     driver build? I can see both ioremap_cache and ioremap_wc are
>     defined in arch/x86/mm/ioremap.c – why ioremap_wc doesn’t break
>     intel driver’s build?
>
>     Are we supposed to use memremap (offset, size, MEMREMAP_WB) to
>     replace ioremap_cache? When I read here
>     https://lwn.net/Articles/653585/
>     <https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flwn.net%2FArticles%2F653585%2F&data=04%7C01%7COak.Zeng%40amd.com%7Cc047ecb316df47cde7ed08d8de3188d4%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637503651624296472%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=ljCFrIfrYbb%2FXmKKS2TJ7dSQ7oCRNWoUhWS4gEBv%2FW4%3D&reserved=0>
>     I felt that ioremap_cache returns an address annotated with _iomem
>     while memremap returns an address without __iomem annotation. In
>     our use case, GPU memory is treated as UEFI SPM (specific purpose
>     memory). I am not very sure whether memremap (thus no __iomem
>     annotation) is the right thing to do. What I am sure is, we have
>     tested ioremap_cache and it works fine on AMD system.
>
>     I will send out a test patch replacing ioremap_cache with
>     ioremap_wc, to trigger Intel build robot to see whether it fails
>     Intel build. I suppose it will not fail Intel build.
>
>     Regards,
>
>     Oak
>
>     *From:* Christian König <ckoenig.leichtzumerken@gmail.com>
>     <mailto:ckoenig.leichtzumerken@gmail.com>
>     *Sent:* Tuesday, March 2, 2021 6:31 AM
>     *To:* amd-gfx@lists.freedesktop.org
>     <mailto:amd-gfx@lists.freedesktop.org>;
>     dri-devel@lists.freedesktop.org
>     <mailto:dri-devel@lists.freedesktop.org>; Daniel Vetter
>     <daniel@ffwll.ch> <mailto:daniel@ffwll.ch>; Dave Airlie
>     <airlied@redhat.com> <mailto:airlied@redhat.com>; Thomas Hellström
>     (Intel) <thomas_os@shipmail.org> <mailto:thomas_os@shipmail.org>
>     *Cc:* Zeng, Oak <Oak.Zeng@amd.com> <mailto:Oak.Zeng@amd.com>;
>     kbuild-all@lists.01.org <mailto:kbuild-all@lists.01.org>;
>     Kuehling, Felix <Felix.Kuehling@amd.com>
>     <mailto:Felix.Kuehling@amd.com>; Kasiviswanathan, Harish
>     <Harish.Kasiviswanathan@amd.com>
>     <mailto:Harish.Kasiviswanathan@amd.com>; Deucher, Alexander
>     <Alexander.Deucher@amd.com> <mailto:Alexander.Deucher@amd.com>;
>     Huang, JinHuiEric <JinHuiEric.Huang@amd.com>
>     <mailto:JinHuiEric.Huang@amd.com>; Koenig, Christian
>     <Christian.Koenig@amd.com> <mailto:Christian.Koenig@amd.com>
>     *Subject:* Re: [PATCH] drm/ttm: ioremap buffer according to TTM
>     mem caching setting
>
>     Hi guys,
>
>     adding the usual suspects direct. Does anybody of hand know how to
>     check if an architecture supports ioremap_cache()?
>
>     For now we only need this on X86, but I would feel better if we
>     don't use an #ifdef here.
>
>     Regards,
>     Christian.
>
>     Am 02.03.21 um 05:12 schrieb kernel test robot:
>
>         Hi Oak,
>
>           
>
>         Thank you for the patch! Yet something to improve:
>
>           
>
>         [auto build test ERROR on drm-intel/for-linux-next]
>
>         [also build test ERROR on drm-tip/drm-tip linus/master v5.12-rc1 next-20210302]
>
>         [cannot apply to tegra-drm/drm/tegra/for-next drm-exynos/exynos-drm-next drm/drm-next]
>
>         [If your patch is applied to the wrong git tree, kindly drop us a note.
>
>         And when submitting patch, we suggest to use '--base' as documented in
>
>         https://git-scm.com/docs/git-format-patch  <https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgit-scm.com%2Fdocs%2Fgit-format-patch&data=04%7C01%7COak.Zeng%40amd.com%7Cc047ecb316df47cde7ed08d8de3188d4%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637503651624306464%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=3f5ib%2FlZ6DXXF%2Bk1rXPKGu1IkOhXHdkUmX3obtuIRtA%3D&reserved=0>]
>
>           
>
>         url:https://github.com/0day-ci/linux/commits/Oak-Zeng/drm-ttm-ioremap-buffer-according-to-TTM-mem-caching-setting/20210302-064500  <https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2F0day-ci%2Flinux%2Fcommits%2FOak-Zeng%2Fdrm-ttm-ioremap-buffer-according-to-TTM-mem-caching-setting%2F20210302-064500&data=04%7C01%7COak.Zeng%40amd.com%7Cc047ecb316df47cde7ed08d8de3188d4%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637503651624306464%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=Y9h9ZHM7d2Sqo3XQWr%2Frpb2DAk9SkHFIm5nD4ABFNbE%3D&reserved=0>
>
>         base:   git://anongit.freedesktop.org/drm-intel for-linux-next
>
>         config: parisc-randconfig-r012-20210302 (attached as .config)
>
>         compiler: hppa-linux-gcc (GCC) 9.3.0
>
>         reproduce (this is a W=1 build):
>
>                  wgethttps://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross  <https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fraw.githubusercontent.com%2Fintel%2Flkp-tests%2Fmaster%2Fsbin%2Fmake.cross&data=04%7C01%7COak.Zeng%40amd.com%7Cc047ecb316df47cde7ed08d8de3188d4%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637503651624316464%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=wGo3Nwk4mWZjb2W3E7qKf3FtKzLOxCVmQu1zd2rmzRU%3D&reserved=0>  -O ~/bin/make.cross
>
>                  chmod +x ~/bin/make.cross
>
>                  #https://github.com/0day-ci/linux/commit/225bb3711439ec559dd72ae5af8e62d34ea60a64  <https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2F0day-ci%2Flinux%2Fcommit%2F225bb3711439ec559dd72ae5af8e62d34ea60a64&data=04%7C01%7COak.Zeng%40amd.com%7Cc047ecb316df47cde7ed08d8de3188d4%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637503651624316464%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=kOz18UAawmA4SZ6IrCGRt4HISfsmmjfGN2TUgAtm0Ak%3D&reserved=0>
>
>                  git remote add linux-reviewhttps://github.com/0day-ci/linux  <https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2F0day-ci%2Flinux&data=04%7C01%7COak.Zeng%40amd.com%7Cc047ecb316df47cde7ed08d8de3188d4%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637503651624326458%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=QnKs47gjzAz%2Fjv%2FAO6H%2BwYNQF6mdk1D8dCNveW0YHuM%3D&reserved=0>
>
>                  git fetch --no-tags linux-review Oak-Zeng/drm-ttm-ioremap-buffer-according-to-TTM-mem-caching-setting/20210302-064500
>
>                  git checkout 225bb3711439ec559dd72ae5af8e62d34ea60a64
>
>                  # save the attached .config to linux build tree
>
>                  COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=parisc
>
>           
>
>         If you fix the issue, kindly add following tag as appropriate
>
>         Reported-by: kernel test robot<lkp@intel.com>  <mailto:lkp@intel.com>
>
>           
>
>         All errors (new ones prefixed by >>):
>
>           
>
>             drivers/gpu/drm/ttm/ttm_bo_util.c: In function 'ttm_resource_ioremap':
>
>                 drivers/gpu/drm/ttm/ttm_bo_util.c:95:11: error: implicit declaration of function 'ioremap_cache'; did you mean 'ioremap_uc'? [-Werror=implicit-function-declaration]
>
>                95 |    addr = ioremap_cache(mem->bus.offset, bus_size);
>
>                   |           ^~~~~~~~~~~~~
>
>                   |           ioremap_uc
>
>             drivers/gpu/drm/ttm/ttm_bo_util.c:95:9: warning: assignment to 'void *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
>
>                95 |    addr = ioremap_cache(mem->bus.offset, bus_size);
>
>                   |         ^
>
>             drivers/gpu/drm/ttm/ttm_bo_util.c: In function 'ttm_bo_ioremap':
>
>             drivers/gpu/drm/ttm/ttm_bo_util.c:379:17: warning: assignment to 'void *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
>
>               379 |    map->virtual = ioremap_cache(bo->mem.bus.offset + offset,
>
>                   |                 ^
>
>             drivers/gpu/drm/ttm/ttm_bo_util.c: In function 'ttm_bo_vmap':
>
>             drivers/gpu/drm/ttm/ttm_bo_util.c:500:16: warning: assignment to 'void *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
>
>               500 |    vaddr_iomem = ioremap_cache(mem->bus.offset,
>
>                   |                ^
>
>             cc1: some warnings being treated as errors
>
>           
>
>           
>
>         vim +95 drivers/gpu/drm/ttm/ttm_bo_util.c
>
>           
>
>              74
>
>              75  static int ttm_resource_ioremap(struct ttm_bo_device *bdev,
>
>              76                                struct ttm_resource *mem,
>
>              77                                void **virtual)
>
>              78  {
>
>              79          int ret;
>
>              80          void *addr;
>
>              81
>
>              82          *virtual = NULL;
>
>              83          ret = ttm_mem_io_reserve(bdev, mem);
>
>              84          if (ret || !mem->bus.is_iomem)
>
>              85                  return ret;
>
>              86
>
>              87          if (mem->bus.addr) {
>
>              88                  addr = mem->bus.addr;
>
>              89          } else {
>
>              90                  size_t bus_size = (size_t)mem->num_pages << PAGE_SHIFT;
>
>              91
>
>              92                  if (mem->bus.caching == ttm_write_combined)
>
>              93                         addr = ioremap_wc(mem->bus.offset, bus_size);
>
>              94                  else if (mem->bus.caching == ttm_cached)
>
>            > 95                         addr = ioremap_cache(mem->bus.offset, bus_size);
>
>              96                  else
>
>              97                         addr = ioremap(mem->bus.offset, bus_size);
>
>              98                  if (!addr) {
>
>              99                         ttm_mem_io_free(bdev, mem);
>
>             100                         return -ENOMEM;
>
>             101                  }
>
>             102          }
>
>             103          *virtual = addr;
>
>             104          return 0;
>
>             105  }
>
>             106
>
>           
>
>         ---
>
>         0-DAY CI Kernel Test Service, Intel Corporation
>
>         https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org  <https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.01.org%2Fhyperkitty%2Flist%2Fkbuild-all%40lists.01.org&data=04%7C01%7COak.Zeng%40amd.com%7Cc047ecb316df47cde7ed08d8de3188d4%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637503651624326458%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=MY6tEGVY0X4VyS750dYmsfVoR71Zp78YdxuqqRljnsI%3D&reserved=0>
>
>
>
>
>         _______________________________________________
>
>         amd-gfx mailing list
>
>         amd-gfx@lists.freedesktop.org  <mailto:amd-gfx@lists.freedesktop.org>
>
>         https://lists.freedesktop.org/mailman/listinfo/amd-gfx  <https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&data=04%7C01%7COak.Zeng%40amd.com%7Cc047ecb316df47cde7ed08d8de3188d4%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637503651624336455%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=Or3tWmS5M6mXOaFP4FHsEbg0rqoizNGpTl6JEkD6fac%3D&reserved=0>
>


[-- Attachment #1.2: Type: text/html, Size: 26434 bytes --]

[-- Attachment #2: Type: text/plain, Size: 160 bytes --]

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

^ permalink raw reply	[flat|nested] 49+ messages in thread

* Re: [PATCH] drm/ttm: ioremap buffer according to TTM mem caching setting
@ 2021-03-04  7:46             ` Christian König
  0 siblings, 0 replies; 49+ messages in thread
From: Christian König @ 2021-03-04  7:46 UTC (permalink / raw)
  To: Zeng, Oak, amd-gfx, dri-devel, Daniel Vetter, Dave Airlie,
	Thomas Hellström (Intel),
	dan.j.williams
  Cc: kbuild-all, Kuehling, Felix, Kasiviswanathan, Harish, Huang,
	JinHuiEric, Deucher, Alexander, Koenig, Christian


[-- Attachment #1.1: Type: text/plain, Size: 13891 bytes --]

Hi Oak,

as far as I know some architectures like PowerPC/ARM/MIPS need that. And 
we at least officially support PowerPC and ARM and MIPS is best effort 
and shouldn't break if possible.

Thomas just recently had a whole bunch of DMA-buf patches to also fix 
that up for DMA-bufs vmap as well, previously we have just been casting 
away the __iomem and hoped that it always works.

Regards,
Christian.

Am 03.03.21 um 21:59 schrieb Zeng, Oak:
>
> [AMD Official Use Only - Internal Distribution Only]
>
>
> Hi Christian,
>
> Can you explain why __iomem annotation is mandatory for amdgpu driver? 
> If this is the case, we can’t switch to memremap. The only fix seems 
> to me is add a #ifdef __x86_64__ to the ioremap_cache codes.
>
> Regards,
>
> Oak
>
> *From:* Christian König <ckoenig.leichtzumerken@gmail.com>
> *Sent:* Wednesday, March 3, 2021 5:46 AM
> *To:* Zeng, Oak <Oak.Zeng@amd.com>; amd-gfx@lists.freedesktop.org; 
> dri-devel@lists.freedesktop.org; Daniel Vetter <daniel@ffwll.ch>; Dave 
> Airlie <airlied@redhat.com>; Thomas Hellström (Intel) 
> <thomas_os@shipmail.org>; dan.j.williams@intel.com
> *Cc:* kbuild-all@lists.01.org; Kuehling, Felix 
> <Felix.Kuehling@amd.com>; Kasiviswanathan, Harish 
> <Harish.Kasiviswanathan@amd.com>; Deucher, Alexander 
> <Alexander.Deucher@amd.com>; Huang, JinHuiEric 
> <JinHuiEric.Huang@amd.com>; Koenig, Christian <Christian.Koenig@amd.com>
> *Subject:* Re: [PATCH] drm/ttm: ioremap buffer according to TTM mem 
> caching setting
>
> Hi Oak,
>
>
>     config: parisc-randconfig-r012-20210302 (attached as .config)
>
>
> It's not the Intel driver build which fails here, but the build bot is 
> just hosted by Intel.
>
> The problem is that the parisc architecture doesn't defines the 
> ioremap_cache() function.
>
> I've looked at using memremap() instead of ioremap_cache(). The 
> problem is that we do support architectures with the TTM as well as 
> amndgpu code where the __iomem annotation is mandatory and correct.
>
> Regards,
> Christian.
>
> Am 02.03.21 um 23:45 schrieb Zeng, Oak:
>
>     [AMD Official Use Only - Internal Distribution Only]
>
>     Hi Daniel, Thomas, Dan,
>
>     Does below message mean the calling ioremap_cache failed intel’s
>     driver build? I can see both ioremap_cache and ioremap_wc are
>     defined in arch/x86/mm/ioremap.c – why ioremap_wc doesn’t break
>     intel driver’s build?
>
>     Are we supposed to use memremap (offset, size, MEMREMAP_WB) to
>     replace ioremap_cache? When I read here
>     https://lwn.net/Articles/653585/
>     <https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flwn.net%2FArticles%2F653585%2F&data=04%7C01%7COak.Zeng%40amd.com%7Cc047ecb316df47cde7ed08d8de3188d4%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637503651624296472%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=ljCFrIfrYbb%2FXmKKS2TJ7dSQ7oCRNWoUhWS4gEBv%2FW4%3D&reserved=0>
>     I felt that ioremap_cache returns an address annotated with _iomem
>     while memremap returns an address without __iomem annotation. In
>     our use case, GPU memory is treated as UEFI SPM (specific purpose
>     memory). I am not very sure whether memremap (thus no __iomem
>     annotation) is the right thing to do. What I am sure is, we have
>     tested ioremap_cache and it works fine on AMD system.
>
>     I will send out a test patch replacing ioremap_cache with
>     ioremap_wc, to trigger Intel build robot to see whether it fails
>     Intel build. I suppose it will not fail Intel build.
>
>     Regards,
>
>     Oak
>
>     *From:* Christian König <ckoenig.leichtzumerken@gmail.com>
>     <mailto:ckoenig.leichtzumerken@gmail.com>
>     *Sent:* Tuesday, March 2, 2021 6:31 AM
>     *To:* amd-gfx@lists.freedesktop.org
>     <mailto:amd-gfx@lists.freedesktop.org>;
>     dri-devel@lists.freedesktop.org
>     <mailto:dri-devel@lists.freedesktop.org>; Daniel Vetter
>     <daniel@ffwll.ch> <mailto:daniel@ffwll.ch>; Dave Airlie
>     <airlied@redhat.com> <mailto:airlied@redhat.com>; Thomas Hellström
>     (Intel) <thomas_os@shipmail.org> <mailto:thomas_os@shipmail.org>
>     *Cc:* Zeng, Oak <Oak.Zeng@amd.com> <mailto:Oak.Zeng@amd.com>;
>     kbuild-all@lists.01.org <mailto:kbuild-all@lists.01.org>;
>     Kuehling, Felix <Felix.Kuehling@amd.com>
>     <mailto:Felix.Kuehling@amd.com>; Kasiviswanathan, Harish
>     <Harish.Kasiviswanathan@amd.com>
>     <mailto:Harish.Kasiviswanathan@amd.com>; Deucher, Alexander
>     <Alexander.Deucher@amd.com> <mailto:Alexander.Deucher@amd.com>;
>     Huang, JinHuiEric <JinHuiEric.Huang@amd.com>
>     <mailto:JinHuiEric.Huang@amd.com>; Koenig, Christian
>     <Christian.Koenig@amd.com> <mailto:Christian.Koenig@amd.com>
>     *Subject:* Re: [PATCH] drm/ttm: ioremap buffer according to TTM
>     mem caching setting
>
>     Hi guys,
>
>     adding the usual suspects direct. Does anybody of hand know how to
>     check if an architecture supports ioremap_cache()?
>
>     For now we only need this on X86, but I would feel better if we
>     don't use an #ifdef here.
>
>     Regards,
>     Christian.
>
>     Am 02.03.21 um 05:12 schrieb kernel test robot:
>
>         Hi Oak,
>
>           
>
>         Thank you for the patch! Yet something to improve:
>
>           
>
>         [auto build test ERROR on drm-intel/for-linux-next]
>
>         [also build test ERROR on drm-tip/drm-tip linus/master v5.12-rc1 next-20210302]
>
>         [cannot apply to tegra-drm/drm/tegra/for-next drm-exynos/exynos-drm-next drm/drm-next]
>
>         [If your patch is applied to the wrong git tree, kindly drop us a note.
>
>         And when submitting patch, we suggest to use '--base' as documented in
>
>         https://git-scm.com/docs/git-format-patch  <https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgit-scm.com%2Fdocs%2Fgit-format-patch&data=04%7C01%7COak.Zeng%40amd.com%7Cc047ecb316df47cde7ed08d8de3188d4%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637503651624306464%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=3f5ib%2FlZ6DXXF%2Bk1rXPKGu1IkOhXHdkUmX3obtuIRtA%3D&reserved=0>]
>
>           
>
>         url:https://github.com/0day-ci/linux/commits/Oak-Zeng/drm-ttm-ioremap-buffer-according-to-TTM-mem-caching-setting/20210302-064500  <https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2F0day-ci%2Flinux%2Fcommits%2FOak-Zeng%2Fdrm-ttm-ioremap-buffer-according-to-TTM-mem-caching-setting%2F20210302-064500&data=04%7C01%7COak.Zeng%40amd.com%7Cc047ecb316df47cde7ed08d8de3188d4%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637503651624306464%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=Y9h9ZHM7d2Sqo3XQWr%2Frpb2DAk9SkHFIm5nD4ABFNbE%3D&reserved=0>
>
>         base:   git://anongit.freedesktop.org/drm-intel for-linux-next
>
>         config: parisc-randconfig-r012-20210302 (attached as .config)
>
>         compiler: hppa-linux-gcc (GCC) 9.3.0
>
>         reproduce (this is a W=1 build):
>
>                  wgethttps://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross  <https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fraw.githubusercontent.com%2Fintel%2Flkp-tests%2Fmaster%2Fsbin%2Fmake.cross&data=04%7C01%7COak.Zeng%40amd.com%7Cc047ecb316df47cde7ed08d8de3188d4%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637503651624316464%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=wGo3Nwk4mWZjb2W3E7qKf3FtKzLOxCVmQu1zd2rmzRU%3D&reserved=0>  -O ~/bin/make.cross
>
>                  chmod +x ~/bin/make.cross
>
>                  #https://github.com/0day-ci/linux/commit/225bb3711439ec559dd72ae5af8e62d34ea60a64  <https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2F0day-ci%2Flinux%2Fcommit%2F225bb3711439ec559dd72ae5af8e62d34ea60a64&data=04%7C01%7COak.Zeng%40amd.com%7Cc047ecb316df47cde7ed08d8de3188d4%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637503651624316464%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=kOz18UAawmA4SZ6IrCGRt4HISfsmmjfGN2TUgAtm0Ak%3D&reserved=0>
>
>                  git remote add linux-reviewhttps://github.com/0day-ci/linux  <https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2F0day-ci%2Flinux&data=04%7C01%7COak.Zeng%40amd.com%7Cc047ecb316df47cde7ed08d8de3188d4%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637503651624326458%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=QnKs47gjzAz%2Fjv%2FAO6H%2BwYNQF6mdk1D8dCNveW0YHuM%3D&reserved=0>
>
>                  git fetch --no-tags linux-review Oak-Zeng/drm-ttm-ioremap-buffer-according-to-TTM-mem-caching-setting/20210302-064500
>
>                  git checkout 225bb3711439ec559dd72ae5af8e62d34ea60a64
>
>                  # save the attached .config to linux build tree
>
>                  COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=parisc
>
>           
>
>         If you fix the issue, kindly add following tag as appropriate
>
>         Reported-by: kernel test robot<lkp@intel.com>  <mailto:lkp@intel.com>
>
>           
>
>         All errors (new ones prefixed by >>):
>
>           
>
>             drivers/gpu/drm/ttm/ttm_bo_util.c: In function 'ttm_resource_ioremap':
>
>                 drivers/gpu/drm/ttm/ttm_bo_util.c:95:11: error: implicit declaration of function 'ioremap_cache'; did you mean 'ioremap_uc'? [-Werror=implicit-function-declaration]
>
>                95 |    addr = ioremap_cache(mem->bus.offset, bus_size);
>
>                   |           ^~~~~~~~~~~~~
>
>                   |           ioremap_uc
>
>             drivers/gpu/drm/ttm/ttm_bo_util.c:95:9: warning: assignment to 'void *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
>
>                95 |    addr = ioremap_cache(mem->bus.offset, bus_size);
>
>                   |         ^
>
>             drivers/gpu/drm/ttm/ttm_bo_util.c: In function 'ttm_bo_ioremap':
>
>             drivers/gpu/drm/ttm/ttm_bo_util.c:379:17: warning: assignment to 'void *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
>
>               379 |    map->virtual = ioremap_cache(bo->mem.bus.offset + offset,
>
>                   |                 ^
>
>             drivers/gpu/drm/ttm/ttm_bo_util.c: In function 'ttm_bo_vmap':
>
>             drivers/gpu/drm/ttm/ttm_bo_util.c:500:16: warning: assignment to 'void *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
>
>               500 |    vaddr_iomem = ioremap_cache(mem->bus.offset,
>
>                   |                ^
>
>             cc1: some warnings being treated as errors
>
>           
>
>           
>
>         vim +95 drivers/gpu/drm/ttm/ttm_bo_util.c
>
>           
>
>              74
>
>              75  static int ttm_resource_ioremap(struct ttm_bo_device *bdev,
>
>              76                                struct ttm_resource *mem,
>
>              77                                void **virtual)
>
>              78  {
>
>              79          int ret;
>
>              80          void *addr;
>
>              81
>
>              82          *virtual = NULL;
>
>              83          ret = ttm_mem_io_reserve(bdev, mem);
>
>              84          if (ret || !mem->bus.is_iomem)
>
>              85                  return ret;
>
>              86
>
>              87          if (mem->bus.addr) {
>
>              88                  addr = mem->bus.addr;
>
>              89          } else {
>
>              90                  size_t bus_size = (size_t)mem->num_pages << PAGE_SHIFT;
>
>              91
>
>              92                  if (mem->bus.caching == ttm_write_combined)
>
>              93                         addr = ioremap_wc(mem->bus.offset, bus_size);
>
>              94                  else if (mem->bus.caching == ttm_cached)
>
>            > 95                         addr = ioremap_cache(mem->bus.offset, bus_size);
>
>              96                  else
>
>              97                         addr = ioremap(mem->bus.offset, bus_size);
>
>              98                  if (!addr) {
>
>              99                         ttm_mem_io_free(bdev, mem);
>
>             100                         return -ENOMEM;
>
>             101                  }
>
>             102          }
>
>             103          *virtual = addr;
>
>             104          return 0;
>
>             105  }
>
>             106
>
>           
>
>         ---
>
>         0-DAY CI Kernel Test Service, Intel Corporation
>
>         https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org  <https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.01.org%2Fhyperkitty%2Flist%2Fkbuild-all%40lists.01.org&data=04%7C01%7COak.Zeng%40amd.com%7Cc047ecb316df47cde7ed08d8de3188d4%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637503651624326458%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=MY6tEGVY0X4VyS750dYmsfVoR71Zp78YdxuqqRljnsI%3D&reserved=0>
>
>
>
>
>         _______________________________________________
>
>         amd-gfx mailing list
>
>         amd-gfx@lists.freedesktop.org  <mailto:amd-gfx@lists.freedesktop.org>
>
>         https://lists.freedesktop.org/mailman/listinfo/amd-gfx  <https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&data=04%7C01%7COak.Zeng%40amd.com%7Cc047ecb316df47cde7ed08d8de3188d4%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637503651624336455%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=Or3tWmS5M6mXOaFP4FHsEbg0rqoizNGpTl6JEkD6fac%3D&reserved=0>
>


[-- Attachment #1.2: Type: text/html, Size: 26434 bytes --]

[-- Attachment #2: Type: text/plain, Size: 154 bytes --]

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply	[flat|nested] 49+ messages in thread

* RE: [PATCH] drm/ttm: ioremap buffer according to TTM mem caching setting
  2021-03-03 10:45         ` Christian König
@ 2021-03-03 20:59           ` Zeng, Oak
  -1 siblings, 0 replies; 49+ messages in thread
From: Zeng, Oak @ 2021-03-03 20:59 UTC (permalink / raw)
  To: Christian König, amd-gfx, dri-devel, Daniel Vetter,
	Dave Airlie, Thomas Hellström (Intel),
	dan.j.williams
  Cc: kbuild-all, Kuehling, Felix, Kasiviswanathan, Harish, Huang,
	JinHuiEric, Deucher, Alexander, Koenig, Christian


[-- Attachment #1.1: Type: text/plain, Size: 12126 bytes --]

[AMD Official Use Only - Internal Distribution Only]

Hi Christian,

Can you explain why __iomem annotation is mandatory for amdgpu driver? If this is the case, we can't switch to memremap. The only fix seems to me is add a #ifdef __x86_64__ to the ioremap_cache codes.

Regards,
Oak

From: Christian König <ckoenig.leichtzumerken@gmail.com>
Sent: Wednesday, March 3, 2021 5:46 AM
To: Zeng, Oak <Oak.Zeng@amd.com>; amd-gfx@lists.freedesktop.org; dri-devel@lists.freedesktop.org; Daniel Vetter <daniel@ffwll.ch>; Dave Airlie <airlied@redhat.com>; Thomas Hellström (Intel) <thomas_os@shipmail.org>; dan.j.williams@intel.com
Cc: kbuild-all@lists.01.org; Kuehling, Felix <Felix.Kuehling@amd.com>; Kasiviswanathan, Harish <Harish.Kasiviswanathan@amd.com>; Deucher, Alexander <Alexander.Deucher@amd.com>; Huang, JinHuiEric <JinHuiEric.Huang@amd.com>; Koenig, Christian <Christian.Koenig@amd.com>
Subject: Re: [PATCH] drm/ttm: ioremap buffer according to TTM mem caching setting

Hi Oak,



config: parisc-randconfig-r012-20210302 (attached as .config)

It's not the Intel driver build which fails here, but the build bot is just hosted by Intel.

The problem is that the parisc architecture doesn't defines the ioremap_cache() function.

I've looked at using memremap() instead of ioremap_cache(). The problem is that we do support architectures with the TTM as well as amndgpu code where the __iomem annotation is mandatory and correct.

Regards,
Christian.
Am 02.03.21 um 23:45 schrieb Zeng, Oak:

[AMD Official Use Only - Internal Distribution Only]

Hi Daniel, Thomas, Dan,

Does below message mean the calling ioremap_cache failed intel's driver build? I can see both ioremap_cache and ioremap_wc are defined in arch/x86/mm/ioremap.c - why ioremap_wc doesn't break intel driver's build?

Are we supposed to use memremap (offset, size, MEMREMAP_WB) to replace ioremap_cache? When I read here https://lwn.net/Articles/653585/<https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flwn.net%2FArticles%2F653585%2F&data=04%7C01%7COak.Zeng%40amd.com%7Cc047ecb316df47cde7ed08d8de3188d4%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637503651624296472%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=ljCFrIfrYbb%2FXmKKS2TJ7dSQ7oCRNWoUhWS4gEBv%2FW4%3D&reserved=0> I felt that ioremap_cache returns an address annotated with _iomem while memremap returns an address without __iomem annotation. In our use case, GPU memory is treated as UEFI SPM (specific purpose memory). I am not very sure whether memremap (thus no __iomem annotation) is the right thing to do. What I am sure is, we have tested ioremap_cache and it works fine on AMD system.

I will send out a test patch replacing ioremap_cache with ioremap_wc, to trigger Intel build robot to see whether it fails Intel build. I suppose it will not fail Intel build.

Regards,
Oak

From: Christian König <ckoenig.leichtzumerken@gmail.com><mailto:ckoenig.leichtzumerken@gmail.com>
Sent: Tuesday, March 2, 2021 6:31 AM
To: amd-gfx@lists.freedesktop.org<mailto:amd-gfx@lists.freedesktop.org>; dri-devel@lists.freedesktop.org<mailto:dri-devel@lists.freedesktop.org>; Daniel Vetter <daniel@ffwll.ch><mailto:daniel@ffwll.ch>; Dave Airlie <airlied@redhat.com><mailto:airlied@redhat.com>; Thomas Hellström (Intel) <thomas_os@shipmail.org><mailto:thomas_os@shipmail.org>
Cc: Zeng, Oak <Oak.Zeng@amd.com><mailto:Oak.Zeng@amd.com>; kbuild-all@lists.01.org<mailto:kbuild-all@lists.01.org>; Kuehling, Felix <Felix.Kuehling@amd.com><mailto:Felix.Kuehling@amd.com>; Kasiviswanathan, Harish <Harish.Kasiviswanathan@amd.com><mailto:Harish.Kasiviswanathan@amd.com>; Deucher, Alexander <Alexander.Deucher@amd.com><mailto:Alexander.Deucher@amd.com>; Huang, JinHuiEric <JinHuiEric.Huang@amd.com><mailto:JinHuiEric.Huang@amd.com>; Koenig, Christian <Christian.Koenig@amd.com><mailto:Christian.Koenig@amd.com>
Subject: Re: [PATCH] drm/ttm: ioremap buffer according to TTM mem caching setting

Hi guys,

adding the usual suspects direct. Does anybody of hand know how to check if an architecture supports ioremap_cache()?

For now we only need this on X86, but I would feel better if we don't use an #ifdef here.

Regards,
Christian.
Am 02.03.21 um 05:12 schrieb kernel test robot:

Hi Oak,



Thank you for the patch! Yet something to improve:



[auto build test ERROR on drm-intel/for-linux-next]

[also build test ERROR on drm-tip/drm-tip linus/master v5.12-rc1 next-20210302]

[cannot apply to tegra-drm/drm/tegra/for-next drm-exynos/exynos-drm-next drm/drm-next]

[If your patch is applied to the wrong git tree, kindly drop us a note.

And when submitting patch, we suggest to use '--base' as documented in

https://git-scm.com/docs/git-format-patch<https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgit-scm.com%2Fdocs%2Fgit-format-patch&data=04%7C01%7COak.Zeng%40amd.com%7Cc047ecb316df47cde7ed08d8de3188d4%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637503651624306464%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=3f5ib%2FlZ6DXXF%2Bk1rXPKGu1IkOhXHdkUmX3obtuIRtA%3D&reserved=0>]



url:    https://github.com/0day-ci/linux/commits/Oak-Zeng/drm-ttm-ioremap-buffer-according-to-TTM-mem-caching-setting/20210302-064500<https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2F0day-ci%2Flinux%2Fcommits%2FOak-Zeng%2Fdrm-ttm-ioremap-buffer-according-to-TTM-mem-caching-setting%2F20210302-064500&data=04%7C01%7COak.Zeng%40amd.com%7Cc047ecb316df47cde7ed08d8de3188d4%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637503651624306464%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=Y9h9ZHM7d2Sqo3XQWr%2Frpb2DAk9SkHFIm5nD4ABFNbE%3D&reserved=0>

base:   git://anongit.freedesktop.org/drm-intel for-linux-next

config: parisc-randconfig-r012-20210302 (attached as .config)

compiler: hppa-linux-gcc (GCC) 9.3.0

reproduce (this is a W=1 build):

        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross<https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fraw.githubusercontent.com%2Fintel%2Flkp-tests%2Fmaster%2Fsbin%2Fmake.cross&data=04%7C01%7COak.Zeng%40amd.com%7Cc047ecb316df47cde7ed08d8de3188d4%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637503651624316464%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=wGo3Nwk4mWZjb2W3E7qKf3FtKzLOxCVmQu1zd2rmzRU%3D&reserved=0> -O ~/bin/make.cross

        chmod +x ~/bin/make.cross

        # https://github.com/0day-ci/linux/commit/225bb3711439ec559dd72ae5af8e62d34ea60a64<https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2F0day-ci%2Flinux%2Fcommit%2F225bb3711439ec559dd72ae5af8e62d34ea60a64&data=04%7C01%7COak.Zeng%40amd.com%7Cc047ecb316df47cde7ed08d8de3188d4%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637503651624316464%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=kOz18UAawmA4SZ6IrCGRt4HISfsmmjfGN2TUgAtm0Ak%3D&reserved=0>

        git remote add linux-review https://github.com/0day-ci/linux<https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2F0day-ci%2Flinux&data=04%7C01%7COak.Zeng%40amd.com%7Cc047ecb316df47cde7ed08d8de3188d4%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637503651624326458%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=QnKs47gjzAz%2Fjv%2FAO6H%2BwYNQF6mdk1D8dCNveW0YHuM%3D&reserved=0>

        git fetch --no-tags linux-review Oak-Zeng/drm-ttm-ioremap-buffer-according-to-TTM-mem-caching-setting/20210302-064500

        git checkout 225bb3711439ec559dd72ae5af8e62d34ea60a64

        # save the attached .config to linux build tree

        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=parisc



If you fix the issue, kindly add following tag as appropriate

Reported-by: kernel test robot <lkp@intel.com><mailto:lkp@intel.com>



All errors (new ones prefixed by >>):



   drivers/gpu/drm/ttm/ttm_bo_util.c: In function 'ttm_resource_ioremap':

drivers/gpu/drm/ttm/ttm_bo_util.c:95:11: error: implicit declaration of function 'ioremap_cache'; did you mean 'ioremap_uc'? [-Werror=implicit-function-declaration]

      95 |    addr = ioremap_cache(mem->bus.offset, bus_size);

         |           ^~~~~~~~~~~~~

         |           ioremap_uc

   drivers/gpu/drm/ttm/ttm_bo_util.c:95:9: warning: assignment to 'void *' from 'int' makes pointer from integer without a cast [-Wint-conversion]

      95 |    addr = ioremap_cache(mem->bus.offset, bus_size);

         |         ^

   drivers/gpu/drm/ttm/ttm_bo_util.c: In function 'ttm_bo_ioremap':

   drivers/gpu/drm/ttm/ttm_bo_util.c:379:17: warning: assignment to 'void *' from 'int' makes pointer from integer without a cast [-Wint-conversion]

     379 |    map->virtual = ioremap_cache(bo->mem.bus.offset + offset,

         |                 ^

   drivers/gpu/drm/ttm/ttm_bo_util.c: In function 'ttm_bo_vmap':

   drivers/gpu/drm/ttm/ttm_bo_util.c:500:16: warning: assignment to 'void *' from 'int' makes pointer from integer without a cast [-Wint-conversion]

     500 |    vaddr_iomem = ioremap_cache(mem->bus.offset,

         |                ^

   cc1: some warnings being treated as errors





vim +95 drivers/gpu/drm/ttm/ttm_bo_util.c



    74

    75  static int ttm_resource_ioremap(struct ttm_bo_device *bdev,

    76                                struct ttm_resource *mem,

    77                                void **virtual)

    78  {

    79          int ret;

    80          void *addr;

    81

    82          *virtual = NULL;

    83          ret = ttm_mem_io_reserve(bdev, mem);

    84          if (ret || !mem->bus.is_iomem)

    85                  return ret;

    86

    87          if (mem->bus.addr) {

    88                  addr = mem->bus.addr;

    89          } else {

    90                  size_t bus_size = (size_t)mem->num_pages << PAGE_SHIFT;

    91

    92                  if (mem->bus.caching == ttm_write_combined)

    93                         addr = ioremap_wc(mem->bus.offset, bus_size);

    94                  else if (mem->bus.caching == ttm_cached)

  > 95                         addr = ioremap_cache(mem->bus.offset, bus_size);

    96                  else

    97                         addr = ioremap(mem->bus.offset, bus_size);

    98                  if (!addr) {

    99                         ttm_mem_io_free(bdev, mem);

   100                         return -ENOMEM;

   101                  }

   102          }

   103          *virtual = addr;

   104          return 0;

   105  }

   106



---

0-DAY CI Kernel Test Service, Intel Corporation

https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org<https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.01.org%2Fhyperkitty%2Flist%2Fkbuild-all%40lists.01.org&data=04%7C01%7COak.Zeng%40amd.com%7Cc047ecb316df47cde7ed08d8de3188d4%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637503651624326458%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=MY6tEGVY0X4VyS750dYmsfVoR71Zp78YdxuqqRljnsI%3D&reserved=0>




_______________________________________________

amd-gfx mailing list

amd-gfx@lists.freedesktop.org<mailto:amd-gfx@lists.freedesktop.org>

https://lists.freedesktop.org/mailman/listinfo/amd-gfx<https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&data=04%7C01%7COak.Zeng%40amd.com%7Cc047ecb316df47cde7ed08d8de3188d4%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637503651624336455%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=Or3tWmS5M6mXOaFP4FHsEbg0rqoizNGpTl6JEkD6fac%3D&reserved=0>



[-- Attachment #1.2: Type: text/html, Size: 22737 bytes --]

[-- Attachment #2: Type: text/plain, Size: 160 bytes --]

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

^ permalink raw reply	[flat|nested] 49+ messages in thread

* RE: [PATCH] drm/ttm: ioremap buffer according to TTM mem caching setting
@ 2021-03-03 20:59           ` Zeng, Oak
  0 siblings, 0 replies; 49+ messages in thread
From: Zeng, Oak @ 2021-03-03 20:59 UTC (permalink / raw)
  To: Christian König, amd-gfx, dri-devel, Daniel Vetter,
	Dave Airlie, Thomas Hellström (Intel),
	dan.j.williams
  Cc: kbuild-all, Kuehling, Felix, Kasiviswanathan, Harish, Huang,
	JinHuiEric, Deucher, Alexander, Koenig, Christian


[-- Attachment #1.1: Type: text/plain, Size: 12126 bytes --]

[AMD Official Use Only - Internal Distribution Only]

Hi Christian,

Can you explain why __iomem annotation is mandatory for amdgpu driver? If this is the case, we can't switch to memremap. The only fix seems to me is add a #ifdef __x86_64__ to the ioremap_cache codes.

Regards,
Oak

From: Christian König <ckoenig.leichtzumerken@gmail.com>
Sent: Wednesday, March 3, 2021 5:46 AM
To: Zeng, Oak <Oak.Zeng@amd.com>; amd-gfx@lists.freedesktop.org; dri-devel@lists.freedesktop.org; Daniel Vetter <daniel@ffwll.ch>; Dave Airlie <airlied@redhat.com>; Thomas Hellström (Intel) <thomas_os@shipmail.org>; dan.j.williams@intel.com
Cc: kbuild-all@lists.01.org; Kuehling, Felix <Felix.Kuehling@amd.com>; Kasiviswanathan, Harish <Harish.Kasiviswanathan@amd.com>; Deucher, Alexander <Alexander.Deucher@amd.com>; Huang, JinHuiEric <JinHuiEric.Huang@amd.com>; Koenig, Christian <Christian.Koenig@amd.com>
Subject: Re: [PATCH] drm/ttm: ioremap buffer according to TTM mem caching setting

Hi Oak,



config: parisc-randconfig-r012-20210302 (attached as .config)

It's not the Intel driver build which fails here, but the build bot is just hosted by Intel.

The problem is that the parisc architecture doesn't defines the ioremap_cache() function.

I've looked at using memremap() instead of ioremap_cache(). The problem is that we do support architectures with the TTM as well as amndgpu code where the __iomem annotation is mandatory and correct.

Regards,
Christian.
Am 02.03.21 um 23:45 schrieb Zeng, Oak:

[AMD Official Use Only - Internal Distribution Only]

Hi Daniel, Thomas, Dan,

Does below message mean the calling ioremap_cache failed intel's driver build? I can see both ioremap_cache and ioremap_wc are defined in arch/x86/mm/ioremap.c - why ioremap_wc doesn't break intel driver's build?

Are we supposed to use memremap (offset, size, MEMREMAP_WB) to replace ioremap_cache? When I read here https://lwn.net/Articles/653585/<https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flwn.net%2FArticles%2F653585%2F&data=04%7C01%7COak.Zeng%40amd.com%7Cc047ecb316df47cde7ed08d8de3188d4%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637503651624296472%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=ljCFrIfrYbb%2FXmKKS2TJ7dSQ7oCRNWoUhWS4gEBv%2FW4%3D&reserved=0> I felt that ioremap_cache returns an address annotated with _iomem while memremap returns an address without __iomem annotation. In our use case, GPU memory is treated as UEFI SPM (specific purpose memory). I am not very sure whether memremap (thus no __iomem annotation) is the right thing to do. What I am sure is, we have tested ioremap_cache and it works fine on AMD system.

I will send out a test patch replacing ioremap_cache with ioremap_wc, to trigger Intel build robot to see whether it fails Intel build. I suppose it will not fail Intel build.

Regards,
Oak

From: Christian König <ckoenig.leichtzumerken@gmail.com><mailto:ckoenig.leichtzumerken@gmail.com>
Sent: Tuesday, March 2, 2021 6:31 AM
To: amd-gfx@lists.freedesktop.org<mailto:amd-gfx@lists.freedesktop.org>; dri-devel@lists.freedesktop.org<mailto:dri-devel@lists.freedesktop.org>; Daniel Vetter <daniel@ffwll.ch><mailto:daniel@ffwll.ch>; Dave Airlie <airlied@redhat.com><mailto:airlied@redhat.com>; Thomas Hellström (Intel) <thomas_os@shipmail.org><mailto:thomas_os@shipmail.org>
Cc: Zeng, Oak <Oak.Zeng@amd.com><mailto:Oak.Zeng@amd.com>; kbuild-all@lists.01.org<mailto:kbuild-all@lists.01.org>; Kuehling, Felix <Felix.Kuehling@amd.com><mailto:Felix.Kuehling@amd.com>; Kasiviswanathan, Harish <Harish.Kasiviswanathan@amd.com><mailto:Harish.Kasiviswanathan@amd.com>; Deucher, Alexander <Alexander.Deucher@amd.com><mailto:Alexander.Deucher@amd.com>; Huang, JinHuiEric <JinHuiEric.Huang@amd.com><mailto:JinHuiEric.Huang@amd.com>; Koenig, Christian <Christian.Koenig@amd.com><mailto:Christian.Koenig@amd.com>
Subject: Re: [PATCH] drm/ttm: ioremap buffer according to TTM mem caching setting

Hi guys,

adding the usual suspects direct. Does anybody of hand know how to check if an architecture supports ioremap_cache()?

For now we only need this on X86, but I would feel better if we don't use an #ifdef here.

Regards,
Christian.
Am 02.03.21 um 05:12 schrieb kernel test robot:

Hi Oak,



Thank you for the patch! Yet something to improve:



[auto build test ERROR on drm-intel/for-linux-next]

[also build test ERROR on drm-tip/drm-tip linus/master v5.12-rc1 next-20210302]

[cannot apply to tegra-drm/drm/tegra/for-next drm-exynos/exynos-drm-next drm/drm-next]

[If your patch is applied to the wrong git tree, kindly drop us a note.

And when submitting patch, we suggest to use '--base' as documented in

https://git-scm.com/docs/git-format-patch<https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgit-scm.com%2Fdocs%2Fgit-format-patch&data=04%7C01%7COak.Zeng%40amd.com%7Cc047ecb316df47cde7ed08d8de3188d4%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637503651624306464%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=3f5ib%2FlZ6DXXF%2Bk1rXPKGu1IkOhXHdkUmX3obtuIRtA%3D&reserved=0>]



url:    https://github.com/0day-ci/linux/commits/Oak-Zeng/drm-ttm-ioremap-buffer-according-to-TTM-mem-caching-setting/20210302-064500<https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2F0day-ci%2Flinux%2Fcommits%2FOak-Zeng%2Fdrm-ttm-ioremap-buffer-according-to-TTM-mem-caching-setting%2F20210302-064500&data=04%7C01%7COak.Zeng%40amd.com%7Cc047ecb316df47cde7ed08d8de3188d4%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637503651624306464%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=Y9h9ZHM7d2Sqo3XQWr%2Frpb2DAk9SkHFIm5nD4ABFNbE%3D&reserved=0>

base:   git://anongit.freedesktop.org/drm-intel for-linux-next

config: parisc-randconfig-r012-20210302 (attached as .config)

compiler: hppa-linux-gcc (GCC) 9.3.0

reproduce (this is a W=1 build):

        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross<https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fraw.githubusercontent.com%2Fintel%2Flkp-tests%2Fmaster%2Fsbin%2Fmake.cross&data=04%7C01%7COak.Zeng%40amd.com%7Cc047ecb316df47cde7ed08d8de3188d4%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637503651624316464%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=wGo3Nwk4mWZjb2W3E7qKf3FtKzLOxCVmQu1zd2rmzRU%3D&reserved=0> -O ~/bin/make.cross

        chmod +x ~/bin/make.cross

        # https://github.com/0day-ci/linux/commit/225bb3711439ec559dd72ae5af8e62d34ea60a64<https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2F0day-ci%2Flinux%2Fcommit%2F225bb3711439ec559dd72ae5af8e62d34ea60a64&data=04%7C01%7COak.Zeng%40amd.com%7Cc047ecb316df47cde7ed08d8de3188d4%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637503651624316464%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=kOz18UAawmA4SZ6IrCGRt4HISfsmmjfGN2TUgAtm0Ak%3D&reserved=0>

        git remote add linux-review https://github.com/0day-ci/linux<https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2F0day-ci%2Flinux&data=04%7C01%7COak.Zeng%40amd.com%7Cc047ecb316df47cde7ed08d8de3188d4%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637503651624326458%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=QnKs47gjzAz%2Fjv%2FAO6H%2BwYNQF6mdk1D8dCNveW0YHuM%3D&reserved=0>

        git fetch --no-tags linux-review Oak-Zeng/drm-ttm-ioremap-buffer-according-to-TTM-mem-caching-setting/20210302-064500

        git checkout 225bb3711439ec559dd72ae5af8e62d34ea60a64

        # save the attached .config to linux build tree

        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=parisc



If you fix the issue, kindly add following tag as appropriate

Reported-by: kernel test robot <lkp@intel.com><mailto:lkp@intel.com>



All errors (new ones prefixed by >>):



   drivers/gpu/drm/ttm/ttm_bo_util.c: In function 'ttm_resource_ioremap':

drivers/gpu/drm/ttm/ttm_bo_util.c:95:11: error: implicit declaration of function 'ioremap_cache'; did you mean 'ioremap_uc'? [-Werror=implicit-function-declaration]

      95 |    addr = ioremap_cache(mem->bus.offset, bus_size);

         |           ^~~~~~~~~~~~~

         |           ioremap_uc

   drivers/gpu/drm/ttm/ttm_bo_util.c:95:9: warning: assignment to 'void *' from 'int' makes pointer from integer without a cast [-Wint-conversion]

      95 |    addr = ioremap_cache(mem->bus.offset, bus_size);

         |         ^

   drivers/gpu/drm/ttm/ttm_bo_util.c: In function 'ttm_bo_ioremap':

   drivers/gpu/drm/ttm/ttm_bo_util.c:379:17: warning: assignment to 'void *' from 'int' makes pointer from integer without a cast [-Wint-conversion]

     379 |    map->virtual = ioremap_cache(bo->mem.bus.offset + offset,

         |                 ^

   drivers/gpu/drm/ttm/ttm_bo_util.c: In function 'ttm_bo_vmap':

   drivers/gpu/drm/ttm/ttm_bo_util.c:500:16: warning: assignment to 'void *' from 'int' makes pointer from integer without a cast [-Wint-conversion]

     500 |    vaddr_iomem = ioremap_cache(mem->bus.offset,

         |                ^

   cc1: some warnings being treated as errors





vim +95 drivers/gpu/drm/ttm/ttm_bo_util.c



    74

    75  static int ttm_resource_ioremap(struct ttm_bo_device *bdev,

    76                                struct ttm_resource *mem,

    77                                void **virtual)

    78  {

    79          int ret;

    80          void *addr;

    81

    82          *virtual = NULL;

    83          ret = ttm_mem_io_reserve(bdev, mem);

    84          if (ret || !mem->bus.is_iomem)

    85                  return ret;

    86

    87          if (mem->bus.addr) {

    88                  addr = mem->bus.addr;

    89          } else {

    90                  size_t bus_size = (size_t)mem->num_pages << PAGE_SHIFT;

    91

    92                  if (mem->bus.caching == ttm_write_combined)

    93                         addr = ioremap_wc(mem->bus.offset, bus_size);

    94                  else if (mem->bus.caching == ttm_cached)

  > 95                         addr = ioremap_cache(mem->bus.offset, bus_size);

    96                  else

    97                         addr = ioremap(mem->bus.offset, bus_size);

    98                  if (!addr) {

    99                         ttm_mem_io_free(bdev, mem);

   100                         return -ENOMEM;

   101                  }

   102          }

   103          *virtual = addr;

   104          return 0;

   105  }

   106



---

0-DAY CI Kernel Test Service, Intel Corporation

https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org<https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.01.org%2Fhyperkitty%2Flist%2Fkbuild-all%40lists.01.org&data=04%7C01%7COak.Zeng%40amd.com%7Cc047ecb316df47cde7ed08d8de3188d4%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637503651624326458%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=MY6tEGVY0X4VyS750dYmsfVoR71Zp78YdxuqqRljnsI%3D&reserved=0>




_______________________________________________

amd-gfx mailing list

amd-gfx@lists.freedesktop.org<mailto:amd-gfx@lists.freedesktop.org>

https://lists.freedesktop.org/mailman/listinfo/amd-gfx<https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&data=04%7C01%7COak.Zeng%40amd.com%7Cc047ecb316df47cde7ed08d8de3188d4%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637503651624336455%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=Or3tWmS5M6mXOaFP4FHsEbg0rqoizNGpTl6JEkD6fac%3D&reserved=0>



[-- Attachment #1.2: Type: text/html, Size: 22737 bytes --]

[-- Attachment #2: Type: text/plain, Size: 154 bytes --]

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply	[flat|nested] 49+ messages in thread

* Re: [PATCH] drm/ttm: ioremap buffer according to TTM mem caching setting
  2021-03-03 10:45         ` Christian König
  (?)
  (?)
@ 2021-03-03 20:59         ` Zeng, Oak
  -1 siblings, 0 replies; 49+ messages in thread
From: Zeng, Oak @ 2021-03-03 20:59 UTC (permalink / raw)
  To: kbuild-all

[-- Attachment #1: Type: text/plain, Size: 12148 bytes --]

[AMD Official Use Only - Internal Distribution Only]

Hi Christian,

Can you explain why __iomem annotation is mandatory for amdgpu driver? If this is the case, we can't switch to memremap. The only fix seems to me is add a #ifdef __x86_64__ to the ioremap_cache codes.

Regards,
Oak

From: Christian König <ckoenig.leichtzumerken@gmail.com>
Sent: Wednesday, March 3, 2021 5:46 AM
To: Zeng, Oak <Oak.Zeng@amd.com>; amd-gfx(a)lists.freedesktop.org; dri-devel(a)lists.freedesktop.org; Daniel Vetter <daniel@ffwll.ch>; Dave Airlie <airlied@redhat.com>; Thomas Hellström (Intel) <thomas_os@shipmail.org>; dan.j.williams(a)intel.com
Cc: kbuild-all(a)lists.01.org; Kuehling, Felix <Felix.Kuehling@amd.com>; Kasiviswanathan, Harish <Harish.Kasiviswanathan@amd.com>; Deucher, Alexander <Alexander.Deucher@amd.com>; Huang, JinHuiEric <JinHuiEric.Huang@amd.com>; Koenig, Christian <Christian.Koenig@amd.com>
Subject: Re: [PATCH] drm/ttm: ioremap buffer according to TTM mem caching setting

Hi Oak,



config: parisc-randconfig-r012-20210302 (attached as .config)

It's not the Intel driver build which fails here, but the build bot is just hosted by Intel.

The problem is that the parisc architecture doesn't defines the ioremap_cache() function.

I've looked at using memremap() instead of ioremap_cache(). The problem is that we do support architectures with the TTM as well as amndgpu code where the __iomem annotation is mandatory and correct.

Regards,
Christian.
Am 02.03.21 um 23:45 schrieb Zeng, Oak:

[AMD Official Use Only - Internal Distribution Only]

Hi Daniel, Thomas, Dan,

Does below message mean the calling ioremap_cache failed intel's driver build? I can see both ioremap_cache and ioremap_wc are defined in arch/x86/mm/ioremap.c - why ioremap_wc doesn't break intel driver's build?

Are we supposed to use memremap (offset, size, MEMREMAP_WB) to replace ioremap_cache? When I read here https://lwn.net/Articles/653585/<https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flwn.net%2FArticles%2F653585%2F&data=04%7C01%7COak.Zeng%40amd.com%7Cc047ecb316df47cde7ed08d8de3188d4%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637503651624296472%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=ljCFrIfrYbb%2FXmKKS2TJ7dSQ7oCRNWoUhWS4gEBv%2FW4%3D&reserved=0> I felt that ioremap_cache returns an address annotated with _iomem while memremap returns an address without __iomem annotation. In our use case, GPU memory is treated as UEFI SPM (specific purpose memory). I am not very sure whether memremap (thus no __iomem annotation) is the right thing to do. What I am sure is, we have tested ioremap_cache and it works fine on AMD system.

I will send out a test patch replacing ioremap_cache with ioremap_wc, to trigger Intel build robot to see whether it fails Intel build. I suppose it will not fail Intel build.

Regards,
Oak

From: Christian König <ckoenig.leichtzumerken@gmail.com><mailto:ckoenig.leichtzumerken@gmail.com>
Sent: Tuesday, March 2, 2021 6:31 AM
To: amd-gfx(a)lists.freedesktop.org<mailto:amd-gfx@lists.freedesktop.org>; dri-devel(a)lists.freedesktop.org<mailto:dri-devel@lists.freedesktop.org>; Daniel Vetter <daniel@ffwll.ch><mailto:daniel@ffwll.ch>; Dave Airlie <airlied@redhat.com><mailto:airlied@redhat.com>; Thomas Hellström (Intel) <thomas_os@shipmail.org><mailto:thomas_os@shipmail.org>
Cc: Zeng, Oak <Oak.Zeng@amd.com><mailto:Oak.Zeng@amd.com>; kbuild-all(a)lists.01.org<mailto:kbuild-all@lists.01.org>; Kuehling, Felix <Felix.Kuehling@amd.com><mailto:Felix.Kuehling@amd.com>; Kasiviswanathan, Harish <Harish.Kasiviswanathan@amd.com><mailto:Harish.Kasiviswanathan@amd.com>; Deucher, Alexander <Alexander.Deucher@amd.com><mailto:Alexander.Deucher@amd.com>; Huang, JinHuiEric <JinHuiEric.Huang@amd.com><mailto:JinHuiEric.Huang@amd.com>; Koenig, Christian <Christian.Koenig@amd.com><mailto:Christian.Koenig@amd.com>
Subject: Re: [PATCH] drm/ttm: ioremap buffer according to TTM mem caching setting

Hi guys,

adding the usual suspects direct. Does anybody of hand know how to check if an architecture supports ioremap_cache()?

For now we only need this on X86, but I would feel better if we don't use an #ifdef here.

Regards,
Christian.
Am 02.03.21 um 05:12 schrieb kernel test robot:

Hi Oak,



Thank you for the patch! Yet something to improve:



[auto build test ERROR on drm-intel/for-linux-next]

[also build test ERROR on drm-tip/drm-tip linus/master v5.12-rc1 next-20210302]

[cannot apply to tegra-drm/drm/tegra/for-next drm-exynos/exynos-drm-next drm/drm-next]

[If your patch is applied to the wrong git tree, kindly drop us a note.

And when submitting patch, we suggest to use '--base' as documented in

https://git-scm.com/docs/git-format-patch<https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgit-scm.com%2Fdocs%2Fgit-format-patch&data=04%7C01%7COak.Zeng%40amd.com%7Cc047ecb316df47cde7ed08d8de3188d4%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637503651624306464%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=3f5ib%2FlZ6DXXF%2Bk1rXPKGu1IkOhXHdkUmX3obtuIRtA%3D&reserved=0>]



url:    https://github.com/0day-ci/linux/commits/Oak-Zeng/drm-ttm-ioremap-buffer-according-to-TTM-mem-caching-setting/20210302-064500<https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2F0day-ci%2Flinux%2Fcommits%2FOak-Zeng%2Fdrm-ttm-ioremap-buffer-according-to-TTM-mem-caching-setting%2F20210302-064500&data=04%7C01%7COak.Zeng%40amd.com%7Cc047ecb316df47cde7ed08d8de3188d4%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637503651624306464%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=Y9h9ZHM7d2Sqo3XQWr%2Frpb2DAk9SkHFIm5nD4ABFNbE%3D&reserved=0>

base:   git://anongit.freedesktop.org/drm-intel for-linux-next

config: parisc-randconfig-r012-20210302 (attached as .config)

compiler: hppa-linux-gcc (GCC) 9.3.0

reproduce (this is a W=1 build):

        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross<https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fraw.githubusercontent.com%2Fintel%2Flkp-tests%2Fmaster%2Fsbin%2Fmake.cross&data=04%7C01%7COak.Zeng%40amd.com%7Cc047ecb316df47cde7ed08d8de3188d4%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637503651624316464%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=wGo3Nwk4mWZjb2W3E7qKf3FtKzLOxCVmQu1zd2rmzRU%3D&reserved=0> -O ~/bin/make.cross

        chmod +x ~/bin/make.cross

        # https://github.com/0day-ci/linux/commit/225bb3711439ec559dd72ae5af8e62d34ea60a64<https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2F0day-ci%2Flinux%2Fcommit%2F225bb3711439ec559dd72ae5af8e62d34ea60a64&data=04%7C01%7COak.Zeng%40amd.com%7Cc047ecb316df47cde7ed08d8de3188d4%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637503651624316464%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=kOz18UAawmA4SZ6IrCGRt4HISfsmmjfGN2TUgAtm0Ak%3D&reserved=0>

        git remote add linux-review https://github.com/0day-ci/linux<https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2F0day-ci%2Flinux&data=04%7C01%7COak.Zeng%40amd.com%7Cc047ecb316df47cde7ed08d8de3188d4%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637503651624326458%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=QnKs47gjzAz%2Fjv%2FAO6H%2BwYNQF6mdk1D8dCNveW0YHuM%3D&reserved=0>

        git fetch --no-tags linux-review Oak-Zeng/drm-ttm-ioremap-buffer-according-to-TTM-mem-caching-setting/20210302-064500

        git checkout 225bb3711439ec559dd72ae5af8e62d34ea60a64

        # save the attached .config to linux build tree

        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=parisc



If you fix the issue, kindly add following tag as appropriate

Reported-by: kernel test robot <lkp@intel.com><mailto:lkp@intel.com>



All errors (new ones prefixed by >>):



   drivers/gpu/drm/ttm/ttm_bo_util.c: In function 'ttm_resource_ioremap':

drivers/gpu/drm/ttm/ttm_bo_util.c:95:11: error: implicit declaration of function 'ioremap_cache'; did you mean 'ioremap_uc'? [-Werror=implicit-function-declaration]

      95 |    addr = ioremap_cache(mem->bus.offset, bus_size);

         |           ^~~~~~~~~~~~~

         |           ioremap_uc

   drivers/gpu/drm/ttm/ttm_bo_util.c:95:9: warning: assignment to 'void *' from 'int' makes pointer from integer without a cast [-Wint-conversion]

      95 |    addr = ioremap_cache(mem->bus.offset, bus_size);

         |         ^

   drivers/gpu/drm/ttm/ttm_bo_util.c: In function 'ttm_bo_ioremap':

   drivers/gpu/drm/ttm/ttm_bo_util.c:379:17: warning: assignment to 'void *' from 'int' makes pointer from integer without a cast [-Wint-conversion]

     379 |    map->virtual = ioremap_cache(bo->mem.bus.offset + offset,

         |                 ^

   drivers/gpu/drm/ttm/ttm_bo_util.c: In function 'ttm_bo_vmap':

   drivers/gpu/drm/ttm/ttm_bo_util.c:500:16: warning: assignment to 'void *' from 'int' makes pointer from integer without a cast [-Wint-conversion]

     500 |    vaddr_iomem = ioremap_cache(mem->bus.offset,

         |                ^

   cc1: some warnings being treated as errors





vim +95 drivers/gpu/drm/ttm/ttm_bo_util.c



    74

    75  static int ttm_resource_ioremap(struct ttm_bo_device *bdev,

    76                                struct ttm_resource *mem,

    77                                void **virtual)

    78  {

    79          int ret;

    80          void *addr;

    81

    82          *virtual = NULL;

    83          ret = ttm_mem_io_reserve(bdev, mem);

    84          if (ret || !mem->bus.is_iomem)

    85                  return ret;

    86

    87          if (mem->bus.addr) {

    88                  addr = mem->bus.addr;

    89          } else {

    90                  size_t bus_size = (size_t)mem->num_pages << PAGE_SHIFT;

    91

    92                  if (mem->bus.caching == ttm_write_combined)

    93                         addr = ioremap_wc(mem->bus.offset, bus_size);

    94                  else if (mem->bus.caching == ttm_cached)

  > 95                         addr = ioremap_cache(mem->bus.offset, bus_size);

    96                  else

    97                         addr = ioremap(mem->bus.offset, bus_size);

    98                  if (!addr) {

    99                         ttm_mem_io_free(bdev, mem);

   100                         return -ENOMEM;

   101                  }

   102          }

   103          *virtual = addr;

   104          return 0;

   105  }

   106



---

0-DAY CI Kernel Test Service, Intel Corporation

https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org<https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.01.org%2Fhyperkitty%2Flist%2Fkbuild-all%40lists.01.org&data=04%7C01%7COak.Zeng%40amd.com%7Cc047ecb316df47cde7ed08d8de3188d4%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637503651624326458%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=MY6tEGVY0X4VyS750dYmsfVoR71Zp78YdxuqqRljnsI%3D&reserved=0>




_______________________________________________

amd-gfx mailing list

amd-gfx(a)lists.freedesktop.org<mailto:amd-gfx@lists.freedesktop.org>

https://lists.freedesktop.org/mailman/listinfo/amd-gfx<https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&data=04%7C01%7COak.Zeng%40amd.com%7Cc047ecb316df47cde7ed08d8de3188d4%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637503651624336455%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=Or3tWmS5M6mXOaFP4FHsEbg0rqoizNGpTl6JEkD6fac%3D&reserved=0>



[-- Attachment #2: attachment.htm --]
[-- Type: text/html, Size: 22465 bytes --]

^ permalink raw reply	[flat|nested] 49+ messages in thread

* Re: [PATCH] drm/ttm: ioremap buffer according to TTM mem caching setting
  2021-03-02 22:45       ` Zeng, Oak
@ 2021-03-03 10:45         ` Christian König
  -1 siblings, 0 replies; 49+ messages in thread
From: Christian König @ 2021-03-03 10:45 UTC (permalink / raw)
  To: Zeng, Oak, amd-gfx, dri-devel, Daniel Vetter, Dave Airlie,
	Thomas Hellström (Intel),
	dan.j.williams
  Cc: kbuild-all, Kuehling, Felix, Kasiviswanathan, Harish, Huang,
	JinHuiEric, Deucher, Alexander, Koenig, Christian


[-- Attachment #1.1: Type: text/plain, Size: 10841 bytes --]

Hi Oak,

> config: parisc-randconfig-r012-20210302 (attached as .config)

It's not the Intel driver build which fails here, but the build bot is 
just hosted by Intel.

The problem is that the parisc architecture doesn't defines the 
ioremap_cache() function.

I've looked at using memremap() instead of ioremap_cache(). The problem 
is that we do support architectures with the TTM as well as amndgpu code 
where the __iomem annotation is mandatory and correct.

Regards,
Christian.

Am 02.03.21 um 23:45 schrieb Zeng, Oak:
>
> [AMD Official Use Only - Internal Distribution Only]
>
>
> Hi Daniel, Thomas, Dan,
>
> Does below message mean the calling ioremap_cache failed intel’s 
> driver build? I can see both ioremap_cache and ioremap_wc are defined 
> in arch/x86/mm/ioremap.c – why ioremap_wc doesn’t break intel driver’s 
> build?
>
> Are we supposed to use memremap (offset, size, MEMREMAP_WB) to replace 
> ioremap_cache? When I read here https://lwn.net/Articles/653585/ I 
> felt that ioremap_cache returns an address annotated with _iomem while 
> memremap returns an address without __iomem annotation. In our use 
> case, GPU memory is treated as UEFI SPM (specific purpose memory). I 
> am not very sure whether memremap (thus no __iomem annotation) is the 
> right thing to do. What I am sure is, we have tested ioremap_cache and 
> it works fine on AMD system.
>
> I will send out a test patch replacing ioremap_cache with ioremap_wc, 
> to trigger Intel build robot to see whether it fails Intel build. I 
> suppose it will not fail Intel build.
>
> Regards,
>
> Oak
>
> *From:* Christian König <ckoenig.leichtzumerken@gmail.com>
> *Sent:* Tuesday, March 2, 2021 6:31 AM
> *To:* amd-gfx@lists.freedesktop.org; dri-devel@lists.freedesktop.org; 
> Daniel Vetter <daniel@ffwll.ch>; Dave Airlie <airlied@redhat.com>; 
> Thomas Hellström (Intel) <thomas_os@shipmail.org>
> *Cc:* Zeng, Oak <Oak.Zeng@amd.com>; kbuild-all@lists.01.org; Kuehling, 
> Felix <Felix.Kuehling@amd.com>; Kasiviswanathan, Harish 
> <Harish.Kasiviswanathan@amd.com>; Deucher, Alexander 
> <Alexander.Deucher@amd.com>; Huang, JinHuiEric 
> <JinHuiEric.Huang@amd.com>; Koenig, Christian <Christian.Koenig@amd.com>
> *Subject:* Re: [PATCH] drm/ttm: ioremap buffer according to TTM mem 
> caching setting
>
> Hi guys,
>
> adding the usual suspects direct. Does anybody of hand know how to 
> check if an architecture supports ioremap_cache()?
>
> For now we only need this on X86, but I would feel better if we don't 
> use an #ifdef here.
>
> Regards,
> Christian.
>
> Am 02.03.21 um 05:12 schrieb kernel test robot:
>
>     Hi Oak,
>
>     Thank you for the patch! Yet something to improve:
>
>     [auto build test ERROR on drm-intel/for-linux-next]
>
>     [also build test ERROR on drm-tip/drm-tip linus/master v5.12-rc1 next-20210302]
>
>     [cannot apply to tegra-drm/drm/tegra/for-next drm-exynos/exynos-drm-next drm/drm-next]
>
>     [If your patch is applied to the wrong git tree, kindly drop us a note.
>
>     And when submitting patch, we suggest to use '--base' as documented in
>
>     https://git-scm.com/docs/git-format-patch  <https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgit-scm.com%2Fdocs%2Fgit-format-patch&data=04%7C01%7COak.Zeng%40amd.com%7C08f51e87e36c4de858bc08d8dd6eb16b%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637502814793168696%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=p4iynMPvZGknfSGSyZnXV3kLwScMLbPDB8zVsmxhtk0%3D&reserved=0>]
>
>     url:https://github.com/0day-ci/linux/commits/Oak-Zeng/drm-ttm-ioremap-buffer-according-to-TTM-mem-caching-setting/20210302-064500  <https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2F0day-ci%2Flinux%2Fcommits%2FOak-Zeng%2Fdrm-ttm-ioremap-buffer-according-to-TTM-mem-caching-setting%2F20210302-064500&data=04%7C01%7COak.Zeng%40amd.com%7C08f51e87e36c4de858bc08d8dd6eb16b%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637502814793178689%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=2sc4jZR3bVRF0xDDqNOtUcNR9qiJMF2ATmCDAX%2BSWrQ%3D&reserved=0>
>
>     base:   git://anongit.freedesktop.org/drm-intel for-linux-next
>
>     config: parisc-randconfig-r012-20210302 (attached as .config)
>
>     compiler: hppa-linux-gcc (GCC) 9.3.0
>
>     reproduce (this is a W=1 build):
>
>              wgethttps://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross  <https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fraw.githubusercontent.com%2Fintel%2Flkp-tests%2Fmaster%2Fsbin%2Fmake.cross&data=04%7C01%7COak.Zeng%40amd.com%7C08f51e87e36c4de858bc08d8dd6eb16b%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637502814793178689%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=uILcLE%2F24bhSU%2Bo5GmWGAK6s6xDFivP6lrm6JgtM50Y%3D&reserved=0>  -O ~/bin/make.cross
>
>              chmod +x ~/bin/make.cross
>
>              #https://github.com/0day-ci/linux/commit/225bb3711439ec559dd72ae5af8e62d34ea60a64  <https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2F0day-ci%2Flinux%2Fcommit%2F225bb3711439ec559dd72ae5af8e62d34ea60a64&data=04%7C01%7COak.Zeng%40amd.com%7C08f51e87e36c4de858bc08d8dd6eb16b%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637502814793188685%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=2TOSPuKEMRcZjMfxO9lxgwFxgXwHqERCOgRednI7OE8%3D&reserved=0>
>
>              git remote add linux-reviewhttps://github.com/0day-ci/linux  <https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2F0day-ci%2Flinux&data=04%7C01%7COak.Zeng%40amd.com%7C08f51e87e36c4de858bc08d8dd6eb16b%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637502814793188685%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=TlXvs5mxH0RV9qQFaUF2B1LZisTWbnt4hfFd2OC7gGw%3D&reserved=0>
>
>              git fetch --no-tags linux-review Oak-Zeng/drm-ttm-ioremap-buffer-according-to-TTM-mem-caching-setting/20210302-064500
>
>              git checkout 225bb3711439ec559dd72ae5af8e62d34ea60a64
>
>              # save the attached .config to linux build tree
>
>              COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=parisc
>
>     If you fix the issue, kindly add following tag as appropriate
>
>     Reported-by: kernel test robot<lkp@intel.com>  <mailto:lkp@intel.com>
>
>     All errors (new ones prefixed by >>):
>
>         drivers/gpu/drm/ttm/ttm_bo_util.c: In function 'ttm_resource_ioremap':
>
>             drivers/gpu/drm/ttm/ttm_bo_util.c:95:11: error: implicit declaration of function 'ioremap_cache'; did you mean 'ioremap_uc'? [-Werror=implicit-function-declaration]
>
>            95 |    addr = ioremap_cache(mem->bus.offset, bus_size);
>
>               |           ^~~~~~~~~~~~~
>
>               |           ioremap_uc
>
>         drivers/gpu/drm/ttm/ttm_bo_util.c:95:9: warning: assignment to 'void *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
>
>            95 |    addr = ioremap_cache(mem->bus.offset, bus_size);
>
>               |         ^
>
>         drivers/gpu/drm/ttm/ttm_bo_util.c: In function 'ttm_bo_ioremap':
>
>         drivers/gpu/drm/ttm/ttm_bo_util.c:379:17: warning: assignment to 'void *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
>
>           379 |    map->virtual = ioremap_cache(bo->mem.bus.offset + offset,
>
>               |                 ^
>
>         drivers/gpu/drm/ttm/ttm_bo_util.c: In function 'ttm_bo_vmap':
>
>         drivers/gpu/drm/ttm/ttm_bo_util.c:500:16: warning: assignment to 'void *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
>
>           500 |    vaddr_iomem = ioremap_cache(mem->bus.offset,
>
>               |                ^
>
>         cc1: some warnings being treated as errors
>
>     vim +95 drivers/gpu/drm/ttm/ttm_bo_util.c
>
>          74
>
>          75  static int ttm_resource_ioremap(struct ttm_bo_device *bdev,
>
>          76                                struct ttm_resource *mem,
>
>          77                                void **virtual)
>
>          78  {
>
>          79          int ret;
>
>          80          void *addr;
>
>          81
>
>          82          *virtual = NULL;
>
>          83          ret = ttm_mem_io_reserve(bdev, mem);
>
>          84          if (ret || !mem->bus.is_iomem)
>
>          85                  return ret;
>
>          86
>
>          87          if (mem->bus.addr) {
>
>          88                  addr = mem->bus.addr;
>
>          89          } else {
>
>          90                  size_t bus_size = (size_t)mem->num_pages << PAGE_SHIFT;
>
>          91
>
>          92                  if (mem->bus.caching == ttm_write_combined)
>
>          93                         addr = ioremap_wc(mem->bus.offset, bus_size);
>
>          94                  else if (mem->bus.caching == ttm_cached)
>
>        > 95                         addr = ioremap_cache(mem->bus.offset, bus_size);
>
>          96                  else
>
>          97                         addr = ioremap(mem->bus.offset, bus_size);
>
>          98                  if (!addr) {
>
>          99                         ttm_mem_io_free(bdev, mem);
>
>         100                         return -ENOMEM;
>
>         101                  }
>
>         102          }
>
>         103          *virtual = addr;
>
>         104          return 0;
>
>         105  }
>
>         106
>
>     ---
>
>     0-DAY CI Kernel Test Service, Intel Corporation
>
>     https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org  <https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.01.org%2Fhyperkitty%2Flist%2Fkbuild-all%40lists.01.org&data=04%7C01%7COak.Zeng%40amd.com%7C08f51e87e36c4de858bc08d8dd6eb16b%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637502814793198680%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=8vaxBMiRPv5mgZyKjDnsNtzAz%2BDltnzlkUMDMg45%2BrI%3D&reserved=0>
>
>
>
>     _______________________________________________
>
>     amd-gfx mailing list
>
>     amd-gfx@lists.freedesktop.org  <mailto:amd-gfx@lists.freedesktop.org>
>
>     https://lists.freedesktop.org/mailman/listinfo/amd-gfx  <https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&data=04%7C01%7COak.Zeng%40amd.com%7C08f51e87e36c4de858bc08d8dd6eb16b%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637502814793198680%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=eRpwM7V33brBQtOxnkAfPTlp383tcA1x55zPPw1W0gA%3D&reserved=0>
>


[-- Attachment #1.2: Type: text/html, Size: 19548 bytes --]

[-- Attachment #2: Type: text/plain, Size: 160 bytes --]

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

^ permalink raw reply	[flat|nested] 49+ messages in thread

* Re: [PATCH] drm/ttm: ioremap buffer according to TTM mem caching setting
@ 2021-03-03 10:45         ` Christian König
  0 siblings, 0 replies; 49+ messages in thread
From: Christian König @ 2021-03-03 10:45 UTC (permalink / raw)
  To: Zeng, Oak, amd-gfx, dri-devel, Daniel Vetter, Dave Airlie,
	Thomas Hellström (Intel),
	dan.j.williams
  Cc: kbuild-all, Kuehling, Felix, Kasiviswanathan, Harish, Huang,
	JinHuiEric, Deucher, Alexander, Koenig, Christian


[-- Attachment #1.1: Type: text/plain, Size: 10841 bytes --]

Hi Oak,

> config: parisc-randconfig-r012-20210302 (attached as .config)

It's not the Intel driver build which fails here, but the build bot is 
just hosted by Intel.

The problem is that the parisc architecture doesn't defines the 
ioremap_cache() function.

I've looked at using memremap() instead of ioremap_cache(). The problem 
is that we do support architectures with the TTM as well as amndgpu code 
where the __iomem annotation is mandatory and correct.

Regards,
Christian.

Am 02.03.21 um 23:45 schrieb Zeng, Oak:
>
> [AMD Official Use Only - Internal Distribution Only]
>
>
> Hi Daniel, Thomas, Dan,
>
> Does below message mean the calling ioremap_cache failed intel’s 
> driver build? I can see both ioremap_cache and ioremap_wc are defined 
> in arch/x86/mm/ioremap.c – why ioremap_wc doesn’t break intel driver’s 
> build?
>
> Are we supposed to use memremap (offset, size, MEMREMAP_WB) to replace 
> ioremap_cache? When I read here https://lwn.net/Articles/653585/ I 
> felt that ioremap_cache returns an address annotated with _iomem while 
> memremap returns an address without __iomem annotation. In our use 
> case, GPU memory is treated as UEFI SPM (specific purpose memory). I 
> am not very sure whether memremap (thus no __iomem annotation) is the 
> right thing to do. What I am sure is, we have tested ioremap_cache and 
> it works fine on AMD system.
>
> I will send out a test patch replacing ioremap_cache with ioremap_wc, 
> to trigger Intel build robot to see whether it fails Intel build. I 
> suppose it will not fail Intel build.
>
> Regards,
>
> Oak
>
> *From:* Christian König <ckoenig.leichtzumerken@gmail.com>
> *Sent:* Tuesday, March 2, 2021 6:31 AM
> *To:* amd-gfx@lists.freedesktop.org; dri-devel@lists.freedesktop.org; 
> Daniel Vetter <daniel@ffwll.ch>; Dave Airlie <airlied@redhat.com>; 
> Thomas Hellström (Intel) <thomas_os@shipmail.org>
> *Cc:* Zeng, Oak <Oak.Zeng@amd.com>; kbuild-all@lists.01.org; Kuehling, 
> Felix <Felix.Kuehling@amd.com>; Kasiviswanathan, Harish 
> <Harish.Kasiviswanathan@amd.com>; Deucher, Alexander 
> <Alexander.Deucher@amd.com>; Huang, JinHuiEric 
> <JinHuiEric.Huang@amd.com>; Koenig, Christian <Christian.Koenig@amd.com>
> *Subject:* Re: [PATCH] drm/ttm: ioremap buffer according to TTM mem 
> caching setting
>
> Hi guys,
>
> adding the usual suspects direct. Does anybody of hand know how to 
> check if an architecture supports ioremap_cache()?
>
> For now we only need this on X86, but I would feel better if we don't 
> use an #ifdef here.
>
> Regards,
> Christian.
>
> Am 02.03.21 um 05:12 schrieb kernel test robot:
>
>     Hi Oak,
>
>     Thank you for the patch! Yet something to improve:
>
>     [auto build test ERROR on drm-intel/for-linux-next]
>
>     [also build test ERROR on drm-tip/drm-tip linus/master v5.12-rc1 next-20210302]
>
>     [cannot apply to tegra-drm/drm/tegra/for-next drm-exynos/exynos-drm-next drm/drm-next]
>
>     [If your patch is applied to the wrong git tree, kindly drop us a note.
>
>     And when submitting patch, we suggest to use '--base' as documented in
>
>     https://git-scm.com/docs/git-format-patch  <https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgit-scm.com%2Fdocs%2Fgit-format-patch&data=04%7C01%7COak.Zeng%40amd.com%7C08f51e87e36c4de858bc08d8dd6eb16b%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637502814793168696%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=p4iynMPvZGknfSGSyZnXV3kLwScMLbPDB8zVsmxhtk0%3D&reserved=0>]
>
>     url:https://github.com/0day-ci/linux/commits/Oak-Zeng/drm-ttm-ioremap-buffer-according-to-TTM-mem-caching-setting/20210302-064500  <https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2F0day-ci%2Flinux%2Fcommits%2FOak-Zeng%2Fdrm-ttm-ioremap-buffer-according-to-TTM-mem-caching-setting%2F20210302-064500&data=04%7C01%7COak.Zeng%40amd.com%7C08f51e87e36c4de858bc08d8dd6eb16b%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637502814793178689%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=2sc4jZR3bVRF0xDDqNOtUcNR9qiJMF2ATmCDAX%2BSWrQ%3D&reserved=0>
>
>     base:   git://anongit.freedesktop.org/drm-intel for-linux-next
>
>     config: parisc-randconfig-r012-20210302 (attached as .config)
>
>     compiler: hppa-linux-gcc (GCC) 9.3.0
>
>     reproduce (this is a W=1 build):
>
>              wgethttps://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross  <https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fraw.githubusercontent.com%2Fintel%2Flkp-tests%2Fmaster%2Fsbin%2Fmake.cross&data=04%7C01%7COak.Zeng%40amd.com%7C08f51e87e36c4de858bc08d8dd6eb16b%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637502814793178689%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=uILcLE%2F24bhSU%2Bo5GmWGAK6s6xDFivP6lrm6JgtM50Y%3D&reserved=0>  -O ~/bin/make.cross
>
>              chmod +x ~/bin/make.cross
>
>              #https://github.com/0day-ci/linux/commit/225bb3711439ec559dd72ae5af8e62d34ea60a64  <https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2F0day-ci%2Flinux%2Fcommit%2F225bb3711439ec559dd72ae5af8e62d34ea60a64&data=04%7C01%7COak.Zeng%40amd.com%7C08f51e87e36c4de858bc08d8dd6eb16b%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637502814793188685%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=2TOSPuKEMRcZjMfxO9lxgwFxgXwHqERCOgRednI7OE8%3D&reserved=0>
>
>              git remote add linux-reviewhttps://github.com/0day-ci/linux  <https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2F0day-ci%2Flinux&data=04%7C01%7COak.Zeng%40amd.com%7C08f51e87e36c4de858bc08d8dd6eb16b%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637502814793188685%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=TlXvs5mxH0RV9qQFaUF2B1LZisTWbnt4hfFd2OC7gGw%3D&reserved=0>
>
>              git fetch --no-tags linux-review Oak-Zeng/drm-ttm-ioremap-buffer-according-to-TTM-mem-caching-setting/20210302-064500
>
>              git checkout 225bb3711439ec559dd72ae5af8e62d34ea60a64
>
>              # save the attached .config to linux build tree
>
>              COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=parisc
>
>     If you fix the issue, kindly add following tag as appropriate
>
>     Reported-by: kernel test robot<lkp@intel.com>  <mailto:lkp@intel.com>
>
>     All errors (new ones prefixed by >>):
>
>         drivers/gpu/drm/ttm/ttm_bo_util.c: In function 'ttm_resource_ioremap':
>
>             drivers/gpu/drm/ttm/ttm_bo_util.c:95:11: error: implicit declaration of function 'ioremap_cache'; did you mean 'ioremap_uc'? [-Werror=implicit-function-declaration]
>
>            95 |    addr = ioremap_cache(mem->bus.offset, bus_size);
>
>               |           ^~~~~~~~~~~~~
>
>               |           ioremap_uc
>
>         drivers/gpu/drm/ttm/ttm_bo_util.c:95:9: warning: assignment to 'void *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
>
>            95 |    addr = ioremap_cache(mem->bus.offset, bus_size);
>
>               |         ^
>
>         drivers/gpu/drm/ttm/ttm_bo_util.c: In function 'ttm_bo_ioremap':
>
>         drivers/gpu/drm/ttm/ttm_bo_util.c:379:17: warning: assignment to 'void *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
>
>           379 |    map->virtual = ioremap_cache(bo->mem.bus.offset + offset,
>
>               |                 ^
>
>         drivers/gpu/drm/ttm/ttm_bo_util.c: In function 'ttm_bo_vmap':
>
>         drivers/gpu/drm/ttm/ttm_bo_util.c:500:16: warning: assignment to 'void *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
>
>           500 |    vaddr_iomem = ioremap_cache(mem->bus.offset,
>
>               |                ^
>
>         cc1: some warnings being treated as errors
>
>     vim +95 drivers/gpu/drm/ttm/ttm_bo_util.c
>
>          74
>
>          75  static int ttm_resource_ioremap(struct ttm_bo_device *bdev,
>
>          76                                struct ttm_resource *mem,
>
>          77                                void **virtual)
>
>          78  {
>
>          79          int ret;
>
>          80          void *addr;
>
>          81
>
>          82          *virtual = NULL;
>
>          83          ret = ttm_mem_io_reserve(bdev, mem);
>
>          84          if (ret || !mem->bus.is_iomem)
>
>          85                  return ret;
>
>          86
>
>          87          if (mem->bus.addr) {
>
>          88                  addr = mem->bus.addr;
>
>          89          } else {
>
>          90                  size_t bus_size = (size_t)mem->num_pages << PAGE_SHIFT;
>
>          91
>
>          92                  if (mem->bus.caching == ttm_write_combined)
>
>          93                         addr = ioremap_wc(mem->bus.offset, bus_size);
>
>          94                  else if (mem->bus.caching == ttm_cached)
>
>        > 95                         addr = ioremap_cache(mem->bus.offset, bus_size);
>
>          96                  else
>
>          97                         addr = ioremap(mem->bus.offset, bus_size);
>
>          98                  if (!addr) {
>
>          99                         ttm_mem_io_free(bdev, mem);
>
>         100                         return -ENOMEM;
>
>         101                  }
>
>         102          }
>
>         103          *virtual = addr;
>
>         104          return 0;
>
>         105  }
>
>         106
>
>     ---
>
>     0-DAY CI Kernel Test Service, Intel Corporation
>
>     https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org  <https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.01.org%2Fhyperkitty%2Flist%2Fkbuild-all%40lists.01.org&data=04%7C01%7COak.Zeng%40amd.com%7C08f51e87e36c4de858bc08d8dd6eb16b%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637502814793198680%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=8vaxBMiRPv5mgZyKjDnsNtzAz%2BDltnzlkUMDMg45%2BrI%3D&reserved=0>
>
>
>
>     _______________________________________________
>
>     amd-gfx mailing list
>
>     amd-gfx@lists.freedesktop.org  <mailto:amd-gfx@lists.freedesktop.org>
>
>     https://lists.freedesktop.org/mailman/listinfo/amd-gfx  <https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&data=04%7C01%7COak.Zeng%40amd.com%7C08f51e87e36c4de858bc08d8dd6eb16b%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637502814793198680%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=eRpwM7V33brBQtOxnkAfPTlp383tcA1x55zPPw1W0gA%3D&reserved=0>
>


[-- Attachment #1.2: Type: text/html, Size: 19548 bytes --]

[-- Attachment #2: Type: text/plain, Size: 154 bytes --]

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply	[flat|nested] 49+ messages in thread

* Re: [PATCH] drm/ttm: ioremap buffer according to TTM mem caching setting
  2021-03-03  8:49   ` Thomas Zimmermann
@ 2021-03-03 10:37     ` Christian König
  -1 siblings, 0 replies; 49+ messages in thread
From: Christian König @ 2021-03-03 10:37 UTC (permalink / raw)
  To: Thomas Zimmermann, Oak Zeng, amd-gfx, dri-devel
  Cc: jinhuieric.huang, Alexander.Deucher, Felix.Kuehling,
	harish.kasiviswanathan, christian.koenig


[-- Attachment #1.1: Type: text/plain, Size: 3263 bytes --]

Hi Thomas,

Am 03.03.21 um 09:49 schrieb Thomas Zimmermann:
> Hi
>
> Am 01.03.21 um 23:43 schrieb Oak Zeng:
>> If tbo.mem.bus.caching is cached, buffer is intended to be mapped
>> as cached from CPU. Map it with ioremap_cache.
>
> Just a question for my understanding: This is on-device memory? 
> Accessing device memory is usually slow. If that memory can be mapped 
> with CPU caching enabled, access will roughly be as fast as for system 
> memory?

There is still a penalty associated with accessing it from the CPU, but 
it is much faster (both lower latency as well as throughput) as 
traditional device memory accessed over PCIe.

Regards,
Christian.

>
> Best regards
> Thomas
>
>>
>> This wasn't necessary before as device memory was never mapped
>> as cached from CPU side. It becomes necessary for aldebaran as
>> device memory is mapped cached from CPU.
>>
>> Signed-off-by: Oak Zeng <Oak.Zeng@amd.com>
>> Reviewed-by: Christian Konig <Christian.Koenig@amd.com>
>> ---
>>   drivers/gpu/drm/ttm/ttm_bo_util.c | 8 ++++++++
>>   1 file changed, 8 insertions(+)
>>
>> diff --git a/drivers/gpu/drm/ttm/ttm_bo_util.c 
>> b/drivers/gpu/drm/ttm/ttm_bo_util.c
>> index 031e581..8c65a13 100644
>> --- a/drivers/gpu/drm/ttm/ttm_bo_util.c
>> +++ b/drivers/gpu/drm/ttm/ttm_bo_util.c
>> @@ -91,6 +91,8 @@ static int ttm_resource_ioremap(struct ttm_device 
>> *bdev,
>>             if (mem->bus.caching == ttm_write_combined)
>>               addr = ioremap_wc(mem->bus.offset, bus_size);
>> +        else if (mem->bus.caching == ttm_cached)
>> +            addr = ioremap_cache(mem->bus.offset, bus_size);
>>           else
>>               addr = ioremap(mem->bus.offset, bus_size);
>>           if (!addr) {
>> @@ -372,6 +374,9 @@ static int ttm_bo_ioremap(struct 
>> ttm_buffer_object *bo,
>>           if (mem->bus.caching == ttm_write_combined)
>>               map->virtual = ioremap_wc(bo->mem.bus.offset + offset,
>>                             size);
>> +        else if (mem->bus.caching == ttm_cached)
>> +            map->virtual = ioremap_cache(bo->mem.bus.offset + offset,
>> +                          size);
>>           else
>>               map->virtual = ioremap(bo->mem.bus.offset + offset,
>>                              size);
>> @@ -490,6 +495,9 @@ int ttm_bo_vmap(struct ttm_buffer_object *bo, 
>> struct dma_buf_map *map)
>>           else if (mem->bus.caching == ttm_write_combined)
>>               vaddr_iomem = ioremap_wc(mem->bus.offset,
>>                            bo->base.size);
>> +        else if (mem->bus.caching == ttm_cached)
>> +            vaddr_iomem = ioremap_cache(mem->bus.offset,
>> +                          bo->base.size);
>>           else
>>               vaddr_iomem = ioremap(mem->bus.offset, bo->base.size);
>>
>
>
> _______________________________________________
> amd-gfx mailing list
> amd-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx


[-- Attachment #1.2: Type: text/html, Size: 5298 bytes --]

[-- Attachment #2: Type: text/plain, Size: 160 bytes --]

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

^ permalink raw reply	[flat|nested] 49+ messages in thread

* Re: [PATCH] drm/ttm: ioremap buffer according to TTM mem caching setting
@ 2021-03-03 10:37     ` Christian König
  0 siblings, 0 replies; 49+ messages in thread
From: Christian König @ 2021-03-03 10:37 UTC (permalink / raw)
  To: Thomas Zimmermann, Oak Zeng, amd-gfx, dri-devel
  Cc: jinhuieric.huang, Alexander.Deucher, Felix.Kuehling,
	harish.kasiviswanathan, christian.koenig


[-- Attachment #1.1: Type: text/plain, Size: 3263 bytes --]

Hi Thomas,

Am 03.03.21 um 09:49 schrieb Thomas Zimmermann:
> Hi
>
> Am 01.03.21 um 23:43 schrieb Oak Zeng:
>> If tbo.mem.bus.caching is cached, buffer is intended to be mapped
>> as cached from CPU. Map it with ioremap_cache.
>
> Just a question for my understanding: This is on-device memory? 
> Accessing device memory is usually slow. If that memory can be mapped 
> with CPU caching enabled, access will roughly be as fast as for system 
> memory?

There is still a penalty associated with accessing it from the CPU, but 
it is much faster (both lower latency as well as throughput) as 
traditional device memory accessed over PCIe.

Regards,
Christian.

>
> Best regards
> Thomas
>
>>
>> This wasn't necessary before as device memory was never mapped
>> as cached from CPU side. It becomes necessary for aldebaran as
>> device memory is mapped cached from CPU.
>>
>> Signed-off-by: Oak Zeng <Oak.Zeng@amd.com>
>> Reviewed-by: Christian Konig <Christian.Koenig@amd.com>
>> ---
>>   drivers/gpu/drm/ttm/ttm_bo_util.c | 8 ++++++++
>>   1 file changed, 8 insertions(+)
>>
>> diff --git a/drivers/gpu/drm/ttm/ttm_bo_util.c 
>> b/drivers/gpu/drm/ttm/ttm_bo_util.c
>> index 031e581..8c65a13 100644
>> --- a/drivers/gpu/drm/ttm/ttm_bo_util.c
>> +++ b/drivers/gpu/drm/ttm/ttm_bo_util.c
>> @@ -91,6 +91,8 @@ static int ttm_resource_ioremap(struct ttm_device 
>> *bdev,
>>             if (mem->bus.caching == ttm_write_combined)
>>               addr = ioremap_wc(mem->bus.offset, bus_size);
>> +        else if (mem->bus.caching == ttm_cached)
>> +            addr = ioremap_cache(mem->bus.offset, bus_size);
>>           else
>>               addr = ioremap(mem->bus.offset, bus_size);
>>           if (!addr) {
>> @@ -372,6 +374,9 @@ static int ttm_bo_ioremap(struct 
>> ttm_buffer_object *bo,
>>           if (mem->bus.caching == ttm_write_combined)
>>               map->virtual = ioremap_wc(bo->mem.bus.offset + offset,
>>                             size);
>> +        else if (mem->bus.caching == ttm_cached)
>> +            map->virtual = ioremap_cache(bo->mem.bus.offset + offset,
>> +                          size);
>>           else
>>               map->virtual = ioremap(bo->mem.bus.offset + offset,
>>                              size);
>> @@ -490,6 +495,9 @@ int ttm_bo_vmap(struct ttm_buffer_object *bo, 
>> struct dma_buf_map *map)
>>           else if (mem->bus.caching == ttm_write_combined)
>>               vaddr_iomem = ioremap_wc(mem->bus.offset,
>>                            bo->base.size);
>> +        else if (mem->bus.caching == ttm_cached)
>> +            vaddr_iomem = ioremap_cache(mem->bus.offset,
>> +                          bo->base.size);
>>           else
>>               vaddr_iomem = ioremap(mem->bus.offset, bo->base.size);
>>
>
>
> _______________________________________________
> amd-gfx mailing list
> amd-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx


[-- Attachment #1.2: Type: text/html, Size: 5298 bytes --]

[-- Attachment #2: Type: text/plain, Size: 154 bytes --]

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply	[flat|nested] 49+ messages in thread

* Re: [PATCH] drm/ttm: ioremap buffer according to TTM mem caching setting
  2021-03-01 22:43 ` Oak Zeng
@ 2021-03-03  8:49   ` Thomas Zimmermann
  -1 siblings, 0 replies; 49+ messages in thread
From: Thomas Zimmermann @ 2021-03-03  8:49 UTC (permalink / raw)
  To: Oak Zeng, amd-gfx, dri-devel
  Cc: jinhuieric.huang, Alexander.Deucher, Felix.Kuehling,
	harish.kasiviswanathan, christian.koenig


[-- Attachment #1.1.1: Type: text/plain, Size: 2462 bytes --]

Hi

Am 01.03.21 um 23:43 schrieb Oak Zeng:
> If tbo.mem.bus.caching is cached, buffer is intended to be mapped
> as cached from CPU. Map it with ioremap_cache.

Just a question for my understanding: This is on-device memory? 
Accessing device memory is usually slow. If that memory can be mapped 
with CPU caching enabled, access will roughly be as fast as for system 
memory?

Best regards
Thomas

> 
> This wasn't necessary before as device memory was never mapped
> as cached from CPU side. It becomes necessary for aldebaran as
> device memory is mapped cached from CPU.
> 
> Signed-off-by: Oak Zeng <Oak.Zeng@amd.com>
> Reviewed-by: Christian Konig <Christian.Koenig@amd.com>
> ---
>   drivers/gpu/drm/ttm/ttm_bo_util.c | 8 ++++++++
>   1 file changed, 8 insertions(+)
> 
> diff --git a/drivers/gpu/drm/ttm/ttm_bo_util.c b/drivers/gpu/drm/ttm/ttm_bo_util.c
> index 031e581..8c65a13 100644
> --- a/drivers/gpu/drm/ttm/ttm_bo_util.c
> +++ b/drivers/gpu/drm/ttm/ttm_bo_util.c
> @@ -91,6 +91,8 @@ static int ttm_resource_ioremap(struct ttm_device *bdev,
>   
>   		if (mem->bus.caching == ttm_write_combined)
>   			addr = ioremap_wc(mem->bus.offset, bus_size);
> +		else if (mem->bus.caching == ttm_cached)
> +			addr = ioremap_cache(mem->bus.offset, bus_size);
>   		else
>   			addr = ioremap(mem->bus.offset, bus_size);
>   		if (!addr) {
> @@ -372,6 +374,9 @@ static int ttm_bo_ioremap(struct ttm_buffer_object *bo,
>   		if (mem->bus.caching == ttm_write_combined)
>   			map->virtual = ioremap_wc(bo->mem.bus.offset + offset,
>   						  size);
> +		else if (mem->bus.caching == ttm_cached)
> +			map->virtual = ioremap_cache(bo->mem.bus.offset + offset,
> +						  size);
>   		else
>   			map->virtual = ioremap(bo->mem.bus.offset + offset,
>   					       size);
> @@ -490,6 +495,9 @@ int ttm_bo_vmap(struct ttm_buffer_object *bo, struct dma_buf_map *map)
>   		else if (mem->bus.caching == ttm_write_combined)
>   			vaddr_iomem = ioremap_wc(mem->bus.offset,
>   						 bo->base.size);
> +		else if (mem->bus.caching == ttm_cached)
> +			vaddr_iomem = ioremap_cache(mem->bus.offset,
> +						  bo->base.size);
>   		else
>   			vaddr_iomem = ioremap(mem->bus.offset, bo->base.size);
>   
> 

-- 
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Maxfeldstr. 5, 90409 Nürnberg, Germany
(HRB 36809, AG Nürnberg)
Geschäftsführer: Felix Imendörffer


[-- Attachment #1.2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 840 bytes --]

[-- Attachment #2: Type: text/plain, Size: 160 bytes --]

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

^ permalink raw reply	[flat|nested] 49+ messages in thread

* Re: [PATCH] drm/ttm: ioremap buffer according to TTM mem caching setting
@ 2021-03-03  8:49   ` Thomas Zimmermann
  0 siblings, 0 replies; 49+ messages in thread
From: Thomas Zimmermann @ 2021-03-03  8:49 UTC (permalink / raw)
  To: Oak Zeng, amd-gfx, dri-devel
  Cc: jinhuieric.huang, Alexander.Deucher, Felix.Kuehling,
	harish.kasiviswanathan, christian.koenig


[-- Attachment #1.1.1: Type: text/plain, Size: 2462 bytes --]

Hi

Am 01.03.21 um 23:43 schrieb Oak Zeng:
> If tbo.mem.bus.caching is cached, buffer is intended to be mapped
> as cached from CPU. Map it with ioremap_cache.

Just a question for my understanding: This is on-device memory? 
Accessing device memory is usually slow. If that memory can be mapped 
with CPU caching enabled, access will roughly be as fast as for system 
memory?

Best regards
Thomas

> 
> This wasn't necessary before as device memory was never mapped
> as cached from CPU side. It becomes necessary for aldebaran as
> device memory is mapped cached from CPU.
> 
> Signed-off-by: Oak Zeng <Oak.Zeng@amd.com>
> Reviewed-by: Christian Konig <Christian.Koenig@amd.com>
> ---
>   drivers/gpu/drm/ttm/ttm_bo_util.c | 8 ++++++++
>   1 file changed, 8 insertions(+)
> 
> diff --git a/drivers/gpu/drm/ttm/ttm_bo_util.c b/drivers/gpu/drm/ttm/ttm_bo_util.c
> index 031e581..8c65a13 100644
> --- a/drivers/gpu/drm/ttm/ttm_bo_util.c
> +++ b/drivers/gpu/drm/ttm/ttm_bo_util.c
> @@ -91,6 +91,8 @@ static int ttm_resource_ioremap(struct ttm_device *bdev,
>   
>   		if (mem->bus.caching == ttm_write_combined)
>   			addr = ioremap_wc(mem->bus.offset, bus_size);
> +		else if (mem->bus.caching == ttm_cached)
> +			addr = ioremap_cache(mem->bus.offset, bus_size);
>   		else
>   			addr = ioremap(mem->bus.offset, bus_size);
>   		if (!addr) {
> @@ -372,6 +374,9 @@ static int ttm_bo_ioremap(struct ttm_buffer_object *bo,
>   		if (mem->bus.caching == ttm_write_combined)
>   			map->virtual = ioremap_wc(bo->mem.bus.offset + offset,
>   						  size);
> +		else if (mem->bus.caching == ttm_cached)
> +			map->virtual = ioremap_cache(bo->mem.bus.offset + offset,
> +						  size);
>   		else
>   			map->virtual = ioremap(bo->mem.bus.offset + offset,
>   					       size);
> @@ -490,6 +495,9 @@ int ttm_bo_vmap(struct ttm_buffer_object *bo, struct dma_buf_map *map)
>   		else if (mem->bus.caching == ttm_write_combined)
>   			vaddr_iomem = ioremap_wc(mem->bus.offset,
>   						 bo->base.size);
> +		else if (mem->bus.caching == ttm_cached)
> +			vaddr_iomem = ioremap_cache(mem->bus.offset,
> +						  bo->base.size);
>   		else
>   			vaddr_iomem = ioremap(mem->bus.offset, bo->base.size);
>   
> 

-- 
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Maxfeldstr. 5, 90409 Nürnberg, Germany
(HRB 36809, AG Nürnberg)
Geschäftsführer: Felix Imendörffer


[-- Attachment #1.2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 840 bytes --]

[-- Attachment #2: Type: text/plain, Size: 154 bytes --]

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply	[flat|nested] 49+ messages in thread

* Re: [PATCH] drm/ttm: ioremap buffer according to TTM mem caching setting
  2021-03-02 22:45       ` Zeng, Oak
  (?)
@ 2021-03-02 22:53         ` Dave Airlie
  -1 siblings, 0 replies; 49+ messages in thread
From: Dave Airlie @ 2021-03-02 22:53 UTC (permalink / raw)
  To: Zeng, Oak
  Cc: kbuild-all, Christian König, Thomas Hellström (Intel),
	Kasiviswanathan, Harish, dri-devel, Koenig, Christian, Deucher,
	Alexander, amd-gfx, Huang, JinHuiEric, Dave Airlie,
	dan.j.williams, Kuehling, Felix

On Wed, 3 Mar 2021 at 08:45, Zeng, Oak <Oak.Zeng@amd.com> wrote:
>
> [AMD Official Use Only - Internal Distribution Only]
>
>
> Hi Daniel, Thomas, Dan,
>
>
>
> Does below message mean the calling ioremap_cache failed intel’s driver build? I can see both ioremap_cache and ioremap_wc are defined in arch/x86/mm/ioremap.c – why ioremap_wc doesn’t break intel driver’s build?

Just to clear up confusion here, the linux kernel robot is hosted by
Intel it does not test intel driver builds exclusively, it tests a lot
of different builds across lots of different architectures,.

If the robot complains it's because your patch breaks in the
configuration it describes, take the time to read that configuration
info and realise it's nothing to do with Intel at all.

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

^ permalink raw reply	[flat|nested] 49+ messages in thread

* Re: [PATCH] drm/ttm: ioremap buffer according to TTM mem caching setting
@ 2021-03-02 22:53         ` Dave Airlie
  0 siblings, 0 replies; 49+ messages in thread
From: Dave Airlie @ 2021-03-02 22:53 UTC (permalink / raw)
  To: Zeng, Oak
  Cc: kbuild-all, Christian König, Thomas Hellström (Intel),
	Kasiviswanathan, Harish, dri-devel, Koenig, Christian, Deucher,
	Alexander, amd-gfx, Daniel Vetter, Huang, JinHuiEric,
	Dave Airlie, dan.j.williams, Kuehling, Felix

On Wed, 3 Mar 2021 at 08:45, Zeng, Oak <Oak.Zeng@amd.com> wrote:
>
> [AMD Official Use Only - Internal Distribution Only]
>
>
> Hi Daniel, Thomas, Dan,
>
>
>
> Does below message mean the calling ioremap_cache failed intel’s driver build? I can see both ioremap_cache and ioremap_wc are defined in arch/x86/mm/ioremap.c – why ioremap_wc doesn’t break intel driver’s build?

Just to clear up confusion here, the linux kernel robot is hosted by
Intel it does not test intel driver builds exclusively, it tests a lot
of different builds across lots of different architectures,.

If the robot complains it's because your patch breaks in the
configuration it describes, take the time to read that configuration
info and realise it's nothing to do with Intel at all.

Dave.
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply	[flat|nested] 49+ messages in thread

* Re: [PATCH] drm/ttm: ioremap buffer according to TTM mem caching setting
@ 2021-03-02 22:53         ` Dave Airlie
  0 siblings, 0 replies; 49+ messages in thread
From: Dave Airlie @ 2021-03-02 22:53 UTC (permalink / raw)
  To: kbuild-all

[-- Attachment #1: Type: text/plain, Size: 794 bytes --]

On Wed, 3 Mar 2021 at 08:45, Zeng, Oak <Oak.Zeng@amd.com> wrote:
>
> [AMD Official Use Only - Internal Distribution Only]
>
>
> Hi Daniel, Thomas, Dan,
>
>
>
> Does below message mean the calling ioremap_cache failed intel’s driver build? I can see both ioremap_cache and ioremap_wc are defined in arch/x86/mm/ioremap.c – why ioremap_wc doesn’t break intel driver’s build?

Just to clear up confusion here, the linux kernel robot is hosted by
Intel it does not test intel driver builds exclusively, it tests a lot
of different builds across lots of different architectures,.

If the robot complains it's because your patch breaks in the
configuration it describes, take the time to read that configuration
info and realise it's nothing to do with Intel at all.

Dave.

^ permalink raw reply	[flat|nested] 49+ messages in thread

* RE: [PATCH] drm/ttm: ioremap buffer according to TTM mem caching setting
  2021-03-02 11:31     ` Christian König
@ 2021-03-02 22:45       ` Zeng, Oak
  -1 siblings, 0 replies; 49+ messages in thread
From: Zeng, Oak @ 2021-03-02 22:45 UTC (permalink / raw)
  To: Christian König, amd-gfx, dri-devel, Daniel Vetter,
	Dave Airlie, Thomas Hellström (Intel),
	dan.j.williams
  Cc: kbuild-all, Kuehling, Felix, Kasiviswanathan, Harish, Huang,
	JinHuiEric, Deucher, Alexander, Koenig, Christian


[-- Attachment #1.1: Type: text/plain, Size: 9770 bytes --]

[AMD Official Use Only - Internal Distribution Only]

Hi Daniel, Thomas, Dan,

Does below message mean the calling ioremap_cache failed intel's driver build? I can see both ioremap_cache and ioremap_wc are defined in arch/x86/mm/ioremap.c - why ioremap_wc doesn't break intel driver's build?

Are we supposed to use memremap (offset, size, MEMREMAP_WB) to replace ioremap_cache? When I read here https://lwn.net/Articles/653585/ I felt that ioremap_cache returns an address annotated with _iomem while memremap returns an address without __iomem annotation. In our use case, GPU memory is treated as UEFI SPM (specific purpose memory). I am not very sure whether memremap (thus no __iomem annotation) is the right thing to do. What I am sure is, we have tested ioremap_cache and it works fine on AMD system.

I will send out a test patch replacing ioremap_cache with ioremap_wc, to trigger Intel build robot to see whether it fails Intel build. I suppose it will not fail Intel build.

Regards,
Oak

From: Christian König <ckoenig.leichtzumerken@gmail.com>
Sent: Tuesday, March 2, 2021 6:31 AM
To: amd-gfx@lists.freedesktop.org; dri-devel@lists.freedesktop.org; Daniel Vetter <daniel@ffwll.ch>; Dave Airlie <airlied@redhat.com>; Thomas Hellström (Intel) <thomas_os@shipmail.org>
Cc: Zeng, Oak <Oak.Zeng@amd.com>; kbuild-all@lists.01.org; Kuehling, Felix <Felix.Kuehling@amd.com>; Kasiviswanathan, Harish <Harish.Kasiviswanathan@amd.com>; Deucher, Alexander <Alexander.Deucher@amd.com>; Huang, JinHuiEric <JinHuiEric.Huang@amd.com>; Koenig, Christian <Christian.Koenig@amd.com>
Subject: Re: [PATCH] drm/ttm: ioremap buffer according to TTM mem caching setting

Hi guys,

adding the usual suspects direct. Does anybody of hand know how to check if an architecture supports ioremap_cache()?

For now we only need this on X86, but I would feel better if we don't use an #ifdef here.

Regards,
Christian.
Am 02.03.21 um 05:12 schrieb kernel test robot:

Hi Oak,



Thank you for the patch! Yet something to improve:



[auto build test ERROR on drm-intel/for-linux-next]

[also build test ERROR on drm-tip/drm-tip linus/master v5.12-rc1 next-20210302]

[cannot apply to tegra-drm/drm/tegra/for-next drm-exynos/exynos-drm-next drm/drm-next]

[If your patch is applied to the wrong git tree, kindly drop us a note.

And when submitting patch, we suggest to use '--base' as documented in

https://git-scm.com/docs/git-format-patch<https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgit-scm.com%2Fdocs%2Fgit-format-patch&data=04%7C01%7COak.Zeng%40amd.com%7C08f51e87e36c4de858bc08d8dd6eb16b%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637502814793168696%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=p4iynMPvZGknfSGSyZnXV3kLwScMLbPDB8zVsmxhtk0%3D&reserved=0>]



url:    https://github.com/0day-ci/linux/commits/Oak-Zeng/drm-ttm-ioremap-buffer-according-to-TTM-mem-caching-setting/20210302-064500<https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2F0day-ci%2Flinux%2Fcommits%2FOak-Zeng%2Fdrm-ttm-ioremap-buffer-according-to-TTM-mem-caching-setting%2F20210302-064500&data=04%7C01%7COak.Zeng%40amd.com%7C08f51e87e36c4de858bc08d8dd6eb16b%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637502814793178689%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=2sc4jZR3bVRF0xDDqNOtUcNR9qiJMF2ATmCDAX%2BSWrQ%3D&reserved=0>

base:   git://anongit.freedesktop.org/drm-intel for-linux-next

config: parisc-randconfig-r012-20210302 (attached as .config)

compiler: hppa-linux-gcc (GCC) 9.3.0

reproduce (this is a W=1 build):

        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross<https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fraw.githubusercontent.com%2Fintel%2Flkp-tests%2Fmaster%2Fsbin%2Fmake.cross&data=04%7C01%7COak.Zeng%40amd.com%7C08f51e87e36c4de858bc08d8dd6eb16b%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637502814793178689%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=uILcLE%2F24bhSU%2Bo5GmWGAK6s6xDFivP6lrm6JgtM50Y%3D&reserved=0> -O ~/bin/make.cross

        chmod +x ~/bin/make.cross

        # https://github.com/0day-ci/linux/commit/225bb3711439ec559dd72ae5af8e62d34ea60a64<https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2F0day-ci%2Flinux%2Fcommit%2F225bb3711439ec559dd72ae5af8e62d34ea60a64&data=04%7C01%7COak.Zeng%40amd.com%7C08f51e87e36c4de858bc08d8dd6eb16b%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637502814793188685%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=2TOSPuKEMRcZjMfxO9lxgwFxgXwHqERCOgRednI7OE8%3D&reserved=0>

        git remote add linux-review https://github.com/0day-ci/linux<https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2F0day-ci%2Flinux&data=04%7C01%7COak.Zeng%40amd.com%7C08f51e87e36c4de858bc08d8dd6eb16b%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637502814793188685%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=TlXvs5mxH0RV9qQFaUF2B1LZisTWbnt4hfFd2OC7gGw%3D&reserved=0>

        git fetch --no-tags linux-review Oak-Zeng/drm-ttm-ioremap-buffer-according-to-TTM-mem-caching-setting/20210302-064500

        git checkout 225bb3711439ec559dd72ae5af8e62d34ea60a64

        # save the attached .config to linux build tree

        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=parisc



If you fix the issue, kindly add following tag as appropriate

Reported-by: kernel test robot <lkp@intel.com><mailto:lkp@intel.com>



All errors (new ones prefixed by >>):



   drivers/gpu/drm/ttm/ttm_bo_util.c: In function 'ttm_resource_ioremap':

drivers/gpu/drm/ttm/ttm_bo_util.c:95:11: error: implicit declaration of function 'ioremap_cache'; did you mean 'ioremap_uc'? [-Werror=implicit-function-declaration]

      95 |    addr = ioremap_cache(mem->bus.offset, bus_size);

         |           ^~~~~~~~~~~~~

         |           ioremap_uc

   drivers/gpu/drm/ttm/ttm_bo_util.c:95:9: warning: assignment to 'void *' from 'int' makes pointer from integer without a cast [-Wint-conversion]

      95 |    addr = ioremap_cache(mem->bus.offset, bus_size);

         |         ^

   drivers/gpu/drm/ttm/ttm_bo_util.c: In function 'ttm_bo_ioremap':

   drivers/gpu/drm/ttm/ttm_bo_util.c:379:17: warning: assignment to 'void *' from 'int' makes pointer from integer without a cast [-Wint-conversion]

     379 |    map->virtual = ioremap_cache(bo->mem.bus.offset + offset,

         |                 ^

   drivers/gpu/drm/ttm/ttm_bo_util.c: In function 'ttm_bo_vmap':

   drivers/gpu/drm/ttm/ttm_bo_util.c:500:16: warning: assignment to 'void *' from 'int' makes pointer from integer without a cast [-Wint-conversion]

     500 |    vaddr_iomem = ioremap_cache(mem->bus.offset,

         |                ^

   cc1: some warnings being treated as errors





vim +95 drivers/gpu/drm/ttm/ttm_bo_util.c



    74

    75  static int ttm_resource_ioremap(struct ttm_bo_device *bdev,

    76                                struct ttm_resource *mem,

    77                                void **virtual)

    78  {

    79          int ret;

    80          void *addr;

    81

    82          *virtual = NULL;

    83          ret = ttm_mem_io_reserve(bdev, mem);

    84          if (ret || !mem->bus.is_iomem)

    85                  return ret;

    86

    87          if (mem->bus.addr) {

    88                  addr = mem->bus.addr;

    89          } else {

    90                  size_t bus_size = (size_t)mem->num_pages << PAGE_SHIFT;

    91

    92                  if (mem->bus.caching == ttm_write_combined)

    93                         addr = ioremap_wc(mem->bus.offset, bus_size);

    94                  else if (mem->bus.caching == ttm_cached)

  > 95                         addr = ioremap_cache(mem->bus.offset, bus_size);

    96                  else

    97                         addr = ioremap(mem->bus.offset, bus_size);

    98                  if (!addr) {

    99                         ttm_mem_io_free(bdev, mem);

   100                         return -ENOMEM;

   101                  }

   102          }

   103          *virtual = addr;

   104          return 0;

   105  }

   106



---

0-DAY CI Kernel Test Service, Intel Corporation

https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org<https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.01.org%2Fhyperkitty%2Flist%2Fkbuild-all%40lists.01.org&data=04%7C01%7COak.Zeng%40amd.com%7C08f51e87e36c4de858bc08d8dd6eb16b%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637502814793198680%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=8vaxBMiRPv5mgZyKjDnsNtzAz%2BDltnzlkUMDMg45%2BrI%3D&reserved=0>



_______________________________________________

amd-gfx mailing list

amd-gfx@lists.freedesktop.org<mailto:amd-gfx@lists.freedesktop.org>

https://lists.freedesktop.org/mailman/listinfo/amd-gfx<https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&data=04%7C01%7COak.Zeng%40amd.com%7C08f51e87e36c4de858bc08d8dd6eb16b%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637502814793198680%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=eRpwM7V33brBQtOxnkAfPTlp383tcA1x55zPPw1W0gA%3D&reserved=0>


[-- Attachment #1.2: Type: text/html, Size: 18979 bytes --]

[-- Attachment #2: Type: text/plain, Size: 160 bytes --]

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

^ permalink raw reply	[flat|nested] 49+ messages in thread

* RE: [PATCH] drm/ttm: ioremap buffer according to TTM mem caching setting
@ 2021-03-02 22:45       ` Zeng, Oak
  0 siblings, 0 replies; 49+ messages in thread
From: Zeng, Oak @ 2021-03-02 22:45 UTC (permalink / raw)
  To: Christian König, amd-gfx, dri-devel, Daniel Vetter,
	Dave Airlie, Thomas Hellström (Intel),
	dan.j.williams
  Cc: kbuild-all, Kuehling, Felix, Kasiviswanathan, Harish, Huang,
	JinHuiEric, Deucher, Alexander, Koenig, Christian


[-- Attachment #1.1: Type: text/plain, Size: 9770 bytes --]

[AMD Official Use Only - Internal Distribution Only]

Hi Daniel, Thomas, Dan,

Does below message mean the calling ioremap_cache failed intel's driver build? I can see both ioremap_cache and ioremap_wc are defined in arch/x86/mm/ioremap.c - why ioremap_wc doesn't break intel driver's build?

Are we supposed to use memremap (offset, size, MEMREMAP_WB) to replace ioremap_cache? When I read here https://lwn.net/Articles/653585/ I felt that ioremap_cache returns an address annotated with _iomem while memremap returns an address without __iomem annotation. In our use case, GPU memory is treated as UEFI SPM (specific purpose memory). I am not very sure whether memremap (thus no __iomem annotation) is the right thing to do. What I am sure is, we have tested ioremap_cache and it works fine on AMD system.

I will send out a test patch replacing ioremap_cache with ioremap_wc, to trigger Intel build robot to see whether it fails Intel build. I suppose it will not fail Intel build.

Regards,
Oak

From: Christian König <ckoenig.leichtzumerken@gmail.com>
Sent: Tuesday, March 2, 2021 6:31 AM
To: amd-gfx@lists.freedesktop.org; dri-devel@lists.freedesktop.org; Daniel Vetter <daniel@ffwll.ch>; Dave Airlie <airlied@redhat.com>; Thomas Hellström (Intel) <thomas_os@shipmail.org>
Cc: Zeng, Oak <Oak.Zeng@amd.com>; kbuild-all@lists.01.org; Kuehling, Felix <Felix.Kuehling@amd.com>; Kasiviswanathan, Harish <Harish.Kasiviswanathan@amd.com>; Deucher, Alexander <Alexander.Deucher@amd.com>; Huang, JinHuiEric <JinHuiEric.Huang@amd.com>; Koenig, Christian <Christian.Koenig@amd.com>
Subject: Re: [PATCH] drm/ttm: ioremap buffer according to TTM mem caching setting

Hi guys,

adding the usual suspects direct. Does anybody of hand know how to check if an architecture supports ioremap_cache()?

For now we only need this on X86, but I would feel better if we don't use an #ifdef here.

Regards,
Christian.
Am 02.03.21 um 05:12 schrieb kernel test robot:

Hi Oak,



Thank you for the patch! Yet something to improve:



[auto build test ERROR on drm-intel/for-linux-next]

[also build test ERROR on drm-tip/drm-tip linus/master v5.12-rc1 next-20210302]

[cannot apply to tegra-drm/drm/tegra/for-next drm-exynos/exynos-drm-next drm/drm-next]

[If your patch is applied to the wrong git tree, kindly drop us a note.

And when submitting patch, we suggest to use '--base' as documented in

https://git-scm.com/docs/git-format-patch<https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgit-scm.com%2Fdocs%2Fgit-format-patch&data=04%7C01%7COak.Zeng%40amd.com%7C08f51e87e36c4de858bc08d8dd6eb16b%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637502814793168696%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=p4iynMPvZGknfSGSyZnXV3kLwScMLbPDB8zVsmxhtk0%3D&reserved=0>]



url:    https://github.com/0day-ci/linux/commits/Oak-Zeng/drm-ttm-ioremap-buffer-according-to-TTM-mem-caching-setting/20210302-064500<https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2F0day-ci%2Flinux%2Fcommits%2FOak-Zeng%2Fdrm-ttm-ioremap-buffer-according-to-TTM-mem-caching-setting%2F20210302-064500&data=04%7C01%7COak.Zeng%40amd.com%7C08f51e87e36c4de858bc08d8dd6eb16b%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637502814793178689%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=2sc4jZR3bVRF0xDDqNOtUcNR9qiJMF2ATmCDAX%2BSWrQ%3D&reserved=0>

base:   git://anongit.freedesktop.org/drm-intel for-linux-next

config: parisc-randconfig-r012-20210302 (attached as .config)

compiler: hppa-linux-gcc (GCC) 9.3.0

reproduce (this is a W=1 build):

        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross<https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fraw.githubusercontent.com%2Fintel%2Flkp-tests%2Fmaster%2Fsbin%2Fmake.cross&data=04%7C01%7COak.Zeng%40amd.com%7C08f51e87e36c4de858bc08d8dd6eb16b%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637502814793178689%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=uILcLE%2F24bhSU%2Bo5GmWGAK6s6xDFivP6lrm6JgtM50Y%3D&reserved=0> -O ~/bin/make.cross

        chmod +x ~/bin/make.cross

        # https://github.com/0day-ci/linux/commit/225bb3711439ec559dd72ae5af8e62d34ea60a64<https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2F0day-ci%2Flinux%2Fcommit%2F225bb3711439ec559dd72ae5af8e62d34ea60a64&data=04%7C01%7COak.Zeng%40amd.com%7C08f51e87e36c4de858bc08d8dd6eb16b%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637502814793188685%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=2TOSPuKEMRcZjMfxO9lxgwFxgXwHqERCOgRednI7OE8%3D&reserved=0>

        git remote add linux-review https://github.com/0day-ci/linux<https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2F0day-ci%2Flinux&data=04%7C01%7COak.Zeng%40amd.com%7C08f51e87e36c4de858bc08d8dd6eb16b%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637502814793188685%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=TlXvs5mxH0RV9qQFaUF2B1LZisTWbnt4hfFd2OC7gGw%3D&reserved=0>

        git fetch --no-tags linux-review Oak-Zeng/drm-ttm-ioremap-buffer-according-to-TTM-mem-caching-setting/20210302-064500

        git checkout 225bb3711439ec559dd72ae5af8e62d34ea60a64

        # save the attached .config to linux build tree

        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=parisc



If you fix the issue, kindly add following tag as appropriate

Reported-by: kernel test robot <lkp@intel.com><mailto:lkp@intel.com>



All errors (new ones prefixed by >>):



   drivers/gpu/drm/ttm/ttm_bo_util.c: In function 'ttm_resource_ioremap':

drivers/gpu/drm/ttm/ttm_bo_util.c:95:11: error: implicit declaration of function 'ioremap_cache'; did you mean 'ioremap_uc'? [-Werror=implicit-function-declaration]

      95 |    addr = ioremap_cache(mem->bus.offset, bus_size);

         |           ^~~~~~~~~~~~~

         |           ioremap_uc

   drivers/gpu/drm/ttm/ttm_bo_util.c:95:9: warning: assignment to 'void *' from 'int' makes pointer from integer without a cast [-Wint-conversion]

      95 |    addr = ioremap_cache(mem->bus.offset, bus_size);

         |         ^

   drivers/gpu/drm/ttm/ttm_bo_util.c: In function 'ttm_bo_ioremap':

   drivers/gpu/drm/ttm/ttm_bo_util.c:379:17: warning: assignment to 'void *' from 'int' makes pointer from integer without a cast [-Wint-conversion]

     379 |    map->virtual = ioremap_cache(bo->mem.bus.offset + offset,

         |                 ^

   drivers/gpu/drm/ttm/ttm_bo_util.c: In function 'ttm_bo_vmap':

   drivers/gpu/drm/ttm/ttm_bo_util.c:500:16: warning: assignment to 'void *' from 'int' makes pointer from integer without a cast [-Wint-conversion]

     500 |    vaddr_iomem = ioremap_cache(mem->bus.offset,

         |                ^

   cc1: some warnings being treated as errors





vim +95 drivers/gpu/drm/ttm/ttm_bo_util.c



    74

    75  static int ttm_resource_ioremap(struct ttm_bo_device *bdev,

    76                                struct ttm_resource *mem,

    77                                void **virtual)

    78  {

    79          int ret;

    80          void *addr;

    81

    82          *virtual = NULL;

    83          ret = ttm_mem_io_reserve(bdev, mem);

    84          if (ret || !mem->bus.is_iomem)

    85                  return ret;

    86

    87          if (mem->bus.addr) {

    88                  addr = mem->bus.addr;

    89          } else {

    90                  size_t bus_size = (size_t)mem->num_pages << PAGE_SHIFT;

    91

    92                  if (mem->bus.caching == ttm_write_combined)

    93                         addr = ioremap_wc(mem->bus.offset, bus_size);

    94                  else if (mem->bus.caching == ttm_cached)

  > 95                         addr = ioremap_cache(mem->bus.offset, bus_size);

    96                  else

    97                         addr = ioremap(mem->bus.offset, bus_size);

    98                  if (!addr) {

    99                         ttm_mem_io_free(bdev, mem);

   100                         return -ENOMEM;

   101                  }

   102          }

   103          *virtual = addr;

   104          return 0;

   105  }

   106



---

0-DAY CI Kernel Test Service, Intel Corporation

https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org<https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.01.org%2Fhyperkitty%2Flist%2Fkbuild-all%40lists.01.org&data=04%7C01%7COak.Zeng%40amd.com%7C08f51e87e36c4de858bc08d8dd6eb16b%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637502814793198680%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=8vaxBMiRPv5mgZyKjDnsNtzAz%2BDltnzlkUMDMg45%2BrI%3D&reserved=0>



_______________________________________________

amd-gfx mailing list

amd-gfx@lists.freedesktop.org<mailto:amd-gfx@lists.freedesktop.org>

https://lists.freedesktop.org/mailman/listinfo/amd-gfx<https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&data=04%7C01%7COak.Zeng%40amd.com%7C08f51e87e36c4de858bc08d8dd6eb16b%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637502814793198680%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=eRpwM7V33brBQtOxnkAfPTlp383tcA1x55zPPw1W0gA%3D&reserved=0>


[-- Attachment #1.2: Type: text/html, Size: 18979 bytes --]

[-- Attachment #2: Type: text/plain, Size: 154 bytes --]

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply	[flat|nested] 49+ messages in thread

* Re: [PATCH] drm/ttm: ioremap buffer according to TTM mem caching setting
  2021-03-02 11:31     ` Christian König
  (?)
  (?)
@ 2021-03-02 22:45     ` Zeng, Oak
  -1 siblings, 0 replies; 49+ messages in thread
From: Zeng, Oak @ 2021-03-02 22:45 UTC (permalink / raw)
  To: kbuild-all

[-- Attachment #1: Type: text/plain, Size: 9782 bytes --]

[AMD Official Use Only - Internal Distribution Only]

Hi Daniel, Thomas, Dan,

Does below message mean the calling ioremap_cache failed intel's driver build? I can see both ioremap_cache and ioremap_wc are defined in arch/x86/mm/ioremap.c - why ioremap_wc doesn't break intel driver's build?

Are we supposed to use memremap (offset, size, MEMREMAP_WB) to replace ioremap_cache? When I read here https://lwn.net/Articles/653585/ I felt that ioremap_cache returns an address annotated with _iomem while memremap returns an address without __iomem annotation. In our use case, GPU memory is treated as UEFI SPM (specific purpose memory). I am not very sure whether memremap (thus no __iomem annotation) is the right thing to do. What I am sure is, we have tested ioremap_cache and it works fine on AMD system.

I will send out a test patch replacing ioremap_cache with ioremap_wc, to trigger Intel build robot to see whether it fails Intel build. I suppose it will not fail Intel build.

Regards,
Oak

From: Christian König <ckoenig.leichtzumerken@gmail.com>
Sent: Tuesday, March 2, 2021 6:31 AM
To: amd-gfx(a)lists.freedesktop.org; dri-devel(a)lists.freedesktop.org; Daniel Vetter <daniel@ffwll.ch>; Dave Airlie <airlied@redhat.com>; Thomas Hellström (Intel) <thomas_os@shipmail.org>
Cc: Zeng, Oak <Oak.Zeng@amd.com>; kbuild-all(a)lists.01.org; Kuehling, Felix <Felix.Kuehling@amd.com>; Kasiviswanathan, Harish <Harish.Kasiviswanathan@amd.com>; Deucher, Alexander <Alexander.Deucher@amd.com>; Huang, JinHuiEric <JinHuiEric.Huang@amd.com>; Koenig, Christian <Christian.Koenig@amd.com>
Subject: Re: [PATCH] drm/ttm: ioremap buffer according to TTM mem caching setting

Hi guys,

adding the usual suspects direct. Does anybody of hand know how to check if an architecture supports ioremap_cache()?

For now we only need this on X86, but I would feel better if we don't use an #ifdef here.

Regards,
Christian.
Am 02.03.21 um 05:12 schrieb kernel test robot:

Hi Oak,



Thank you for the patch! Yet something to improve:



[auto build test ERROR on drm-intel/for-linux-next]

[also build test ERROR on drm-tip/drm-tip linus/master v5.12-rc1 next-20210302]

[cannot apply to tegra-drm/drm/tegra/for-next drm-exynos/exynos-drm-next drm/drm-next]

[If your patch is applied to the wrong git tree, kindly drop us a note.

And when submitting patch, we suggest to use '--base' as documented in

https://git-scm.com/docs/git-format-patch<https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgit-scm.com%2Fdocs%2Fgit-format-patch&data=04%7C01%7COak.Zeng%40amd.com%7C08f51e87e36c4de858bc08d8dd6eb16b%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637502814793168696%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=p4iynMPvZGknfSGSyZnXV3kLwScMLbPDB8zVsmxhtk0%3D&reserved=0>]



url:    https://github.com/0day-ci/linux/commits/Oak-Zeng/drm-ttm-ioremap-buffer-according-to-TTM-mem-caching-setting/20210302-064500<https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2F0day-ci%2Flinux%2Fcommits%2FOak-Zeng%2Fdrm-ttm-ioremap-buffer-according-to-TTM-mem-caching-setting%2F20210302-064500&data=04%7C01%7COak.Zeng%40amd.com%7C08f51e87e36c4de858bc08d8dd6eb16b%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637502814793178689%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=2sc4jZR3bVRF0xDDqNOtUcNR9qiJMF2ATmCDAX%2BSWrQ%3D&reserved=0>

base:   git://anongit.freedesktop.org/drm-intel for-linux-next

config: parisc-randconfig-r012-20210302 (attached as .config)

compiler: hppa-linux-gcc (GCC) 9.3.0

reproduce (this is a W=1 build):

        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross<https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fraw.githubusercontent.com%2Fintel%2Flkp-tests%2Fmaster%2Fsbin%2Fmake.cross&data=04%7C01%7COak.Zeng%40amd.com%7C08f51e87e36c4de858bc08d8dd6eb16b%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637502814793178689%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=uILcLE%2F24bhSU%2Bo5GmWGAK6s6xDFivP6lrm6JgtM50Y%3D&reserved=0> -O ~/bin/make.cross

        chmod +x ~/bin/make.cross

        # https://github.com/0day-ci/linux/commit/225bb3711439ec559dd72ae5af8e62d34ea60a64<https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2F0day-ci%2Flinux%2Fcommit%2F225bb3711439ec559dd72ae5af8e62d34ea60a64&data=04%7C01%7COak.Zeng%40amd.com%7C08f51e87e36c4de858bc08d8dd6eb16b%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637502814793188685%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=2TOSPuKEMRcZjMfxO9lxgwFxgXwHqERCOgRednI7OE8%3D&reserved=0>

        git remote add linux-review https://github.com/0day-ci/linux<https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2F0day-ci%2Flinux&data=04%7C01%7COak.Zeng%40amd.com%7C08f51e87e36c4de858bc08d8dd6eb16b%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637502814793188685%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=TlXvs5mxH0RV9qQFaUF2B1LZisTWbnt4hfFd2OC7gGw%3D&reserved=0>

        git fetch --no-tags linux-review Oak-Zeng/drm-ttm-ioremap-buffer-according-to-TTM-mem-caching-setting/20210302-064500

        git checkout 225bb3711439ec559dd72ae5af8e62d34ea60a64

        # save the attached .config to linux build tree

        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=parisc



If you fix the issue, kindly add following tag as appropriate

Reported-by: kernel test robot <lkp@intel.com><mailto:lkp@intel.com>



All errors (new ones prefixed by >>):



   drivers/gpu/drm/ttm/ttm_bo_util.c: In function 'ttm_resource_ioremap':

drivers/gpu/drm/ttm/ttm_bo_util.c:95:11: error: implicit declaration of function 'ioremap_cache'; did you mean 'ioremap_uc'? [-Werror=implicit-function-declaration]

      95 |    addr = ioremap_cache(mem->bus.offset, bus_size);

         |           ^~~~~~~~~~~~~

         |           ioremap_uc

   drivers/gpu/drm/ttm/ttm_bo_util.c:95:9: warning: assignment to 'void *' from 'int' makes pointer from integer without a cast [-Wint-conversion]

      95 |    addr = ioremap_cache(mem->bus.offset, bus_size);

         |         ^

   drivers/gpu/drm/ttm/ttm_bo_util.c: In function 'ttm_bo_ioremap':

   drivers/gpu/drm/ttm/ttm_bo_util.c:379:17: warning: assignment to 'void *' from 'int' makes pointer from integer without a cast [-Wint-conversion]

     379 |    map->virtual = ioremap_cache(bo->mem.bus.offset + offset,

         |                 ^

   drivers/gpu/drm/ttm/ttm_bo_util.c: In function 'ttm_bo_vmap':

   drivers/gpu/drm/ttm/ttm_bo_util.c:500:16: warning: assignment to 'void *' from 'int' makes pointer from integer without a cast [-Wint-conversion]

     500 |    vaddr_iomem = ioremap_cache(mem->bus.offset,

         |                ^

   cc1: some warnings being treated as errors





vim +95 drivers/gpu/drm/ttm/ttm_bo_util.c



    74

    75  static int ttm_resource_ioremap(struct ttm_bo_device *bdev,

    76                                struct ttm_resource *mem,

    77                                void **virtual)

    78  {

    79          int ret;

    80          void *addr;

    81

    82          *virtual = NULL;

    83          ret = ttm_mem_io_reserve(bdev, mem);

    84          if (ret || !mem->bus.is_iomem)

    85                  return ret;

    86

    87          if (mem->bus.addr) {

    88                  addr = mem->bus.addr;

    89          } else {

    90                  size_t bus_size = (size_t)mem->num_pages << PAGE_SHIFT;

    91

    92                  if (mem->bus.caching == ttm_write_combined)

    93                         addr = ioremap_wc(mem->bus.offset, bus_size);

    94                  else if (mem->bus.caching == ttm_cached)

  > 95                         addr = ioremap_cache(mem->bus.offset, bus_size);

    96                  else

    97                         addr = ioremap(mem->bus.offset, bus_size);

    98                  if (!addr) {

    99                         ttm_mem_io_free(bdev, mem);

   100                         return -ENOMEM;

   101                  }

   102          }

   103          *virtual = addr;

   104          return 0;

   105  }

   106



---

0-DAY CI Kernel Test Service, Intel Corporation

https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org<https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.01.org%2Fhyperkitty%2Flist%2Fkbuild-all%40lists.01.org&data=04%7C01%7COak.Zeng%40amd.com%7C08f51e87e36c4de858bc08d8dd6eb16b%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637502814793198680%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=8vaxBMiRPv5mgZyKjDnsNtzAz%2BDltnzlkUMDMg45%2BrI%3D&reserved=0>



_______________________________________________

amd-gfx mailing list

amd-gfx(a)lists.freedesktop.org<mailto:amd-gfx@lists.freedesktop.org>

https://lists.freedesktop.org/mailman/listinfo/amd-gfx<https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&data=04%7C01%7COak.Zeng%40amd.com%7C08f51e87e36c4de858bc08d8dd6eb16b%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637502814793198680%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=eRpwM7V33brBQtOxnkAfPTlp383tcA1x55zPPw1W0gA%3D&reserved=0>


[-- Attachment #2: attachment.htm --]
[-- Type: text/html, Size: 18765 bytes --]

^ permalink raw reply	[flat|nested] 49+ messages in thread

* Re: [PATCH] drm/ttm: ioremap buffer according to TTM mem caching setting
  2021-03-02  4:12   ` kernel test robot
@ 2021-03-02 11:31     ` Christian König
  -1 siblings, 0 replies; 49+ messages in thread
From: Christian König @ 2021-03-02 11:31 UTC (permalink / raw)
  To: amd-gfx, dri-devel, Daniel Vetter, Dave Airlie,
	Thomas Hellström (Intel)
  Cc: kbuild-all, Oak Zeng, harish.kasiviswanathan, christian.koenig,
	jinhuieric.huang, Alexander.Deucher, Felix.Kuehling


[-- Attachment #1.1: Type: text/plain, Size: 4623 bytes --]

Hi guys,

adding the usual suspects direct. Does anybody of hand know how to check 
if an architecture supports ioremap_cache()?

For now we only need this on X86, but I would feel better if we don't 
use an #ifdef here.

Regards,
Christian.

Am 02.03.21 um 05:12 schrieb kernel test robot:
> Hi Oak,
>
> Thank you for the patch! Yet something to improve:
>
> [auto build test ERROR on drm-intel/for-linux-next]
> [also build test ERROR on drm-tip/drm-tip linus/master v5.12-rc1 next-20210302]
> [cannot apply to tegra-drm/drm/tegra/for-next drm-exynos/exynos-drm-next drm/drm-next]
> [If your patch is applied to the wrong git tree, kindly drop us a note.
> And when submitting patch, we suggest to use '--base' as documented in
> https://git-scm.com/docs/git-format-patch]
>
> url:    https://github.com/0day-ci/linux/commits/Oak-Zeng/drm-ttm-ioremap-buffer-according-to-TTM-mem-caching-setting/20210302-064500
> base:   git://anongit.freedesktop.org/drm-intel for-linux-next
> config: parisc-randconfig-r012-20210302 (attached as .config)
> compiler: hppa-linux-gcc (GCC) 9.3.0
> reproduce (this is a W=1 build):
>          wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
>          chmod +x ~/bin/make.cross
>          # https://github.com/0day-ci/linux/commit/225bb3711439ec559dd72ae5af8e62d34ea60a64
>          git remote add linux-review https://github.com/0day-ci/linux
>          git fetch --no-tags linux-review Oak-Zeng/drm-ttm-ioremap-buffer-according-to-TTM-mem-caching-setting/20210302-064500
>          git checkout 225bb3711439ec559dd72ae5af8e62d34ea60a64
>          # save the attached .config to linux build tree
>          COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=parisc
>
> If you fix the issue, kindly add following tag as appropriate
> Reported-by: kernel test robot <lkp@intel.com>
>
> All errors (new ones prefixed by >>):
>
>     drivers/gpu/drm/ttm/ttm_bo_util.c: In function 'ttm_resource_ioremap':
>>> drivers/gpu/drm/ttm/ttm_bo_util.c:95:11: error: implicit declaration of function 'ioremap_cache'; did you mean 'ioremap_uc'? [-Werror=implicit-function-declaration]
>        95 |    addr = ioremap_cache(mem->bus.offset, bus_size);
>           |           ^~~~~~~~~~~~~
>           |           ioremap_uc
>     drivers/gpu/drm/ttm/ttm_bo_util.c:95:9: warning: assignment to 'void *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
>        95 |    addr = ioremap_cache(mem->bus.offset, bus_size);
>           |         ^
>     drivers/gpu/drm/ttm/ttm_bo_util.c: In function 'ttm_bo_ioremap':
>     drivers/gpu/drm/ttm/ttm_bo_util.c:379:17: warning: assignment to 'void *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
>       379 |    map->virtual = ioremap_cache(bo->mem.bus.offset + offset,
>           |                 ^
>     drivers/gpu/drm/ttm/ttm_bo_util.c: In function 'ttm_bo_vmap':
>     drivers/gpu/drm/ttm/ttm_bo_util.c:500:16: warning: assignment to 'void *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
>       500 |    vaddr_iomem = ioremap_cache(mem->bus.offset,
>           |                ^
>     cc1: some warnings being treated as errors
>
>
> vim +95 drivers/gpu/drm/ttm/ttm_bo_util.c
>
>      74	
>      75	static int ttm_resource_ioremap(struct ttm_bo_device *bdev,
>      76				       struct ttm_resource *mem,
>      77				       void **virtual)
>      78	{
>      79		int ret;
>      80		void *addr;
>      81	
>      82		*virtual = NULL;
>      83		ret = ttm_mem_io_reserve(bdev, mem);
>      84		if (ret || !mem->bus.is_iomem)
>      85			return ret;
>      86	
>      87		if (mem->bus.addr) {
>      88			addr = mem->bus.addr;
>      89		} else {
>      90			size_t bus_size = (size_t)mem->num_pages << PAGE_SHIFT;
>      91	
>      92			if (mem->bus.caching == ttm_write_combined)
>      93				addr = ioremap_wc(mem->bus.offset, bus_size);
>      94			else if (mem->bus.caching == ttm_cached)
>    > 95				addr = ioremap_cache(mem->bus.offset, bus_size);
>      96			else
>      97				addr = ioremap(mem->bus.offset, bus_size);
>      98			if (!addr) {
>      99				ttm_mem_io_free(bdev, mem);
>     100				return -ENOMEM;
>     101			}
>     102		}
>     103		*virtual = addr;
>     104		return 0;
>     105	}
>     106	
>
> ---
> 0-DAY CI Kernel Test Service, Intel Corporation
> https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
>
> _______________________________________________
> amd-gfx mailing list
> amd-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx


[-- Attachment #1.2: Type: text/html, Size: 6128 bytes --]

[-- Attachment #2: Type: text/plain, Size: 160 bytes --]

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

^ permalink raw reply	[flat|nested] 49+ messages in thread

* Re: [PATCH] drm/ttm: ioremap buffer according to TTM mem caching setting
@ 2021-03-02 11:31     ` Christian König
  0 siblings, 0 replies; 49+ messages in thread
From: Christian König @ 2021-03-02 11:31 UTC (permalink / raw)
  To: amd-gfx, dri-devel, Daniel Vetter, Dave Airlie,
	Thomas Hellström (Intel)
  Cc: kbuild-all, Oak Zeng, harish.kasiviswanathan, christian.koenig,
	jinhuieric.huang, Alexander.Deucher, Felix.Kuehling


[-- Attachment #1.1: Type: text/plain, Size: 4623 bytes --]

Hi guys,

adding the usual suspects direct. Does anybody of hand know how to check 
if an architecture supports ioremap_cache()?

For now we only need this on X86, but I would feel better if we don't 
use an #ifdef here.

Regards,
Christian.

Am 02.03.21 um 05:12 schrieb kernel test robot:
> Hi Oak,
>
> Thank you for the patch! Yet something to improve:
>
> [auto build test ERROR on drm-intel/for-linux-next]
> [also build test ERROR on drm-tip/drm-tip linus/master v5.12-rc1 next-20210302]
> [cannot apply to tegra-drm/drm/tegra/for-next drm-exynos/exynos-drm-next drm/drm-next]
> [If your patch is applied to the wrong git tree, kindly drop us a note.
> And when submitting patch, we suggest to use '--base' as documented in
> https://git-scm.com/docs/git-format-patch]
>
> url:    https://github.com/0day-ci/linux/commits/Oak-Zeng/drm-ttm-ioremap-buffer-according-to-TTM-mem-caching-setting/20210302-064500
> base:   git://anongit.freedesktop.org/drm-intel for-linux-next
> config: parisc-randconfig-r012-20210302 (attached as .config)
> compiler: hppa-linux-gcc (GCC) 9.3.0
> reproduce (this is a W=1 build):
>          wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
>          chmod +x ~/bin/make.cross
>          # https://github.com/0day-ci/linux/commit/225bb3711439ec559dd72ae5af8e62d34ea60a64
>          git remote add linux-review https://github.com/0day-ci/linux
>          git fetch --no-tags linux-review Oak-Zeng/drm-ttm-ioremap-buffer-according-to-TTM-mem-caching-setting/20210302-064500
>          git checkout 225bb3711439ec559dd72ae5af8e62d34ea60a64
>          # save the attached .config to linux build tree
>          COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=parisc
>
> If you fix the issue, kindly add following tag as appropriate
> Reported-by: kernel test robot <lkp@intel.com>
>
> All errors (new ones prefixed by >>):
>
>     drivers/gpu/drm/ttm/ttm_bo_util.c: In function 'ttm_resource_ioremap':
>>> drivers/gpu/drm/ttm/ttm_bo_util.c:95:11: error: implicit declaration of function 'ioremap_cache'; did you mean 'ioremap_uc'? [-Werror=implicit-function-declaration]
>        95 |    addr = ioremap_cache(mem->bus.offset, bus_size);
>           |           ^~~~~~~~~~~~~
>           |           ioremap_uc
>     drivers/gpu/drm/ttm/ttm_bo_util.c:95:9: warning: assignment to 'void *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
>        95 |    addr = ioremap_cache(mem->bus.offset, bus_size);
>           |         ^
>     drivers/gpu/drm/ttm/ttm_bo_util.c: In function 'ttm_bo_ioremap':
>     drivers/gpu/drm/ttm/ttm_bo_util.c:379:17: warning: assignment to 'void *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
>       379 |    map->virtual = ioremap_cache(bo->mem.bus.offset + offset,
>           |                 ^
>     drivers/gpu/drm/ttm/ttm_bo_util.c: In function 'ttm_bo_vmap':
>     drivers/gpu/drm/ttm/ttm_bo_util.c:500:16: warning: assignment to 'void *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
>       500 |    vaddr_iomem = ioremap_cache(mem->bus.offset,
>           |                ^
>     cc1: some warnings being treated as errors
>
>
> vim +95 drivers/gpu/drm/ttm/ttm_bo_util.c
>
>      74	
>      75	static int ttm_resource_ioremap(struct ttm_bo_device *bdev,
>      76				       struct ttm_resource *mem,
>      77				       void **virtual)
>      78	{
>      79		int ret;
>      80		void *addr;
>      81	
>      82		*virtual = NULL;
>      83		ret = ttm_mem_io_reserve(bdev, mem);
>      84		if (ret || !mem->bus.is_iomem)
>      85			return ret;
>      86	
>      87		if (mem->bus.addr) {
>      88			addr = mem->bus.addr;
>      89		} else {
>      90			size_t bus_size = (size_t)mem->num_pages << PAGE_SHIFT;
>      91	
>      92			if (mem->bus.caching == ttm_write_combined)
>      93				addr = ioremap_wc(mem->bus.offset, bus_size);
>      94			else if (mem->bus.caching == ttm_cached)
>    > 95				addr = ioremap_cache(mem->bus.offset, bus_size);
>      96			else
>      97				addr = ioremap(mem->bus.offset, bus_size);
>      98			if (!addr) {
>      99				ttm_mem_io_free(bdev, mem);
>     100				return -ENOMEM;
>     101			}
>     102		}
>     103		*virtual = addr;
>     104		return 0;
>     105	}
>     106	
>
> ---
> 0-DAY CI Kernel Test Service, Intel Corporation
> https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
>
> _______________________________________________
> amd-gfx mailing list
> amd-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx


[-- Attachment #1.2: Type: text/html, Size: 6128 bytes --]

[-- Attachment #2: Type: text/plain, Size: 154 bytes --]

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply	[flat|nested] 49+ messages in thread

* Re: [PATCH] drm/ttm: ioremap buffer according to TTM mem caching setting
  2021-03-01 22:43 ` Oak Zeng
  (?)
@ 2021-03-02  4:12   ` kernel test robot
  -1 siblings, 0 replies; 49+ messages in thread
From: kernel test robot @ 2021-03-02  4:12 UTC (permalink / raw)
  To: Oak Zeng, amd-gfx, dri-devel
  Cc: Oak Zeng, kbuild-all, Felix.Kuehling, harish.kasiviswanathan,
	Alexander.Deucher, jinhuieric.huang, christian.koenig

[-- Attachment #1: Type: text/plain, Size: 3946 bytes --]

Hi Oak,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on drm-intel/for-linux-next]
[also build test ERROR on drm-tip/drm-tip linus/master v5.12-rc1 next-20210302]
[cannot apply to tegra-drm/drm/tegra/for-next drm-exynos/exynos-drm-next drm/drm-next]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Oak-Zeng/drm-ttm-ioremap-buffer-according-to-TTM-mem-caching-setting/20210302-064500
base:   git://anongit.freedesktop.org/drm-intel for-linux-next
config: parisc-randconfig-r012-20210302 (attached as .config)
compiler: hppa-linux-gcc (GCC) 9.3.0
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # https://github.com/0day-ci/linux/commit/225bb3711439ec559dd72ae5af8e62d34ea60a64
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Oak-Zeng/drm-ttm-ioremap-buffer-according-to-TTM-mem-caching-setting/20210302-064500
        git checkout 225bb3711439ec559dd72ae5af8e62d34ea60a64
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=parisc 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All errors (new ones prefixed by >>):

   drivers/gpu/drm/ttm/ttm_bo_util.c: In function 'ttm_resource_ioremap':
>> drivers/gpu/drm/ttm/ttm_bo_util.c:95:11: error: implicit declaration of function 'ioremap_cache'; did you mean 'ioremap_uc'? [-Werror=implicit-function-declaration]
      95 |    addr = ioremap_cache(mem->bus.offset, bus_size);
         |           ^~~~~~~~~~~~~
         |           ioremap_uc
   drivers/gpu/drm/ttm/ttm_bo_util.c:95:9: warning: assignment to 'void *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
      95 |    addr = ioremap_cache(mem->bus.offset, bus_size);
         |         ^
   drivers/gpu/drm/ttm/ttm_bo_util.c: In function 'ttm_bo_ioremap':
   drivers/gpu/drm/ttm/ttm_bo_util.c:379:17: warning: assignment to 'void *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
     379 |    map->virtual = ioremap_cache(bo->mem.bus.offset + offset,
         |                 ^
   drivers/gpu/drm/ttm/ttm_bo_util.c: In function 'ttm_bo_vmap':
   drivers/gpu/drm/ttm/ttm_bo_util.c:500:16: warning: assignment to 'void *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
     500 |    vaddr_iomem = ioremap_cache(mem->bus.offset,
         |                ^
   cc1: some warnings being treated as errors


vim +95 drivers/gpu/drm/ttm/ttm_bo_util.c

    74	
    75	static int ttm_resource_ioremap(struct ttm_bo_device *bdev,
    76				       struct ttm_resource *mem,
    77				       void **virtual)
    78	{
    79		int ret;
    80		void *addr;
    81	
    82		*virtual = NULL;
    83		ret = ttm_mem_io_reserve(bdev, mem);
    84		if (ret || !mem->bus.is_iomem)
    85			return ret;
    86	
    87		if (mem->bus.addr) {
    88			addr = mem->bus.addr;
    89		} else {
    90			size_t bus_size = (size_t)mem->num_pages << PAGE_SHIFT;
    91	
    92			if (mem->bus.caching == ttm_write_combined)
    93				addr = ioremap_wc(mem->bus.offset, bus_size);
    94			else if (mem->bus.caching == ttm_cached)
  > 95				addr = ioremap_cache(mem->bus.offset, bus_size);
    96			else
    97				addr = ioremap(mem->bus.offset, bus_size);
    98			if (!addr) {
    99				ttm_mem_io_free(bdev, mem);
   100				return -ENOMEM;
   101			}
   102		}
   103		*virtual = addr;
   104		return 0;
   105	}
   106	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 25858 bytes --]

[-- Attachment #3: Type: text/plain, Size: 160 bytes --]

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

^ permalink raw reply	[flat|nested] 49+ messages in thread

* Re: [PATCH] drm/ttm: ioremap buffer according to TTM mem caching setting
@ 2021-03-02  4:12   ` kernel test robot
  0 siblings, 0 replies; 49+ messages in thread
From: kernel test robot @ 2021-03-02  4:12 UTC (permalink / raw)
  To: Oak Zeng, amd-gfx, dri-devel
  Cc: Oak Zeng, kbuild-all, Felix.Kuehling, harish.kasiviswanathan,
	Alexander.Deucher, jinhuieric.huang, christian.koenig

[-- Attachment #1: Type: text/plain, Size: 3946 bytes --]

Hi Oak,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on drm-intel/for-linux-next]
[also build test ERROR on drm-tip/drm-tip linus/master v5.12-rc1 next-20210302]
[cannot apply to tegra-drm/drm/tegra/for-next drm-exynos/exynos-drm-next drm/drm-next]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Oak-Zeng/drm-ttm-ioremap-buffer-according-to-TTM-mem-caching-setting/20210302-064500
base:   git://anongit.freedesktop.org/drm-intel for-linux-next
config: parisc-randconfig-r012-20210302 (attached as .config)
compiler: hppa-linux-gcc (GCC) 9.3.0
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # https://github.com/0day-ci/linux/commit/225bb3711439ec559dd72ae5af8e62d34ea60a64
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Oak-Zeng/drm-ttm-ioremap-buffer-according-to-TTM-mem-caching-setting/20210302-064500
        git checkout 225bb3711439ec559dd72ae5af8e62d34ea60a64
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=parisc 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All errors (new ones prefixed by >>):

   drivers/gpu/drm/ttm/ttm_bo_util.c: In function 'ttm_resource_ioremap':
>> drivers/gpu/drm/ttm/ttm_bo_util.c:95:11: error: implicit declaration of function 'ioremap_cache'; did you mean 'ioremap_uc'? [-Werror=implicit-function-declaration]
      95 |    addr = ioremap_cache(mem->bus.offset, bus_size);
         |           ^~~~~~~~~~~~~
         |           ioremap_uc
   drivers/gpu/drm/ttm/ttm_bo_util.c:95:9: warning: assignment to 'void *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
      95 |    addr = ioremap_cache(mem->bus.offset, bus_size);
         |         ^
   drivers/gpu/drm/ttm/ttm_bo_util.c: In function 'ttm_bo_ioremap':
   drivers/gpu/drm/ttm/ttm_bo_util.c:379:17: warning: assignment to 'void *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
     379 |    map->virtual = ioremap_cache(bo->mem.bus.offset + offset,
         |                 ^
   drivers/gpu/drm/ttm/ttm_bo_util.c: In function 'ttm_bo_vmap':
   drivers/gpu/drm/ttm/ttm_bo_util.c:500:16: warning: assignment to 'void *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
     500 |    vaddr_iomem = ioremap_cache(mem->bus.offset,
         |                ^
   cc1: some warnings being treated as errors


vim +95 drivers/gpu/drm/ttm/ttm_bo_util.c

    74	
    75	static int ttm_resource_ioremap(struct ttm_bo_device *bdev,
    76				       struct ttm_resource *mem,
    77				       void **virtual)
    78	{
    79		int ret;
    80		void *addr;
    81	
    82		*virtual = NULL;
    83		ret = ttm_mem_io_reserve(bdev, mem);
    84		if (ret || !mem->bus.is_iomem)
    85			return ret;
    86	
    87		if (mem->bus.addr) {
    88			addr = mem->bus.addr;
    89		} else {
    90			size_t bus_size = (size_t)mem->num_pages << PAGE_SHIFT;
    91	
    92			if (mem->bus.caching == ttm_write_combined)
    93				addr = ioremap_wc(mem->bus.offset, bus_size);
    94			else if (mem->bus.caching == ttm_cached)
  > 95				addr = ioremap_cache(mem->bus.offset, bus_size);
    96			else
    97				addr = ioremap(mem->bus.offset, bus_size);
    98			if (!addr) {
    99				ttm_mem_io_free(bdev, mem);
   100				return -ENOMEM;
   101			}
   102		}
   103		*virtual = addr;
   104		return 0;
   105	}
   106	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 25858 bytes --]

[-- Attachment #3: Type: text/plain, Size: 154 bytes --]

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply	[flat|nested] 49+ messages in thread

* Re: [PATCH] drm/ttm: ioremap buffer according to TTM mem caching setting
@ 2021-03-02  4:12   ` kernel test robot
  0 siblings, 0 replies; 49+ messages in thread
From: kernel test robot @ 2021-03-02  4:12 UTC (permalink / raw)
  To: kbuild-all

[-- Attachment #1: Type: text/plain, Size: 4036 bytes --]

Hi Oak,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on drm-intel/for-linux-next]
[also build test ERROR on drm-tip/drm-tip linus/master v5.12-rc1 next-20210302]
[cannot apply to tegra-drm/drm/tegra/for-next drm-exynos/exynos-drm-next drm/drm-next]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Oak-Zeng/drm-ttm-ioremap-buffer-according-to-TTM-mem-caching-setting/20210302-064500
base:   git://anongit.freedesktop.org/drm-intel for-linux-next
config: parisc-randconfig-r012-20210302 (attached as .config)
compiler: hppa-linux-gcc (GCC) 9.3.0
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # https://github.com/0day-ci/linux/commit/225bb3711439ec559dd72ae5af8e62d34ea60a64
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Oak-Zeng/drm-ttm-ioremap-buffer-according-to-TTM-mem-caching-setting/20210302-064500
        git checkout 225bb3711439ec559dd72ae5af8e62d34ea60a64
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=parisc 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All errors (new ones prefixed by >>):

   drivers/gpu/drm/ttm/ttm_bo_util.c: In function 'ttm_resource_ioremap':
>> drivers/gpu/drm/ttm/ttm_bo_util.c:95:11: error: implicit declaration of function 'ioremap_cache'; did you mean 'ioremap_uc'? [-Werror=implicit-function-declaration]
      95 |    addr = ioremap_cache(mem->bus.offset, bus_size);
         |           ^~~~~~~~~~~~~
         |           ioremap_uc
   drivers/gpu/drm/ttm/ttm_bo_util.c:95:9: warning: assignment to 'void *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
      95 |    addr = ioremap_cache(mem->bus.offset, bus_size);
         |         ^
   drivers/gpu/drm/ttm/ttm_bo_util.c: In function 'ttm_bo_ioremap':
   drivers/gpu/drm/ttm/ttm_bo_util.c:379:17: warning: assignment to 'void *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
     379 |    map->virtual = ioremap_cache(bo->mem.bus.offset + offset,
         |                 ^
   drivers/gpu/drm/ttm/ttm_bo_util.c: In function 'ttm_bo_vmap':
   drivers/gpu/drm/ttm/ttm_bo_util.c:500:16: warning: assignment to 'void *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
     500 |    vaddr_iomem = ioremap_cache(mem->bus.offset,
         |                ^
   cc1: some warnings being treated as errors


vim +95 drivers/gpu/drm/ttm/ttm_bo_util.c

    74	
    75	static int ttm_resource_ioremap(struct ttm_bo_device *bdev,
    76				       struct ttm_resource *mem,
    77				       void **virtual)
    78	{
    79		int ret;
    80		void *addr;
    81	
    82		*virtual = NULL;
    83		ret = ttm_mem_io_reserve(bdev, mem);
    84		if (ret || !mem->bus.is_iomem)
    85			return ret;
    86	
    87		if (mem->bus.addr) {
    88			addr = mem->bus.addr;
    89		} else {
    90			size_t bus_size = (size_t)mem->num_pages << PAGE_SHIFT;
    91	
    92			if (mem->bus.caching == ttm_write_combined)
    93				addr = ioremap_wc(mem->bus.offset, bus_size);
    94			else if (mem->bus.caching == ttm_cached)
  > 95				addr = ioremap_cache(mem->bus.offset, bus_size);
    96			else
    97				addr = ioremap(mem->bus.offset, bus_size);
    98			if (!addr) {
    99				ttm_mem_io_free(bdev, mem);
   100				return -ENOMEM;
   101			}
   102		}
   103		*virtual = addr;
   104		return 0;
   105	}
   106	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 25858 bytes --]

^ permalink raw reply	[flat|nested] 49+ messages in thread

* Re: [PATCH] drm/ttm: ioremap buffer according to TTM mem caching setting
  2021-03-01 22:43 ` Oak Zeng
  (?)
@ 2021-03-02  2:16   ` kernel test robot
  -1 siblings, 0 replies; 49+ messages in thread
From: kernel test robot @ 2021-03-02  2:16 UTC (permalink / raw)
  To: Oak Zeng, amd-gfx, dri-devel
  Cc: Oak Zeng, kbuild-all, Felix.Kuehling, harish.kasiviswanathan,
	Alexander.Deucher, jinhuieric.huang, christian.koenig

[-- Attachment #1: Type: text/plain, Size: 3956 bytes --]

Hi Oak,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on drm-intel/for-linux-next]
[also build test WARNING on drm-tip/drm-tip linus/master v5.12-rc1 next-20210301]
[cannot apply to tegra-drm/drm/tegra/for-next drm-exynos/exynos-drm-next drm/drm-next]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Oak-Zeng/drm-ttm-ioremap-buffer-according-to-TTM-mem-caching-setting/20210302-064500
base:   git://anongit.freedesktop.org/drm-intel for-linux-next
config: parisc-randconfig-r012-20210302 (attached as .config)
compiler: hppa-linux-gcc (GCC) 9.3.0
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # https://github.com/0day-ci/linux/commit/225bb3711439ec559dd72ae5af8e62d34ea60a64
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Oak-Zeng/drm-ttm-ioremap-buffer-according-to-TTM-mem-caching-setting/20210302-064500
        git checkout 225bb3711439ec559dd72ae5af8e62d34ea60a64
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=parisc 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All warnings (new ones prefixed by >>):

   drivers/gpu/drm/ttm/ttm_bo_util.c: In function 'ttm_resource_ioremap':
   drivers/gpu/drm/ttm/ttm_bo_util.c:95:11: error: implicit declaration of function 'ioremap_cache'; did you mean 'ioremap_uc'? [-Werror=implicit-function-declaration]
      95 |    addr = ioremap_cache(mem->bus.offset, bus_size);
         |           ^~~~~~~~~~~~~
         |           ioremap_uc
>> drivers/gpu/drm/ttm/ttm_bo_util.c:95:9: warning: assignment to 'void *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
      95 |    addr = ioremap_cache(mem->bus.offset, bus_size);
         |         ^
   drivers/gpu/drm/ttm/ttm_bo_util.c: In function 'ttm_bo_ioremap':
   drivers/gpu/drm/ttm/ttm_bo_util.c:379:17: warning: assignment to 'void *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
     379 |    map->virtual = ioremap_cache(bo->mem.bus.offset + offset,
         |                 ^
   drivers/gpu/drm/ttm/ttm_bo_util.c: In function 'ttm_bo_vmap':
   drivers/gpu/drm/ttm/ttm_bo_util.c:500:16: warning: assignment to 'void *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
     500 |    vaddr_iomem = ioremap_cache(mem->bus.offset,
         |                ^
   cc1: some warnings being treated as errors


vim +95 drivers/gpu/drm/ttm/ttm_bo_util.c

    74	
    75	static int ttm_resource_ioremap(struct ttm_bo_device *bdev,
    76				       struct ttm_resource *mem,
    77				       void **virtual)
    78	{
    79		int ret;
    80		void *addr;
    81	
    82		*virtual = NULL;
    83		ret = ttm_mem_io_reserve(bdev, mem);
    84		if (ret || !mem->bus.is_iomem)
    85			return ret;
    86	
    87		if (mem->bus.addr) {
    88			addr = mem->bus.addr;
    89		} else {
    90			size_t bus_size = (size_t)mem->num_pages << PAGE_SHIFT;
    91	
    92			if (mem->bus.caching == ttm_write_combined)
    93				addr = ioremap_wc(mem->bus.offset, bus_size);
    94			else if (mem->bus.caching == ttm_cached)
  > 95				addr = ioremap_cache(mem->bus.offset, bus_size);
    96			else
    97				addr = ioremap(mem->bus.offset, bus_size);
    98			if (!addr) {
    99				ttm_mem_io_free(bdev, mem);
   100				return -ENOMEM;
   101			}
   102		}
   103		*virtual = addr;
   104		return 0;
   105	}
   106	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 25858 bytes --]

[-- Attachment #3: Type: text/plain, Size: 160 bytes --]

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

^ permalink raw reply	[flat|nested] 49+ messages in thread

* Re: [PATCH] drm/ttm: ioremap buffer according to TTM mem caching setting
@ 2021-03-02  2:16   ` kernel test robot
  0 siblings, 0 replies; 49+ messages in thread
From: kernel test robot @ 2021-03-02  2:16 UTC (permalink / raw)
  To: Oak Zeng, amd-gfx, dri-devel
  Cc: Oak Zeng, kbuild-all, Felix.Kuehling, harish.kasiviswanathan,
	Alexander.Deucher, jinhuieric.huang, christian.koenig

[-- Attachment #1: Type: text/plain, Size: 3956 bytes --]

Hi Oak,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on drm-intel/for-linux-next]
[also build test WARNING on drm-tip/drm-tip linus/master v5.12-rc1 next-20210301]
[cannot apply to tegra-drm/drm/tegra/for-next drm-exynos/exynos-drm-next drm/drm-next]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Oak-Zeng/drm-ttm-ioremap-buffer-according-to-TTM-mem-caching-setting/20210302-064500
base:   git://anongit.freedesktop.org/drm-intel for-linux-next
config: parisc-randconfig-r012-20210302 (attached as .config)
compiler: hppa-linux-gcc (GCC) 9.3.0
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # https://github.com/0day-ci/linux/commit/225bb3711439ec559dd72ae5af8e62d34ea60a64
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Oak-Zeng/drm-ttm-ioremap-buffer-according-to-TTM-mem-caching-setting/20210302-064500
        git checkout 225bb3711439ec559dd72ae5af8e62d34ea60a64
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=parisc 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All warnings (new ones prefixed by >>):

   drivers/gpu/drm/ttm/ttm_bo_util.c: In function 'ttm_resource_ioremap':
   drivers/gpu/drm/ttm/ttm_bo_util.c:95:11: error: implicit declaration of function 'ioremap_cache'; did you mean 'ioremap_uc'? [-Werror=implicit-function-declaration]
      95 |    addr = ioremap_cache(mem->bus.offset, bus_size);
         |           ^~~~~~~~~~~~~
         |           ioremap_uc
>> drivers/gpu/drm/ttm/ttm_bo_util.c:95:9: warning: assignment to 'void *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
      95 |    addr = ioremap_cache(mem->bus.offset, bus_size);
         |         ^
   drivers/gpu/drm/ttm/ttm_bo_util.c: In function 'ttm_bo_ioremap':
   drivers/gpu/drm/ttm/ttm_bo_util.c:379:17: warning: assignment to 'void *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
     379 |    map->virtual = ioremap_cache(bo->mem.bus.offset + offset,
         |                 ^
   drivers/gpu/drm/ttm/ttm_bo_util.c: In function 'ttm_bo_vmap':
   drivers/gpu/drm/ttm/ttm_bo_util.c:500:16: warning: assignment to 'void *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
     500 |    vaddr_iomem = ioremap_cache(mem->bus.offset,
         |                ^
   cc1: some warnings being treated as errors


vim +95 drivers/gpu/drm/ttm/ttm_bo_util.c

    74	
    75	static int ttm_resource_ioremap(struct ttm_bo_device *bdev,
    76				       struct ttm_resource *mem,
    77				       void **virtual)
    78	{
    79		int ret;
    80		void *addr;
    81	
    82		*virtual = NULL;
    83		ret = ttm_mem_io_reserve(bdev, mem);
    84		if (ret || !mem->bus.is_iomem)
    85			return ret;
    86	
    87		if (mem->bus.addr) {
    88			addr = mem->bus.addr;
    89		} else {
    90			size_t bus_size = (size_t)mem->num_pages << PAGE_SHIFT;
    91	
    92			if (mem->bus.caching == ttm_write_combined)
    93				addr = ioremap_wc(mem->bus.offset, bus_size);
    94			else if (mem->bus.caching == ttm_cached)
  > 95				addr = ioremap_cache(mem->bus.offset, bus_size);
    96			else
    97				addr = ioremap(mem->bus.offset, bus_size);
    98			if (!addr) {
    99				ttm_mem_io_free(bdev, mem);
   100				return -ENOMEM;
   101			}
   102		}
   103		*virtual = addr;
   104		return 0;
   105	}
   106	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 25858 bytes --]

[-- Attachment #3: Type: text/plain, Size: 154 bytes --]

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply	[flat|nested] 49+ messages in thread

* Re: [PATCH] drm/ttm: ioremap buffer according to TTM mem caching setting
@ 2021-03-02  2:16   ` kernel test robot
  0 siblings, 0 replies; 49+ messages in thread
From: kernel test robot @ 2021-03-02  2:16 UTC (permalink / raw)
  To: kbuild-all

[-- Attachment #1: Type: text/plain, Size: 4046 bytes --]

Hi Oak,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on drm-intel/for-linux-next]
[also build test WARNING on drm-tip/drm-tip linus/master v5.12-rc1 next-20210301]
[cannot apply to tegra-drm/drm/tegra/for-next drm-exynos/exynos-drm-next drm/drm-next]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Oak-Zeng/drm-ttm-ioremap-buffer-according-to-TTM-mem-caching-setting/20210302-064500
base:   git://anongit.freedesktop.org/drm-intel for-linux-next
config: parisc-randconfig-r012-20210302 (attached as .config)
compiler: hppa-linux-gcc (GCC) 9.3.0
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # https://github.com/0day-ci/linux/commit/225bb3711439ec559dd72ae5af8e62d34ea60a64
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Oak-Zeng/drm-ttm-ioremap-buffer-according-to-TTM-mem-caching-setting/20210302-064500
        git checkout 225bb3711439ec559dd72ae5af8e62d34ea60a64
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=parisc 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All warnings (new ones prefixed by >>):

   drivers/gpu/drm/ttm/ttm_bo_util.c: In function 'ttm_resource_ioremap':
   drivers/gpu/drm/ttm/ttm_bo_util.c:95:11: error: implicit declaration of function 'ioremap_cache'; did you mean 'ioremap_uc'? [-Werror=implicit-function-declaration]
      95 |    addr = ioremap_cache(mem->bus.offset, bus_size);
         |           ^~~~~~~~~~~~~
         |           ioremap_uc
>> drivers/gpu/drm/ttm/ttm_bo_util.c:95:9: warning: assignment to 'void *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
      95 |    addr = ioremap_cache(mem->bus.offset, bus_size);
         |         ^
   drivers/gpu/drm/ttm/ttm_bo_util.c: In function 'ttm_bo_ioremap':
   drivers/gpu/drm/ttm/ttm_bo_util.c:379:17: warning: assignment to 'void *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
     379 |    map->virtual = ioremap_cache(bo->mem.bus.offset + offset,
         |                 ^
   drivers/gpu/drm/ttm/ttm_bo_util.c: In function 'ttm_bo_vmap':
   drivers/gpu/drm/ttm/ttm_bo_util.c:500:16: warning: assignment to 'void *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
     500 |    vaddr_iomem = ioremap_cache(mem->bus.offset,
         |                ^
   cc1: some warnings being treated as errors


vim +95 drivers/gpu/drm/ttm/ttm_bo_util.c

    74	
    75	static int ttm_resource_ioremap(struct ttm_bo_device *bdev,
    76				       struct ttm_resource *mem,
    77				       void **virtual)
    78	{
    79		int ret;
    80		void *addr;
    81	
    82		*virtual = NULL;
    83		ret = ttm_mem_io_reserve(bdev, mem);
    84		if (ret || !mem->bus.is_iomem)
    85			return ret;
    86	
    87		if (mem->bus.addr) {
    88			addr = mem->bus.addr;
    89		} else {
    90			size_t bus_size = (size_t)mem->num_pages << PAGE_SHIFT;
    91	
    92			if (mem->bus.caching == ttm_write_combined)
    93				addr = ioremap_wc(mem->bus.offset, bus_size);
    94			else if (mem->bus.caching == ttm_cached)
  > 95				addr = ioremap_cache(mem->bus.offset, bus_size);
    96			else
    97				addr = ioremap(mem->bus.offset, bus_size);
    98			if (!addr) {
    99				ttm_mem_io_free(bdev, mem);
   100				return -ENOMEM;
   101			}
   102		}
   103		*virtual = addr;
   104		return 0;
   105	}
   106	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 25858 bytes --]

^ permalink raw reply	[flat|nested] 49+ messages in thread

* [PATCH] drm/ttm: ioremap buffer according to TTM mem caching setting
@ 2021-03-01 22:43 ` Oak Zeng
  0 siblings, 0 replies; 49+ messages in thread
From: Oak Zeng @ 2021-03-01 22:43 UTC (permalink / raw)
  To: amd-gfx, dri-devel
  Cc: Felix.Kuehling, harish.kasiviswanathan, christian.koenig,
	jinhuieric.huang, Alexander.Deucher, Oak Zeng

If tbo.mem.bus.caching is cached, buffer is intended to be mapped
as cached from CPU. Map it with ioremap_cache.

This wasn't necessary before as device memory was never mapped
as cached from CPU side. It becomes necessary for aldebaran as
device memory is mapped cached from CPU.

Signed-off-by: Oak Zeng <Oak.Zeng@amd.com>
Reviewed-by: Christian Konig <Christian.Koenig@amd.com>
---
 drivers/gpu/drm/ttm/ttm_bo_util.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/drivers/gpu/drm/ttm/ttm_bo_util.c b/drivers/gpu/drm/ttm/ttm_bo_util.c
index 031e581..8c65a13 100644
--- a/drivers/gpu/drm/ttm/ttm_bo_util.c
+++ b/drivers/gpu/drm/ttm/ttm_bo_util.c
@@ -91,6 +91,8 @@ static int ttm_resource_ioremap(struct ttm_device *bdev,
 
 		if (mem->bus.caching == ttm_write_combined)
 			addr = ioremap_wc(mem->bus.offset, bus_size);
+		else if (mem->bus.caching == ttm_cached)
+			addr = ioremap_cache(mem->bus.offset, bus_size);
 		else
 			addr = ioremap(mem->bus.offset, bus_size);
 		if (!addr) {
@@ -372,6 +374,9 @@ static int ttm_bo_ioremap(struct ttm_buffer_object *bo,
 		if (mem->bus.caching == ttm_write_combined)
 			map->virtual = ioremap_wc(bo->mem.bus.offset + offset,
 						  size);
+		else if (mem->bus.caching == ttm_cached)
+			map->virtual = ioremap_cache(bo->mem.bus.offset + offset,
+						  size);
 		else
 			map->virtual = ioremap(bo->mem.bus.offset + offset,
 					       size);
@@ -490,6 +495,9 @@ int ttm_bo_vmap(struct ttm_buffer_object *bo, struct dma_buf_map *map)
 		else if (mem->bus.caching == ttm_write_combined)
 			vaddr_iomem = ioremap_wc(mem->bus.offset,
 						 bo->base.size);
+		else if (mem->bus.caching == ttm_cached)
+			vaddr_iomem = ioremap_cache(mem->bus.offset,
+						  bo->base.size);
 		else
 			vaddr_iomem = ioremap(mem->bus.offset, bo->base.size);
 
-- 
2.7.4

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

^ permalink raw reply related	[flat|nested] 49+ messages in thread

* [PATCH] drm/ttm: ioremap buffer according to TTM mem caching setting
@ 2021-03-01 22:43 ` Oak Zeng
  0 siblings, 0 replies; 49+ messages in thread
From: Oak Zeng @ 2021-03-01 22:43 UTC (permalink / raw)
  To: amd-gfx, dri-devel
  Cc: Felix.Kuehling, harish.kasiviswanathan, christian.koenig,
	jinhuieric.huang, Alexander.Deucher, Oak Zeng

If tbo.mem.bus.caching is cached, buffer is intended to be mapped
as cached from CPU. Map it with ioremap_cache.

This wasn't necessary before as device memory was never mapped
as cached from CPU side. It becomes necessary for aldebaran as
device memory is mapped cached from CPU.

Signed-off-by: Oak Zeng <Oak.Zeng@amd.com>
Reviewed-by: Christian Konig <Christian.Koenig@amd.com>
---
 drivers/gpu/drm/ttm/ttm_bo_util.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/drivers/gpu/drm/ttm/ttm_bo_util.c b/drivers/gpu/drm/ttm/ttm_bo_util.c
index 031e581..8c65a13 100644
--- a/drivers/gpu/drm/ttm/ttm_bo_util.c
+++ b/drivers/gpu/drm/ttm/ttm_bo_util.c
@@ -91,6 +91,8 @@ static int ttm_resource_ioremap(struct ttm_device *bdev,
 
 		if (mem->bus.caching == ttm_write_combined)
 			addr = ioremap_wc(mem->bus.offset, bus_size);
+		else if (mem->bus.caching == ttm_cached)
+			addr = ioremap_cache(mem->bus.offset, bus_size);
 		else
 			addr = ioremap(mem->bus.offset, bus_size);
 		if (!addr) {
@@ -372,6 +374,9 @@ static int ttm_bo_ioremap(struct ttm_buffer_object *bo,
 		if (mem->bus.caching == ttm_write_combined)
 			map->virtual = ioremap_wc(bo->mem.bus.offset + offset,
 						  size);
+		else if (mem->bus.caching == ttm_cached)
+			map->virtual = ioremap_cache(bo->mem.bus.offset + offset,
+						  size);
 		else
 			map->virtual = ioremap(bo->mem.bus.offset + offset,
 					       size);
@@ -490,6 +495,9 @@ int ttm_bo_vmap(struct ttm_buffer_object *bo, struct dma_buf_map *map)
 		else if (mem->bus.caching == ttm_write_combined)
 			vaddr_iomem = ioremap_wc(mem->bus.offset,
 						 bo->base.size);
+		else if (mem->bus.caching == ttm_cached)
+			vaddr_iomem = ioremap_cache(mem->bus.offset,
+						  bo->base.size);
 		else
 			vaddr_iomem = ioremap(mem->bus.offset, bo->base.size);
 
-- 
2.7.4

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply related	[flat|nested] 49+ messages in thread

end of thread, other threads:[~2021-03-11 13:06 UTC | newest]

Thread overview: 49+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-03 21:12 [PATCH] drm/ttm: ioremap buffer according to TTM mem caching setting Oak Zeng
2021-03-03 21:12 ` Oak Zeng
2021-03-04  7:48 ` Christian König
2021-03-04  7:48   ` Christian König
  -- strict thread matches above, loose matches on Subject: below --
2021-03-04 19:16 Oak Zeng
2021-03-04 16:04 Oak Zeng
2021-03-04 16:04 ` Oak Zeng
2021-03-04 17:01 ` Bhardwaj, Rajneesh
2021-03-04 17:01   ` Bhardwaj, Rajneesh
2021-03-04 17:31   ` Christian König
2021-03-04 17:31     ` Christian König
2021-03-04 17:40     ` Bhardwaj, Rajneesh
2021-03-04 17:40       ` Bhardwaj, Rajneesh
2021-03-04 18:05       ` Christian König
2021-03-04 18:05         ` Christian König
2021-03-04 19:00 ` kernel test robot
2021-03-04 19:00   ` kernel test robot
2021-03-04 19:04 ` kernel test robot
2021-03-04 19:04   ` kernel test robot
2021-03-01 22:43 Oak Zeng
2021-03-01 22:43 ` Oak Zeng
2021-03-02  2:16 ` kernel test robot
2021-03-02  2:16   ` kernel test robot
2021-03-02  2:16   ` kernel test robot
2021-03-02  4:12 ` kernel test robot
2021-03-02  4:12   ` kernel test robot
2021-03-02  4:12   ` kernel test robot
2021-03-02 11:31   ` Christian König
2021-03-02 11:31     ` Christian König
2021-03-02 22:45     ` Zeng, Oak
2021-03-02 22:45       ` Zeng, Oak
2021-03-02 22:53       ` Dave Airlie
2021-03-02 22:53         ` Dave Airlie
2021-03-02 22:53         ` Dave Airlie
2021-03-03 10:45       ` Christian König
2021-03-03 10:45         ` Christian König
2021-03-03 20:59         ` Zeng, Oak
2021-03-03 20:59           ` Zeng, Oak
2021-03-04  7:46           ` Christian König
2021-03-04  7:46             ` Christian König
2021-03-11 13:06             ` Daniel Vetter
2021-03-11 13:06               ` Daniel Vetter
2021-03-11 13:06               ` Daniel Vetter
2021-03-03 20:59         ` Zeng, Oak
2021-03-02 22:45     ` Zeng, Oak
2021-03-03  8:49 ` Thomas Zimmermann
2021-03-03  8:49   ` Thomas Zimmermann
2021-03-03 10:37   ` Christian König
2021-03-03 10:37     ` Christian König

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.