Content-Type: multipart/mixed; boundary="===============7701119963872394157==" MIME-Version: 1.0 From: Daniel Vetter To: kbuild-all@lists.01.org Subject: Re: [PATCH] drm/ttm: ioremap buffer according to TTM mem caching setting Date: Thu, 11 Mar 2021 14:06:05 +0100 Message-ID: In-Reply-To: <4fcb0d6d-3e44-c3b0-0c10-2b0a32932c8d@gmail.com> List-Id: --===============7701119963872394157== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable On Thu, Mar 04, 2021 at 08:46:26AM +0100, Christian K=C3=B6nig 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 t= he > __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=E2=80=99t 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=C3=B6nig > > *Sent:* Wednesday, March 3, 2021 5:46 AM > > *To:* Zeng, Oak ; amd-gfx(a)lists.freedesktop.org; > > dri-devel(a)lists.freedesktop.org; Daniel Vetter ; D= ave > > Airlie ; Thomas Hellstr=C3=B6m (Intel) > > ; dan.j.williams(a)intel.com > > *Cc:* kbuild-all(a)lists.01.org; Kuehling, Felix ; > > Kasiviswanathan, Harish ; Deucher, > > Alexander ; Huang, JinHuiEric > > ; Koenig, Christian > > *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=E2= =80=99s > > driver build? I can see both ioremap_cache and ioremap_wc are > > defined in arch/x86/mm/ioremap.c =E2=80=93 why ioremap_wc doesn=E2= =80=99t break > > intel driver=E2=80=99s 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=C3=B6nig > > > > *Sent:* Tuesday, March 2, 2021 6:31 AM > > *To:* amd-gfx(a)lists.freedesktop.org > > ; > > dri-devel(a)lists.freedesktop.org > > ; Daniel Vetter > > ; Dave Airlie > > ; Thomas Hellst= r=C3=B6m > > (Intel) > > *Cc:* Zeng, Oak ; > > kbuild-all(a)lists.01.org ; > > Kuehling, Felix > > ; Kasiviswanathan, Harish > > > > ; Deucher, Alexander > > ; > > Huang, JinHuiEric > > ; Koenig, Christian > > > > *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-rc= 1 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 docume= nted in > > = > > https://git-scm.com/docs/git-format-patch ] > > = > > = > > url:https://github.com/0day-ci/linux/commits/Oak-Zeng/drm-ttm-i= oremap-buffer-according-to-TTM-mem-caching-setting/20210302-064500 > > = > > base:=C2=A0=C2=A0 git://anongit.freedesktop.org/drm-intel for-l= inux-next > > = > > config: parisc-randconfig-r012-20210302 (attached as .config) > > = > > compiler: hppa-linux-gcc (GCC) 9.3.0 > > = > > reproduce (this is a W=3D1 build): > > = > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 wgethttps://raw.git= hubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross > > = > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 chmod +x ~/bin/make= .cross > > = > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 #https://github.com= /0day-ci/linux/commit/225bb3711439ec559dd72ae5af8e62d34ea60a64 > > = > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 git remote add linu= x-reviewhttps://github.com/0day-ci/linux > > = > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 git fetch --no-tags= linux-review Oak-Zeng/drm-ttm-ioremap-buffer-according-to-TTM-mem-caching-= setting/20210302-064500 > > = > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 git checkout 225bb3= 711439ec559dd72ae5af8e62d34ea60a64 > > = > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 # save the attached= .config to linux build tree > > = > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 COMPILER_INSTALL_PA= TH=3D$HOME/0day COMPILER=3Dgcc-9.3.0 make.cross ARCH=3Dparisc > > = > > = > > If you fix the issue, kindly add following tag as appropriate > > = > > Reported-by: kernel test robot > > = > > = > > All errors (new ones prefixed by >>): > > = > > = > > =C2=A0=C2=A0 drivers/gpu/drm/ttm/ttm_bo_util.c: In function 't= tm_resource_ioremap': > > = > > drivers/gpu/drm/ttm/ttm_bo_util.c:95:11: error: implici= t declaration of function 'ioremap_cache'; did you mean 'ioremap_uc'? [-Wer= ror=3Dimplicit-function-declaration] > > = > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 95 |=C2=A0=C2=A0=C2=A0 addr =3D= ioremap_cache(mem->bus.offset, bus_size); > > = > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 |=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 ^~~~~~~~~~~~~ > > = > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 |=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 ioremap_uc > > = > > =C2=A0=C2=A0 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] > > = > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 95 |=C2=A0=C2=A0=C2=A0 addr =3D= ioremap_cache(mem->bus.offset, bus_size); > > = > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 |=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 ^ > > = > > =C2=A0=C2=A0 drivers/gpu/drm/ttm/ttm_bo_util.c: In function 't= tm_bo_ioremap': > > = > > =C2=A0=C2=A0 drivers/gpu/drm/ttm/ttm_bo_util.c:379:17: warning= : assignment to 'void *' from 'int' makes pointer from integer without a ca= st [-Wint-conversion] > > = > > =C2=A0=C2=A0=C2=A0=C2=A0 379 |=C2=A0=C2=A0=C2=A0 map->virtual = =3D ioremap_cache(bo->mem.bus.offset + offset, > > = > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 |=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0 ^ > > = > > =C2=A0=C2=A0 drivers/gpu/drm/ttm/ttm_bo_util.c: In function 't= tm_bo_vmap': > > = > > =C2=A0=C2=A0 drivers/gpu/drm/ttm/ttm_bo_util.c:500:16: warning= : assignment to 'void *' from 'int' makes pointer from integer without a ca= st [-Wint-conversion] > > = > > =C2=A0=C2=A0=C2=A0=C2=A0 500 |=C2=A0=C2=A0=C2=A0 vaddr_iomem = =3D ioremap_cache(mem->bus.offset, > > = > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 |=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0 ^ > > = > > =C2=A0=C2=A0 cc1: some warnings being treated as errors > > = > > = > > = > > vim +95 drivers/gpu/drm/ttm/ttm_bo_util.c > > = > > = > > =C2=A0=C2=A0=C2=A0 74 > > = > > =C2=A0=C2=A0=C2=A0 75=C2=A0 static int ttm_resource_ioremap(st= ruct ttm_bo_device *bdev, > > = > > =C2=A0=C2=A0=C2=A0 76=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 struct = ttm_resource *mem, > > = > > =C2=A0=C2=A0=C2=A0 77=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 void **= virtual) > > = > > =C2=A0=C2=A0=C2=A0 78=C2=A0 { > > = > > =C2=A0=C2=A0=C2=A0 79=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0 int ret; > > = > > =C2=A0=C2=A0=C2=A0 80=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0 void *addr; > > = > > =C2=A0=C2=A0=C2=A0 81 > > = > > =C2=A0=C2=A0=C2=A0 82=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0 *virtual =3D NULL; > > = > > =C2=A0=C2=A0=C2=A0 83=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0 ret =3D ttm_mem_io_reserve(bdev, mem); > > = > > =C2=A0=C2=A0=C2=A0 84=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0 if (ret || !mem->bus.is_iomem) > > = > > =C2=A0=C2=A0=C2=A0 85=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 return ret; > > = > > =C2=A0=C2=A0=C2=A0 86 > > = > > =C2=A0=C2=A0=C2=A0 87=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0 if (mem->bus.addr) { > > = > > =C2=A0=C2=A0=C2=A0 88=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 addr =3D me= m->bus.addr; > > = > > =C2=A0=C2=A0=C2=A0 89=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0 } else { > > = > > =C2=A0=C2=A0=C2=A0 90=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 size_t bus_= size =3D (size_t)mem->num_pages << PAGE_SHIFT; > > = > > =C2=A0=C2=A0=C2=A0 91 > > = > > =C2=A0=C2=A0=C2=A0 92=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 if (mem->bu= s.caching =3D=3D ttm_write_combined) > > = > > =C2=A0=C2=A0=C2=A0 93=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 addr =3D ioremap_wc(mem->bus.offset, bus_siz= e); > > = > > =C2=A0=C2=A0=C2=A0 94=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 else if (me= m->bus.caching =3D=3D ttm_cached) > > = > > =C2=A0 > 95=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0 addr =3D ioremap_cache(mem->bus.offset, bus_size); > > = > > =C2=A0=C2=A0=C2=A0 96=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 else > > = > > =C2=A0=C2=A0=C2=A0 97=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 addr =3D ioremap(mem->bus.offset, bus_size); > > = > > =C2=A0=C2=A0=C2=A0 98=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 if (!addr) { > > = > > =C2=A0=C2=A0=C2=A0 99=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 ttm_mem_io_free(bdev, mem); > > = > > =C2=A0=C2=A0 100=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0 return -ENOMEM; > > = > > =C2=A0=C2=A0 101=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 } > > = > > =C2=A0=C2=A0 102=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0 } > > = > > =C2=A0=C2=A0 103=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0 *virtual =3D addr; > > = > > =C2=A0=C2=A0 104=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0 return 0; > > = > > =C2=A0=C2=A0 105=C2=A0 } > > = > > =C2=A0=C2=A0 106 > > = > > = > > --- > > = > > 0-DAY CI Kernel Test Service, Intel Corporation > > = > > https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org = > > = > > = > > = > > = > > _______________________________________________ > > = > > amd-gfx mailing list > > = > > amd-gfx(a)lists.freedesktop.org > > = > > https://lists.freedesktop.org/mailman/listinfo/amd-gfx > > = > = -- = Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch --===============7701119963872394157==--