Skip to contentSkip to conversation

drm/ttm: Include <linux/vmalloc.h> to fix MIPS build

PATCH In review Thomas Zimmermann 2 participants 4 messages Jan 16, 2023 – Jan 17, 2023

Subsystems (3)
lore
Share & tools
lore

Thomas Zimmermann

author maintainer
#0 lore raw

PATCH 1/1 drm/ttm: Include <linux/vmalloc.h> to fix MIPS build

On MIPS, vmap() and vunmap() are undeclared in ttm_bo_util.c. An error message is shown below.

CC drivers/gpu/drm/ttm/ttm_bo_util.o
../drivers/gpu/drm/ttm/ttm_bo_util.c: In function 'ttm_bo_kmap_ttm':
../drivers/gpu/drm/ttm/ttm_bo_util.c:364:32: error: implicit declaration of function 'vmap'; did you mean 'kmap'? [-Werror=implicit-function-declaration]

    364 |                 map->virtual = vmap(ttm->pages + start_page, num_pages,
	|                                ^~~~
	|                                kmap
  ../drivers/gpu/drm/ttm/ttm_bo_util.c:364:30: warning: assignment to 'void *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
    364 |                 map->virtual = vmap(ttm->pages + start_page, num_pages,
	|                              ^
  ../drivers/gpu/drm/ttm/ttm_bo_util.c: In function 'ttm_bo_kunmap':
  ../drivers/gpu/drm/ttm/ttm_bo_util.c:429:17: error: implicit declaration of function 'vunmap'; did you mean 'kunmap'? [-Werror=implicit-function-declaration]
    429 |                 vunmap(map->virtual);
	|                 ^~~~~~
	|                 kunmap
  ../drivers/gpu/drm/ttm/ttm_bo_util.c: In function 'ttm_bo_vmap':
  ../drivers/gpu/drm/ttm/ttm_bo_util.c:509:23: warning: assignment to 'void *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
    509 |                 vaddr = vmap(ttm->pages, ttm->num_pages, 0, prot);
	|                       ^

Fix this by including <linux/vmalloc.h>.

---
 drivers/gpu/drm/ttm/ttm_bo_util.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/gpu/drm/ttm/ttm_bo_util.c +2 -0
index 12017ec24d9f..8e19a40cb41d 100644
@@ -29,6 +29,8 @@
  * Authors: Thomas Hellstrom <thellstrom-at-vmware-dot-com>
  */
 
+#include <linux/vmalloc.h>
+
 #include <drm/ttm/ttm_bo.h>
 #include <drm/ttm/ttm_placement.h>
 #include <drm/ttm/ttm_tt.h>
Signature · 1 line
2.39.0
author maintainer
#1 lore raw

I'd add a Fixes tag, but don't know the commit when this was introduced.

Am 16.01.23 um 13:10 schrieb Thomas Zimmermann:

Quoted 42 lines

On MIPS, vmap() and vunmap() are undeclared in ttm_bo_util.c. An error message is shown below.

CC drivers/gpu/drm/ttm/ttm_bo_util.o
../drivers/gpu/drm/ttm/ttm_bo_util.c: In function 'ttm_bo_kmap_ttm':
../drivers/gpu/drm/ttm/ttm_bo_util.c:364:32: error: implicit declaration of function 'vmap'; did you mean 'kmap'? [-Werror=implicit-function-declaration]

     364 |                 map->virtual = vmap(ttm->pages + start_page, num_pages,
	|                                ^~~~
	|                                kmap
   ../drivers/gpu/drm/ttm/ttm_bo_util.c:364:30: warning: assignment to 'void *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
     364 |                 map->virtual = vmap(ttm->pages + start_page, num_pages,
	|                              ^
   ../drivers/gpu/drm/ttm/ttm_bo_util.c: In function 'ttm_bo_kunmap':
   ../drivers/gpu/drm/ttm/ttm_bo_util.c:429:17: error: implicit declaration of function 'vunmap'; did you mean 'kunmap'? [-Werror=implicit-function-declaration]
     429 |                 vunmap(map->virtual);
	|                 ^~~~~~
	|                 kunmap
   ../drivers/gpu/drm/ttm/ttm_bo_util.c: In function 'ttm_bo_vmap':
   ../drivers/gpu/drm/ttm/ttm_bo_util.c:509:23: warning: assignment to 'void *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
     509 |                 vaddr = vmap(ttm->pages, ttm->num_pages, 0, prot);
	|                       ^

Fix this by including <linux/vmalloc.h>.

---
  drivers/gpu/drm/ttm/ttm_bo_util.c | 2 ++
  1 file changed, 2 insertions(+)
drivers/gpu/drm/ttm/ttm_bo_util.c +2 -0
index 12017ec24d9f..8e19a40cb41d 100644
@@ -29,6 +29,8 @@
   * Authors: Thomas Hellstrom <thellstrom-at-vmware-dot-com>
   */
 
+#include <linux/vmalloc.h>
+
  #include <drm/ttm/ttm_bo.h>
  #include <drm/ttm/ttm_placement.h>
  #include <drm/ttm/ttm_tt.h>
Signature · 6 lines
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Maxfeldstr. 5, 90409 Nürnberg, Germany
(HRB 36809, AG Nürnberg)
Geschäftsführer: Ivo Totev
#2 lore raw

Am 16.01.23 um 13:13 schrieb Thomas Zimmermann:

Quoted 1 line

I'd add a Fixes tag, but don't know the commit when this was introduced.

Mhm, that code is 10+ years old. My educated guess is that we somehow pulled in vmap/vunmap through a header which was now cleaned up.

Anyway your patch looks good to me, feel free to add my rb.

Christian.

Quoted 44 lines

Am 16.01.23 um 13:10 schrieb Thomas Zimmermann:

Quoted 41 lines

On MIPS, vmap() and vunmap() are undeclared in ttm_bo_util.c. An error message is shown below.

   CC      drivers/gpu/drm/ttm/ttm_bo_util.o
   ../drivers/gpu/drm/ttm/ttm_bo_util.c: In function 'ttm_bo_kmap_ttm':
   ../drivers/gpu/drm/ttm/ttm_bo_util.c:364:32: error: implicit declaration of function 'vmap'; did you mean 'kmap'? [-Werror=implicit-function-declaration] 364 |                 map->virtual = vmap(ttm->pages + start_page, num_pages,
    |                                ^~~~
    |                                kmap
   ../drivers/gpu/drm/ttm/ttm_bo_util.c:364:30: warning: assignment to 'void *' from 'int' makes pointer from integer without a cast [-Wint-conversion] 364 |                 map->virtual = vmap(ttm->pages + start_page, num_pages,
    |                              ^
   ../drivers/gpu/drm/ttm/ttm_bo_util.c: In function 'ttm_bo_kunmap':
   ../drivers/gpu/drm/ttm/ttm_bo_util.c:429:17: error: implicit declaration of function 'vunmap'; did you mean 'kunmap'? [-Werror=implicit-function-declaration] 429 |                 vunmap(map->virtual);
    |                 ^~~~~~
    |                 kunmap
   ../drivers/gpu/drm/ttm/ttm_bo_util.c: In function 'ttm_bo_vmap':
   ../drivers/gpu/drm/ttm/ttm_bo_util.c:509:23: warning: assignment to 'void *' from 'int' makes pointer from integer without a cast [-Wint-conversion] 509 |                 vaddr = vmap(ttm->pages, ttm->num_pages, 0, prot);
    |                       ^

Fix this by including <linux/vmalloc.h>.

---
  drivers/gpu/drm/ttm/ttm_bo_util.c | 2 ++

  1 file changed, 2 insertions(+)
drivers/gpu/drm/ttm/ttm_bo_util.c +0 -0
index 12017ec24d9f..8e19a40cb41d 100644
@@ -29,6 +29,8 @@
    * Authors: Thomas Hellstrom <thellstrom-at-vmware-dot-com>
    */

  +#include <linux/vmalloc.h>
+
  #include <drm/ttm/ttm_bo.h>
  #include <drm/ttm/ttm_placement.h>
  #include <drm/ttm/ttm_tt.h>

author maintainer
#3 lore raw

Hi

Am 16.01.23 um 15:40 schrieb Christian König:

Quoted 4 lines

Am 16.01.23 um 13:13 schrieb Thomas Zimmermann:

Quoted 1 line

I'd add a Fixes tag, but don't know the commit when this was introduced.

Mhm, that code is 10+ years old. My educated guess is that we somehow pulled in vmap/vunmap through a header which was now cleaned up.

Yeah, I assume it was introduced by a3185f91d057 ("drm/ttm: merge ttm_bo_api.h and ttm_bo_driver.h v2")

Quoted 2 lines

Anyway your patch looks good to me, feel free to add my rb.

Thank you. Merged into drm-misc-next now.

Best regards
Thomas

Quoted 48 lines

Christian.

Quoted 44 lines

Am 16.01.23 um 13:10 schrieb Thomas Zimmermann:

Quoted 41 lines

On MIPS, vmap() and vunmap() are undeclared in ttm_bo_util.c. An error message is shown below.

   CC      drivers/gpu/drm/ttm/ttm_bo_util.o
   ../drivers/gpu/drm/ttm/ttm_bo_util.c: In function 'ttm_bo_kmap_ttm':
   ../drivers/gpu/drm/ttm/ttm_bo_util.c:364:32: error: implicit declaration of function 'vmap'; did you mean 'kmap'? [-Werror=implicit-function-declaration] 364 |                 map->virtual = vmap(ttm->pages + start_page, num_pages,
    |                                ^~~~
    |                                kmap
   ../drivers/gpu/drm/ttm/ttm_bo_util.c:364:30: warning: assignment to 'void *' from 'int' makes pointer from integer without a cast [-Wint-conversion] 364 |                 map->virtual = vmap(ttm->pages + start_page, num_pages,
    |                              ^
   ../drivers/gpu/drm/ttm/ttm_bo_util.c: In function 'ttm_bo_kunmap':
   ../drivers/gpu/drm/ttm/ttm_bo_util.c:429:17: error: implicit declaration of function 'vunmap'; did you mean 'kunmap'? [-Werror=implicit-function-declaration] 429 |                 vunmap(map->virtual);
    |                 ^~~~~~
    |                 kunmap
   ../drivers/gpu/drm/ttm/ttm_bo_util.c: In function 'ttm_bo_vmap':
   ../drivers/gpu/drm/ttm/ttm_bo_util.c:509:23: warning: assignment to 'void *' from 'int' makes pointer from integer without a cast [-Wint-conversion] 509 |                 vaddr = vmap(ttm->pages, ttm->num_pages, 0, prot);
    |                       ^

Fix this by including <linux/vmalloc.h>.

---
  drivers/gpu/drm/ttm/ttm_bo_util.c | 2 ++

  1 file changed, 2 insertions(+)
drivers/gpu/drm/ttm/ttm_bo_util.c +0 -0
index 12017ec24d9f..8e19a40cb41d 100644
@@ -29,6 +29,8 @@
    * Authors: Thomas Hellstrom <thellstrom-at-vmware-dot-com>
    */

  +#include <linux/vmalloc.h>
+
  #include <drm/ttm/ttm_bo.h>
  #include <drm/ttm/ttm_placement.h>
  #include <drm/ttm/ttm_tt.h>

Signature · 6 lines
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Maxfeldstr. 5, 90409 Nürnberg, Germany
(HRB 36809, AG Nürnberg)
Geschäftsführer: Ivo Totev