Alisa Khabibrakhmanova
5e1bfb277d
drm/via: Add new condition to via_dma_cleanup()
...
Pointer dev_priv->mmio, which was checked for NULL at via_do_init_map(),
is passed to via_do_cleanup_map() and is dereferenced there without check.
The patch adds the condition in via_dma_cleanup() which prevents potential NULL
pointer dereference.
Found by Linux Verification Center (linuxtesting.org) with SVACE.
Fixes: 22f579c621 ("drm: Add via unichrome support")
Signed-off-by: Alisa Khabibrakhmanova <khabibrakhmanova@ispras.ru >
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch >
Link: https://patchwork.freedesktop.org/patch/msgid/20220729090643.240778-1-khabibrakhmanova@ispras.ru
2022-09-07 07:01:16 +02:00
Danilo Krummrich
b765bc9968
drm/via: use idr_init_base() to initialize dev_priv->object_idr
...
idr_init_base(), implemented by commit 6ce711f275 ("idr: Make 1-based
IDRs more efficient"), let us set an arbitrary base other than
idr_init(), which uses base 0.
Since, for this IDR, no ID < 1 is ever requested/allocated, using
idr_init_base(&idr, 1) avoids unnecessary tree walks.
Signed-off-by: Danilo Krummrich <dakr@redhat.com >
Signed-off-by: Maxime Ripard <maxime@cerno.tech >
Link: https://lore.kernel.org/r/20220701190227.284783-2-dakr@redhat.com
2022-07-28 16:36:49 +02:00
Sam Ravnborg
5f9cfd8243
drm/via: Fix style issues in via_3d_reg header
...
- Fix comments using wrong style
- Drop repeated word
This fixes all checkpatch complains and makes the file a little
bit easier to read - as the eye is not distracted by the style
violations.
Suggested-by: Thomas Zimmermann <tzimmermann@suse.de >
Signed-off-by: Sam Ravnborg <sam@ravnborg.org >
Acked-by: Thomas Zimmermann <tzimmermann@suse.de >
Cc: Kevin Brace <kevinbrace@bracecomputerlab.com >
Link: https://patchwork.freedesktop.org/patch/msgid/20220713170202.1798216-14-sam@ravnborg.org
2022-07-16 09:32:20 +02:00
Sam Ravnborg
3579ca9575
drm/via: Make macros readable in the via_3d_reg header
...
The macros for texture 1 setting all used continuation on a new line,
resulting in a highly ureadable definition.
Merge the lines so they are each on a single line.
As a nice side-effect this fixes a number of checkpatch warnings:
"WARNING: please, no spaces at the start of a line".
Suggested-by: Thomas Zimmermann <tzimmermann@suse.de >
Signed-off-by: Sam Ravnborg <sam@ravnborg.org >
Acked-by: Thomas Zimmermann <tzimmermann@suse.de >
Cc: Kevin Brace <kevinbrace@bracecomputerlab.com >
Link: https://patchwork.freedesktop.org/patch/msgid/20220713170202.1798216-13-sam@ravnborg.org
2022-07-16 09:32:13 +02:00
Sam Ravnborg
e1df7580bb
drm/via: Use SPDX tag for MIT license in via_3d_reg header
...
The license for the via_3d_reg header is MIT - so use the
shorter SPDX tag to identify the license.
Suggested-by: Thomas Zimmermann <tzimmermann@suse.de >
Signed-off-by: Sam Ravnborg <sam@ravnborg.org >
Acked-by: Thomas Zimmermann <tzimmermann@suse.de >
Cc: Kevin Brace <kevinbrace@bracecomputerlab.com >
Link: https://patchwork.freedesktop.org/patch/msgid/20220713170202.1798216-12-sam@ravnborg.org
2022-07-16 09:27:17 +02:00
Sam Ravnborg
e0a49c7867
drm/via: Update to the latest via_3d_reg header
...
Updated the 3d_reg header file to match what is used by the openchrome
driver.
This verifies that the two drivers can use the same header file.
The file is a verbatim copy from the openchrome repo - a few style
issues will be fixed in following commits.
Signed-off-by: Sam Ravnborg <sam@ravnborg.org >
Acked-by: Thomas Zimmermann <tzimmermann@suse.de >
Cc: Kevin Brace <kevinbrace@bracecomputerlab.com >
Link: https://patchwork.freedesktop.org/patch/msgid/20220713170202.1798216-11-sam@ravnborg.org
2022-07-16 09:27:11 +02:00
Sam Ravnborg
685bf9f58d
drm/via: Embed via_drv.h in via_dri1
...
With this change the driver is now a signle file driver.
The only remaning heder file describes the HW and can be shared with the
new openchrome driver.
Signed-off-by: Sam Ravnborg <sam@ravnborg.org >
Acked-by: Thomas Zimmermann <tzimmermann@suse.de >
Cc: Kevin Brace <kevinbrace@bracecomputerlab.com >
Link: https://patchwork.freedesktop.org/patch/msgid/20220713170202.1798216-10-sam@ravnborg.org
2022-07-16 09:26:21 +02:00
Sam Ravnborg
8f8ed7f838
drm/via: Embed via_verifier in via_dri1
...
Embed the header file in via_drv.h and the code in via_dri1.
All functions are made static as there are no more external users.
Signed-off-by: Sam Ravnborg <sam@ravnborg.org >
Acked-by: Thomas Zimmermann <tzimmermann@suse.de >
Cc: Kevin Brace <kevinbrace@bracecomputerlab.com >
Link: https://patchwork.freedesktop.org/patch/msgid/20220713170202.1798216-9-sam@ravnborg.org
2022-07-16 09:26:19 +02:00
Sam Ravnborg
f99995a4d7
drm/via: Embed via_dmablit in via_dri1
...
Embed some of the header file in via_drv.h and
the rest in via_dri1.c
While embedding deleted extra empty lines and functions that
has no external users are made static.
Signed-off-by: Sam Ravnborg <sam@ravnborg.org >
Acked-by: Thomas Zimmermann <tzimmermann@suse.de >
Cc: Kevin Brace <kevinbrace@bracecomputerlab.com >
Link: https://patchwork.freedesktop.org/patch/msgid/20220713170202.1798216-8-sam@ravnborg.org
2022-07-16 09:26:18 +02:00
Sam Ravnborg
b0b3a87925
drm/via: Embed via_irq in via_dri1
...
All functions are made static as there are no more external users.
The file had new copyrights that are kept.
Signed-off-by: Sam Ravnborg <sam@ravnborg.org >
Acked-by: Thomas Zimmermann <tzimmermann@suse.de >
Cc: Kevin Brace <kevinbrace@bracecomputerlab.com >
Link: https://patchwork.freedesktop.org/patch/msgid/20220713170202.1798216-7-sam@ravnborg.org
2022-07-16 09:26:17 +02:00
Sam Ravnborg
e85e4ae015
drm/via: Embed via_video in via_dri1
...
All functions are made static as there are no more external users.
The file had a new copyright that is kept.
Signed-off-by: Sam Ravnborg <sam@ravnborg.org >
Acked-by: Thomas Zimmermann <tzimmermann@suse.de >
Cc: Kevin Brace <kevinbrace@bracecomputerlab.com >
Link: https://patchwork.freedesktop.org/patch/msgid/20220713170202.1798216-6-sam@ravnborg.org
2022-07-16 09:26:16 +02:00
Sam Ravnborg
67034c8e00
drm/via: Embed via_mm in via_dri1
...
All functions was made static as there are no external users.
Signed-off-by: Sam Ravnborg <sam@ravnborg.org >
Acked-by: Thomas Zimmermann <tzimmermann@suse.de >
Cc: Kevin Brace <kevinbrace@bracecomputerlab.com >
Link: https://patchwork.freedesktop.org/patch/msgid/20220713170202.1798216-5-sam@ravnborg.org
2022-07-16 09:26:15 +02:00
Sam Ravnborg
fa0cc3ca1d
drm/via: Embed via_map in via_dri1
...
A few functions has no external use and are made static.
Signed-off-by: Sam Ravnborg <sam@ravnborg.org >
Acked-by: Thomas Zimmermann <tzimmermann@suse.de >
Cc: Kevin Brace <kevinbrace@bracecomputerlab.com >
Link: https://patchwork.freedesktop.org/patch/msgid/20220713170202.1798216-4-sam@ravnborg.org
2022-07-16 09:26:14 +02:00
Sam Ravnborg
9a4537a782
drm/via: Embed via_dma in via_dri1
...
Moved the copyright notices so all copyrights are kept.
A few variables was made static as there are no more users outside this
file.
Signed-off-by: Sam Ravnborg <sam@ravnborg.org >
Acked-by: Thomas Zimmermann <tzimmermann@suse.de >
Cc: Kevin Brace <kevinbrace@bracecomputerlab.com >
Link: https://patchwork.freedesktop.org/patch/msgid/20220713170202.1798216-3-sam@ravnborg.org
2022-07-16 09:26:10 +02:00
Sam Ravnborg
e6d9767faf
drm/via: Rename via_drv to via_dri1
...
The via driver implements the DRI1 interface, and we have a new
implementation of the via driver coming that supports atomic
modesetting.
It is not acceptable just to replace the existing driver so
this is first step to make it a single-file implementation allowing
it to stay without interfering with the new driver.
Signed-off-by: Sam Ravnborg <sam@ravnborg.org >
Acked-by: Thomas Zimmermann <tzimmermann@suse.de >
Cc: Kevin Brace <kevinbrace@bracecomputerlab.com >
Link: https://patchwork.freedesktop.org/patch/msgid/20220713170202.1798216-2-sam@ravnborg.org
2022-07-16 09:26:10 +02:00
Thomas Zimmermann
c1736b9008
drm: IRQ midlayer is now legacy
...
Hide the DRM midlayer behind CONFIG_DRM_LEGACY, make functions use
the prefix drm_legacy_, and move declarations to drm_legacy.h.
In struct drm_device, move the fields irq and irq_enabled behind
CONFIG_DRM_LEGACY.
All callers have been updated.
Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de >
Acked-by: Sam Ravnborg <sam@ravnborg.org >
Link: https://patchwork.freedesktop.org/patch/msgid/20210803090704.32152-15-tzimmermann@suse.de
2021-08-10 20:14:01 +02:00
Thomas Zimmermann
04dfe19a5e
drm: Mark AGP implementation and ioctls as legacy
...
Only UMs drivers use DRM's core AGP code and ioctls. Mark the icotls
as legacy. Add the _legacy_ infix to all AGP functions. Move the
declarations to the public and internal legacy header files. The agp
field in struct drm_device is now located in the structure's legacy
section. Adapt drivers to the changes.
AGP code now depends on CONFIG_DRM_LEGACY.
Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de >
Reviewed-by: Alex Deucher <alexander.deucher@amd.com >
Acked-by: Christian König <christian.koenig@amd.com >
Link: https://patchwork.freedesktop.org/patch/msgid/20210507185709.22797-5-tzimmermann@suse.de
2021-05-10 15:46:58 +02:00
Thomas Zimmermann
9a31b3813f
drm/via: Remove references to drm_device.pdev
...
Replace all references to struct drm_device's pdev field with
an upcast from dev.
Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de >
Reviewed-by: Maxime Ripard <maxime@cerno.tech >
Link: https://patchwork.freedesktop.org/patch/msgid/20210502104953.21768-7-tzimmermann@suse.de
2021-05-03 19:48:37 +02:00
Bernard Zhao
584e599bd0
via/via_irq: use __func__ to replace string function name
...
This change also fix checkpatch.pl warning:
WARNING: Prefer using '"%s...", __func__' to using
'via_driver_irq_postinstall', this function's name, in a string
+ DRM_DEBUG("via_driver_irq_postinstall\n");
Signed-off-by: Bernard Zhao <bernard@vivo.com >
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch >
Link: https://patchwork.freedesktop.org/patch/msgid/20201119072957.108941-1-bernard@vivo.com
2020-11-27 16:14:02 +01:00
Gustavo A. R. Silva
0b08d08ddf
drm/via: Fix fall-through warnings for Clang
...
In preparation to enable -Wimplicit-fallthrough for Clang, fix a warning
by explicitly adding a break statement instead of letting the code fall
through to the next case.
Link: https://github.com/KSPP/linux/issues/115
Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org >
Signed-off-by: Sam Ravnborg <sam@ravnborg.org >
Link: https://patchwork.freedesktop.org/patch/msgid/c21a588bf9e222826f6b138db91de26a2b21df33.1605896060.git.gustavoars@kernel.org
2020-11-22 22:58:55 +01:00
Bernard Zhao
58a74c6f1d
drm/via: fix assignment in if condition
...
Fix check_patch.pl warning:
ERROR: do not use assignment in if condition
+ if ((HALCYON_HEADER2 == (cmd = *buf)) &&
ERROR: do not use assignment in if condition
+ if (HALCYON_HEADER2 == (cmd = *buf))
Signed-off-by: Bernard Zhao <bernard@vivo.com >
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch >
Link: https://patchwork.freedesktop.org/patch/msgid/20201118114021.105502-1-bernard@vivo.com
2020-11-18 22:27:49 +01:00
Lee Jones
2c68640401
drm/via/via_dma: Remove set but unused variable 'agp_base'
...
Fixes the following W=1 kernel build warning(s):
drivers/gpu/drm/via/via_dma.c: In function ‘via_cmdbuf_jump’:
drivers/gpu/drm/via/via_dma.c:596:11: warning: variable ‘agp_base’ set but not used [-Wunused-but-set-variable]
Cc: David Airlie <airlied@linux.ie >
Cc: Daniel Vetter <daniel@ffwll.ch >
Cc: dri-devel@lists.freedesktop.org
Signed-off-by: Lee Jones <lee.jones@linaro.org >
Signed-off-by: Sam Ravnborg <sam@ravnborg.org >
Link: https://patchwork.freedesktop.org/patch/msgid/20201112190039.2785914-5-lee.jones@linaro.org
2020-11-12 21:25:33 +01:00
Bernard Zhao
14212fe77e
drm/via: reduce no need mutex_lock area
...
In function via_mem_alloc`s error branch, DRM_ERROR is protected
in the mutex_lock(&dev->struct_mutex) area.
>From the code, we see that DRM_ERROR is just an error log print
without any struct element, there is no need to protect this.
Signed-off-by: Bernard Zhao <bernard@vivo.com >
Signed-off-by: Sam Ravnborg <sam@ravnborg.org >
Link: https://patchwork.freedesktop.org/patch/msgid/20200814083021.8962-1-bernard@vivo.com
2020-10-17 10:10:24 +02:00
Gustavo A. R. Silva
df561f6688
treewide: Use fallthrough pseudo-keyword
...
Replace the existing /* fall through */ comments and its variants with
the new pseudo-keyword macro fallthrough[1]. Also, remove unnecessary
fall-through markings when it is the case.
[1] https://www.kernel.org/doc/html/v5.7/process/deprecated.html?highlight=fallthrough#implicit-switch-case-fall-through
Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org >
2020-08-23 17:36:59 -05:00
Linus Torvalds
7eec11d3a7
Merge branch 'akpm' (patches from Andrew)
...
Pull updates from Andrew Morton:
"Most of -mm and quite a number of other subsystems: hotfixes, scripts,
ocfs2, misc, lib, binfmt, init, reiserfs, exec, dma-mapping, kcov.
MM is fairly quiet this time. Holidays, I assume"
* emailed patches from Andrew Morton <akpm@linux-foundation.org >: (118 commits)
kcov: ignore fault-inject and stacktrace
include/linux/io-mapping.h-mapping: use PHYS_PFN() macro in io_mapping_map_atomic_wc()
execve: warn if process starts with executable stack
reiserfs: prevent NULL pointer dereference in reiserfs_insert_item()
init/main.c: fix misleading "This architecture does not have kernel memory protection" message
init/main.c: fix quoted value handling in unknown_bootoption
init/main.c: remove unnecessary repair_env_string in do_initcall_level
init/main.c: log arguments and environment passed to init
fs/binfmt_elf.c: coredump: allow process with empty address space to coredump
fs/binfmt_elf.c: coredump: delete duplicated overflow check
fs/binfmt_elf.c: coredump: allocate core ELF header on stack
fs/binfmt_elf.c: make BAD_ADDR() unlikely
fs/binfmt_elf.c: better codegen around current->mm
fs/binfmt_elf.c: don't copy ELF header around
fs/binfmt_elf.c: fix ->start_code calculation
fs/binfmt_elf.c: smaller code generation around auxv vector fill
lib/find_bit.c: uninline helper _find_next_bit()
lib/find_bit.c: join _find_next_bit{_le}
uapi: rename ext2_swab() to swab() and share globally in swab.h
lib/scatterlist.c: adjust indentation in __sg_alloc_table
...
2020-01-31 12:16:36 -08:00