<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:DengXian;
        panose-1:2 1 6 0 3 1 1 1 1 1;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Consolas;
        panose-1:2 11 6 9 2 2 4 3 2 4;}
@font-face
        {font-family:"\@DengXian";
        panose-1:2 1 6 0 3 1 1 1 1 1;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
pre
        {mso-style-priority:99;
        mso-style-link:"HTML Preformatted Char";
        margin:0in;
        margin-bottom:.0001pt;
        font-size:10.0pt;
        font-family:"Courier New";}
span.HTMLPreformattedChar
        {mso-style-name:"HTML Preformatted Char";
        mso-style-priority:99;
        mso-style-link:"HTML Preformatted";
        font-family:Consolas;}
span.EmailStyle20
        {mso-style-type:personal-reply;
        font-family:"Calibri",sans-serif;
        color:windowtext;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="EN-US" link="blue" vlink="purple" style="word-wrap:break-word">
<p style="font-family:Arial;font-size:11pt;color:#0078D7;margin:5pt;" align="Left">
[AMD Official Use Only - Internal Distribution Only]<br>
</p>
<br>
<div>
<div class="WordSection1">
<p class="MsoNormal">Hi Daniel, Thomas, Dan,<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">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?<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Are we supposed to use memremap (offset, size, MEMREMAP_WB) to replace ioremap_cache? When I read here
<a href="https://lwn.net/Articles/653585/">https://lwn.net/Articles/653585/</a> 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.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">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.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<p class="MsoNormal">Regards,<o:p></o:p></p>
<p class="MsoNormal">Oak<o:p></o:p></p>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<div style="border:none;border-left:solid blue 1.5pt;padding:0in 0in 0in 4.0pt">
<div>
<div style="border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal"><b>From:</b> Christian König <ckoenig.leichtzumerken@gmail.com>
<br>
<b>Sent:</b> Tuesday, March 2, 2021 6:31 AM<br>
<b>To:</b> 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><br>
<b>Cc:</b> 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><br>
<b>Subject:</b> Re: [PATCH] drm/ttm: ioremap buffer according to TTM mem caching setting<o:p></o:p></p>
</div>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal" style="margin-bottom:12.0pt">Hi guys,<br>
<br>
adding the usual suspects direct. Does anybody of hand know how to check if an architecture supports ioremap_cache()?<br>
<br>
For now we only need this on X86, but I would feel better if we don't use an #ifdef here.<br>
<br>
Regards,<br>
Christian.<o:p></o:p></p>
<div>
<p class="MsoNormal">Am 02.03.21 um 05:12 schrieb kernel test robot:<o:p></o:p></p>
</div>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<pre>Hi Oak,<o:p></o:p></pre>
<pre><o:p> </o:p></pre>
<pre>Thank you for the patch! Yet something to improve:<o:p></o:p></pre>
<pre><o:p> </o:p></pre>
<pre>[auto build test ERROR on drm-intel/for-linux-next]<o:p></o:p></pre>
<pre>[also build test ERROR on drm-tip/drm-tip linus/master v5.12-rc1 next-20210302]<o:p></o:p></pre>
<pre>[cannot apply to tegra-drm/drm/tegra/for-next drm-exynos/exynos-drm-next drm/drm-next]<o:p></o:p></pre>
<pre>[If your patch is applied to the wrong git tree, kindly drop us a note.<o:p></o:p></pre>
<pre>And when submitting patch, we suggest to use '--base' as documented in<o:p></o:p></pre>
<pre><a href="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">https://git-scm.com/docs/git-format-patch</a>]<o:p></o:p></pre>
<pre><o:p> </o:p></pre>
<pre>url:    <a href="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">https://github.com/0day-ci/linux/commits/Oak-Zeng/drm-ttm-ioremap-buffer-according-to-TTM-mem-caching-setting/20210302-064500</a><o:p></o:p></pre>
<pre>base:   git://anongit.freedesktop.org/drm-intel for-linux-next<o:p></o:p></pre>
<pre>config: parisc-randconfig-r012-20210302 (attached as .config)<o:p></o:p></pre>
<pre>compiler: hppa-linux-gcc (GCC) 9.3.0<o:p></o:p></pre>
<pre>reproduce (this is a W=1 build):<o:p></o:p></pre>
<pre>        wget <a href="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">https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross</a> -O ~/bin/make.cross<o:p></o:p></pre>
<pre>        chmod +x ~/bin/make.cross<o:p></o:p></pre>
<pre>        # <a href="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">https://github.com/0day-ci/linux/commit/225bb3711439ec559dd72ae5af8e62d34ea60a64</a><o:p></o:p></pre>
<pre>        git remote add linux-review <a href="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">https://github.com/0day-ci/linux</a><o:p></o:p></pre>
<pre>        git fetch --no-tags linux-review Oak-Zeng/drm-ttm-ioremap-buffer-according-to-TTM-mem-caching-setting/20210302-064500<o:p></o:p></pre>
<pre>        git checkout 225bb3711439ec559dd72ae5af8e62d34ea60a64<o:p></o:p></pre>
<pre>        # save the attached .config to linux build tree<o:p></o:p></pre>
<pre>        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=parisc <o:p></o:p></pre>
<pre><o:p> </o:p></pre>
<pre>If you fix the issue, kindly add following tag as appropriate<o:p></o:p></pre>
<pre>Reported-by: kernel test robot <a href="mailto:lkp@intel.com"><lkp@intel.com></a><o:p></o:p></pre>
<pre><o:p> </o:p></pre>
<pre>All errors (new ones prefixed by >>):<o:p></o:p></pre>
<pre><o:p> </o:p></pre>
<pre>   drivers/gpu/drm/ttm/ttm_bo_util.c: In function 'ttm_resource_ioremap':<o:p></o:p></pre>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<pre>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]<o:p></o:p></pre>
</blockquote>
</blockquote>
<pre>      95 |    addr = ioremap_cache(mem->bus.offset, bus_size);<o:p></o:p></pre>
<pre>         |           ^~~~~~~~~~~~~<o:p></o:p></pre>
<pre>         |           ioremap_uc<o:p></o:p></pre>
<pre>   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]<o:p></o:p></pre>
<pre>      95 |    addr = ioremap_cache(mem->bus.offset, bus_size);<o:p></o:p></pre>
<pre>         |         ^<o:p></o:p></pre>
<pre>   drivers/gpu/drm/ttm/ttm_bo_util.c: In function 'ttm_bo_ioremap':<o:p></o:p></pre>
<pre>   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]<o:p></o:p></pre>
<pre>     379 |    map->virtual = ioremap_cache(bo->mem.bus.offset + offset,<o:p></o:p></pre>
<pre>         |                 ^<o:p></o:p></pre>
<pre>   drivers/gpu/drm/ttm/ttm_bo_util.c: In function 'ttm_bo_vmap':<o:p></o:p></pre>
<pre>   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]<o:p></o:p></pre>
<pre>     500 |    vaddr_iomem = ioremap_cache(mem->bus.offset,<o:p></o:p></pre>
<pre>         |                ^<o:p></o:p></pre>
<pre>   cc1: some warnings being treated as errors<o:p></o:p></pre>
<pre><o:p> </o:p></pre>
<pre><o:p> </o:p></pre>
<pre>vim +95 drivers/gpu/drm/ttm/ttm_bo_util.c<o:p></o:p></pre>
<pre><o:p> </o:p></pre>
<pre>    74  <o:p></o:p></pre>
<pre>    75  static int ttm_resource_ioremap(struct ttm_bo_device *bdev,<o:p></o:p></pre>
<pre>    76                                struct ttm_resource *mem,<o:p></o:p></pre>
<pre>    77                                void **virtual)<o:p></o:p></pre>
<pre>    78  {<o:p></o:p></pre>
<pre>    79          int ret;<o:p></o:p></pre>
<pre>    80          void *addr;<o:p></o:p></pre>
<pre>    81  <o:p></o:p></pre>
<pre>    82          *virtual = NULL;<o:p></o:p></pre>
<pre>    83          ret = ttm_mem_io_reserve(bdev, mem);<o:p></o:p></pre>
<pre>    84          if (ret || !mem->bus.is_iomem)<o:p></o:p></pre>
<pre>    85                  return ret;<o:p></o:p></pre>
<pre>    86  <o:p></o:p></pre>
<pre>    87          if (mem->bus.addr) {<o:p></o:p></pre>
<pre>    88                  addr = mem->bus.addr;<o:p></o:p></pre>
<pre>    89          } else {<o:p></o:p></pre>
<pre>    90                  size_t bus_size = (size_t)mem->num_pages << PAGE_SHIFT;<o:p></o:p></pre>
<pre>    91  <o:p></o:p></pre>
<pre>    92                  if (mem->bus.caching == ttm_write_combined)<o:p></o:p></pre>
<pre>    93                         addr = ioremap_wc(mem->bus.offset, bus_size);<o:p></o:p></pre>
<pre>    94                  else if (mem->bus.caching == ttm_cached)<o:p></o:p></pre>
<pre>  > 95                         addr = ioremap_cache(mem->bus.offset, bus_size);<o:p></o:p></pre>
<pre>    96                  else<o:p></o:p></pre>
<pre>    97                         addr = ioremap(mem->bus.offset, bus_size);<o:p></o:p></pre>
<pre>    98                  if (!addr) {<o:p></o:p></pre>
<pre>    99                         ttm_mem_io_free(bdev, mem);<o:p></o:p></pre>
<pre>   100                         return -ENOMEM;<o:p></o:p></pre>
<pre>   101                  }<o:p></o:p></pre>
<pre>   102          }<o:p></o:p></pre>
<pre>   103          *virtual = addr;<o:p></o:p></pre>
<pre>   104          return 0;<o:p></o:p></pre>
<pre>   105  }<o:p></o:p></pre>
<pre>   106  <o:p></o:p></pre>
<pre><o:p> </o:p></pre>
<pre>---<o:p></o:p></pre>
<pre>0-DAY CI Kernel Test Service, Intel Corporation<o:p></o:p></pre>
<pre><a href="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">https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org</a><o:p></o:p></pre>
<p class="MsoNormal"><br>
<br>
<o:p></o:p></p>
<pre>_______________________________________________<o:p></o:p></pre>
<pre>amd-gfx mailing list<o:p></o:p></pre>
<pre><a href="mailto:amd-gfx@lists.freedesktop.org">amd-gfx@lists.freedesktop.org</a><o:p></o:p></pre>
<pre><a href="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">https://lists.freedesktop.org/mailman/listinfo/amd-gfx</a><o:p></o:p></pre>
</blockquote>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
</div>
</div>
</body>
</html>