All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Christian König" <ckoenig.leichtzumerken@gmail.com>
To: "Zeng, Oak" <Oak.Zeng@amd.com>,
	"amd-gfx@lists.freedesktop.org" <amd-gfx@lists.freedesktop.org>,
	"dri-devel@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" <dan.j.williams@intel.com>
Cc: "kbuild-all@lists.01.org" <kbuild-all@lists.01.org>,
	"Kuehling, Felix" <Felix.Kuehling@amd.com>,
	"Kasiviswanathan, Harish" <Harish.Kasiviswanathan@amd.com>,
	"Huang, JinHuiEric" <JinHuiEric.Huang@amd.com>,
	"Deucher, Alexander" <Alexander.Deucher@amd.com>,
	"Koenig, Christian" <Christian.Koenig@amd.com>
Subject: Re: [PATCH] drm/ttm: ioremap buffer according to TTM mem caching setting
Date: Thu, 4 Mar 2021 08:46:26 +0100	[thread overview]
Message-ID: <4fcb0d6d-3e44-c3b0-0c10-2b0a32932c8d@gmail.com> (raw)
In-Reply-To: <DM6PR12MB4732BD6E9C9C1AE00CD1713380989@DM6PR12MB4732.namprd12.prod.outlook.com>


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

WARNING: multiple messages have this Message-ID (diff)
From: "Christian König" <ckoenig.leichtzumerken@gmail.com>
To: "Zeng, Oak" <Oak.Zeng@amd.com>,
	"amd-gfx@lists.freedesktop.org" <amd-gfx@lists.freedesktop.org>,
	"dri-devel@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" <dan.j.williams@intel.com>
Cc: "kbuild-all@lists.01.org" <kbuild-all@lists.01.org>,
	"Kuehling, Felix" <Felix.Kuehling@amd.com>,
	"Kasiviswanathan, Harish" <Harish.Kasiviswanathan@amd.com>,
	"Huang, JinHuiEric" <JinHuiEric.Huang@amd.com>,
	"Deucher, Alexander" <Alexander.Deucher@amd.com>,
	"Koenig, Christian" <Christian.Koenig@amd.com>
Subject: Re: [PATCH] drm/ttm: ioremap buffer according to TTM mem caching setting
Date: Thu, 4 Mar 2021 08:46:26 +0100	[thread overview]
Message-ID: <4fcb0d6d-3e44-c3b0-0c10-2b0a32932c8d@gmail.com> (raw)
In-Reply-To: <DM6PR12MB4732BD6E9C9C1AE00CD1713380989@DM6PR12MB4732.namprd12.prod.outlook.com>


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

  reply	other threads:[~2021-03-04  7:46 UTC|newest]

Thread overview: 49+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-01 22:43 [PATCH] drm/ttm: ioremap buffer according to TTM mem caching setting 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 [this message]
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
2021-03-03 21:12 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
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-04 19:16 Oak Zeng

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4fcb0d6d-3e44-c3b0-0c10-2b0a32932c8d@gmail.com \
    --to=ckoenig.leichtzumerken@gmail.com \
    --cc=Alexander.Deucher@amd.com \
    --cc=Christian.Koenig@amd.com \
    --cc=Felix.Kuehling@amd.com \
    --cc=Harish.Kasiviswanathan@amd.com \
    --cc=JinHuiEric.Huang@amd.com \
    --cc=Oak.Zeng@amd.com \
    --cc=airlied@redhat.com \
    --cc=amd-gfx@lists.freedesktop.org \
    --cc=dan.j.williams@intel.com \
    --cc=daniel@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=kbuild-all@lists.01.org \
    --cc=thomas_os@shipmail.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.