]>
Commit | Line | Data |
---|---|---|
6fa1c118 GKH |
1 | From 0d91b155a7f9c1f4a2b360bc2b79dc728aee8b48 Mon Sep 17 00:00:00 2001 |
2 | From: Thomas Backlund <tmb@mageia.org> | |
3 | Date: Sat, 15 Jun 2019 12:22:44 +0300 | |
4 | Subject: nouveau: Fix build with CONFIG_NOUVEAU_LEGACY_CTX_SUPPORT disabled | |
5 | ||
6 | From: Thomas Backlund <tmb@mageia.org> | |
7 | ||
8 | Not-entirely-upstream-sha1-but-equivalent: bed2dd8421 | |
9 | ("drm/ttm: Quick-test mmap offset in ttm_bo_mmap()") | |
10 | ||
11 | Setting CONFIG_NOUVEAU_LEGACY_CTX_SUPPORT=n (added by commit: b30a43ac7132) | |
12 | causes the build to fail with: | |
13 | ||
14 | ERROR: "drm_legacy_mmap" [drivers/gpu/drm/nouveau/nouveau.ko] undefined! | |
15 | ||
16 | This does not happend upstream as the offending code got removed in: | |
17 | bed2dd8421 ("drm/ttm: Quick-test mmap offset in ttm_bo_mmap()") | |
18 | ||
19 | Fix that by adding check for CONFIG_NOUVEAU_LEGACY_CTX_SUPPORT around | |
20 | the drm_legacy_mmap() call. | |
21 | ||
22 | Also, as Sven Joachim pointed out, we need to make the check in | |
23 | CONFIG_NOUVEAU_LEGACY_CTX_SUPPORT=n case return -EINVAL as its done | |
24 | for basically all other gpu drivers, especially in upstream kernels | |
25 | drivers/gpu/drm/ttm/ttm_bo_vm.c as of the upstream commit bed2dd8421. | |
26 | ||
27 | NOTE. This is a minimal stable-only fix for trees where b30a43ac7132 is | |
28 | backported as the build error affects nouveau only. | |
29 | ||
30 | Fixes: b30a43ac7132 ("drm/nouveau: add kconfig option to turn off nouveau | |
31 | legacy contexts. (v3)") | |
32 | Signed-off-by: Thomas Backlund <tmb@mageia.org> | |
33 | Cc: stable@vger.kernel.org | |
34 | Cc: Daniel Vetter <daniel.vetter@ffwll.ch> | |
35 | Cc: Sven Joachim <svenjoac@gmx.de> | |
36 | Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> | |
37 | --- | |
38 | drivers/gpu/drm/nouveau/nouveau_ttm.c | 4 ++++ | |
39 | 1 file changed, 4 insertions(+) | |
40 | ||
41 | --- a/drivers/gpu/drm/nouveau/nouveau_ttm.c | |
42 | +++ b/drivers/gpu/drm/nouveau/nouveau_ttm.c | |
43 | @@ -169,7 +169,11 @@ nouveau_ttm_mmap(struct file *filp, stru | |
44 | struct nouveau_drm *drm = nouveau_drm(file_priv->minor->dev); | |
45 | ||
46 | if (unlikely(vma->vm_pgoff < DRM_FILE_PAGE_OFFSET)) | |
47 | +#if defined(CONFIG_NOUVEAU_LEGACY_CTX_SUPPORT) | |
48 | return drm_legacy_mmap(filp, vma); | |
49 | +#else | |
50 | + return -EINVAL; | |
51 | +#endif | |
52 | ||
53 | return ttm_bo_mmap(filp, vma, &drm->ttm.bdev); | |
54 | } |