[PATCH 1/1] drm/amdgpu: initialize amdgpu_cgs_acpi_eval_object result value
amdgpu_cgs_acpi_eval_object() returned the value of variable "result" without initializing it first. This bug has been found by compiling the kernel with clang. The compiler complained: drivers/gpu/drm/amd/amdgpu/amdgpu_cgs.c:972:14: error: variable 'result' is used uninitialized whenever 'for' loop exits because its condition is false [-Werror,-Wsometimes-uninitialized] for (i = 0; i < count; i++) { ^ drivers/gpu/drm/amd/amdgpu/amdgpu_cgs.c:1011:9: note: uninitialized use occurs here return result; ^~ drivers/gpu/drm/amd/amdgpu/amdgpu_cgs.c:972:14: note: remove the condition if it is always true for (i = 0; i < count; i++) { ^ drivers/gpu/drm/amd/amdgpu/amdgpu_cgs.c:864:12: note: initialize the variable 'result' to silence this warning int result; ^ = 0 Fixes: 3f1d35a03b3c ("drm/amdgpu: implement new cgs interface for acpi function") Signed-off-by: Nicolas Iooss Cc: stable at vger.kernel.org --- drivers/gpu/drm/amd/amdgpu/amdgpu_cgs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_cgs.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_cgs.c index 8943099eb135..cf6f49fc1c75 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_cgs.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_cgs.c @@ -909,7 +909,7 @@ static int amdgpu_cgs_acpi_eval_object(struct cgs_device *cgs_device, struct cgs_acpi_method_argument *argument = NULL; uint32_t i, count; acpi_status status; - int result; + int result = 0; uint32_t func_no = 0x; handle = ACPI_HANDLE(&adev->pdev->dev); -- 2.8.3
[PATCH v2 1/2] drm/fsl-dcu: Add HDMI driver for freescale DCU
On 2016-06-14 02:20, Meng Yi wrote: > This patch creates another Encoder for HDMI port, and linking the Encoder > to appropriate DRM bridge. And this Encoder using same CRTC with RGB-LCD. > For RGB-LCD and HDMI using the same hardware connection to DCU, RGB-LCD > panel should be unplugged when using the HDMI connection. > > Signed-off-by: Alison Wang > Signed-off-by: Xiubo Li > Signed-off-by: Jianwei Wang > Signed-off-by: Meng Yi > --- > Changes in V2: > -remove unused headers inclusion > -remove module declarations > -fix error handling coding style > -drop moulde parameters and auto detect HDMI connection relying on deviece > tree > -modified comment lines > --- > drivers/gpu/drm/fsl-dcu/Makefile | 1 + > drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_hdmi.c | 189 > +++ > drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_kms.c| 16 +++ > drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_output.h | 4 + > 4 files changed, 210 insertions(+) > create mode 100644 drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_hdmi.c Hi Meng, I took a bit more time to understand what it is all about with this patchset and the DRM bridge infrastructure in general. I agree with Boris Brezillions comment of the first version of this patchset: You "only" want to add DRM bridge support here, it doesn't has anything to do with HDMI. So there should not be a file called fsl_dcu_drm_hdmi.c for instance In fact, you should fold the DRM bridge code into fsl_dcu_drm_rgb.c. Have a look at Boris patch which added such support to the Atmel HLDCD driver: https://lists.freedesktop.org/archives/dri-devel/2016-January/098050.html However, the HLDCD driver already supported the endpoint syntax for panels at that time, which is not the case for the DCU driver. Panel support with endpoint DT syntax seems to be more generic and is a easier first step towards DRM bridge support. Hence I suggest to take this two steps: 1. Extend the current code to support panels through endpoint syntax (of_graph..) 2. Extend the endpoint support to also support DRM bridges During 1 you should be careful to not remove the old fsl,panel support (backward compatibility). But it shouldn't be a big deal, just check if the fsl,panel property is there, if it is, do not parse the endpoints. Such backward compatibility has been implemented here: https://patchwork.kernel.org/patch/7706481/ -- Stefan > > diff --git a/drivers/gpu/drm/fsl-dcu/Makefile > b/drivers/gpu/drm/fsl-dcu/Makefile > index b35a292..12e2245 100644 > --- a/drivers/gpu/drm/fsl-dcu/Makefile > +++ b/drivers/gpu/drm/fsl-dcu/Makefile > @@ -1,6 +1,7 @@ > fsl-dcu-drm-y := fsl_dcu_drm_drv.o \ >fsl_dcu_drm_kms.o \ >fsl_dcu_drm_rgb.o \ > + fsl_dcu_drm_hdmi.o \ >fsl_dcu_drm_plane.o \ >fsl_dcu_drm_crtc.o \ >fsl_dcu_drm_fbdev.o \ > diff --git a/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_hdmi.c > b/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_hdmi.c > new file mode 100644 > index 000..f567534 > --- /dev/null > +++ b/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_hdmi.c > @@ -0,0 +1,189 @@ > +/* > + * Copyright 2016 NXP Semiconductor, Inc. > + * > + * NXP DCU drm device driver > + * > + * This program is free software; you can redistribute it and/or modify > + * it under the terms of the GNU General Public License as published by > + * the Free Software Foundation; either version 2 of the License, or > + * (at your option) any later version. > + */ > + > +#include > +#include > +#include > + > +#include > +#include > + > +#include "fsl_dcu_drm_drv.h" > +#include "fsl_dcu_drm_output.h" > +#include "fsl_tcon.h" > + > +static void > +fsl_dcu_drm_hdmienc_mode_set(struct drm_encoder *encoder, > + struct drm_display_mode *mode, > + struct drm_display_mode *adjusted_mode) > +{ > + /*TODO*/ > +} > + > +static int > +fsl_dcu_drm_hdmienc_atomic_check(struct drm_encoder *encoder, > + struct drm_crtc_state *crtc_state, > + struct drm_connector_state *conn_state) > +{ > + return 0; > +} > + > +static void > +fsl_dcu_drm_hdmienc_disable(struct drm_encoder *encoder) > +{ > + struct drm_device *dev = encoder->dev; > + struct fsl_dcu_drm_device *fsl_dev = dev->dev_private; > + > + if (fsl_dev->tcon) > + fsl_tcon_bypass_disable(fsl_dev->tcon); > +} > + > +static void > +fsl_dcu_drm_hdmienc_enable(struct drm_encoder *encoder) > +{ > + struct drm_device *dev = encoder->dev; > + struct fsl_dcu_drm_device *fsl_dev = dev->dev_private; > + > + if (fsl_dev->tcon) > + fsl_tcon_bypass_enable(fsl_dev->tcon); > +} > + > +static const struct > +drm_encoder_helper_funcs encoder_helper_funcs = { > + .atomic_check = fsl_dcu_drm_hdmienc_atomic_check, > + .disable = fsl_dcu_drm_hdmienc_disable, > + .enable = fsl_dcu_drm_hdmienc_enable, > + .mode_set = fsl_dcu_drm_hdmienc_mod
[PATCH] drm/fsl-dcu: use drm_mode_config_cleanup on initialization errors
Commit 7566e247672d ("drm/fsl-dcu: handle initialization errors properly") introduced error handling during initialization, but with a wrong cleanup order. Replace the error handling with the generic cleanup function drm_mode_config_cleanup. Signed-off-by: Stefan Agner --- drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_kms.c | 13 ++--- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_kms.c b/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_kms.c index c564ec6..a6e4cd5 100644 --- a/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_kms.c +++ b/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_kms.c @@ -37,23 +37,22 @@ int fsl_dcu_drm_modeset_init(struct fsl_dcu_drm_device *fsl_dev) ret = fsl_dcu_drm_crtc_create(fsl_dev); if (ret) - return ret; + goto err; ret = fsl_dcu_drm_encoder_create(fsl_dev, &fsl_dev->crtc); if (ret) - goto fail_encoder; + goto err; ret = fsl_dcu_drm_connector_create(fsl_dev, &fsl_dev->encoder); if (ret) - goto fail_connector; + goto err; drm_mode_config_reset(fsl_dev->drm); drm_kms_helper_poll_init(fsl_dev->drm); return 0; -fail_encoder: - fsl_dev->crtc.funcs->destroy(&fsl_dev->crtc); -fail_connector: - fsl_dev->encoder.funcs->destroy(&fsl_dev->encoder); + +err: + drm_mode_config_cleanup(fsl_dev->drm); return ret; } -- 2.8.3
[Bug 96580] GPU lockup on AMD 7970M when playing games
https://bugs.freedesktop.org/show_bug.cgi?id=96580 Saad Naji changed: What|Removed |Added Version|XOrg git|unspecified -- You are receiving this mail because: You are the assignee for the bug. -- next part -- An HTML attachment was scrubbed... URL: <https://lists.freedesktop.org/archives/dri-devel/attachments/20160618/430df65a/attachment-0001.html>
[Bug 96580] GPU lockup on AMD 7970M when playing games
https://bugs.freedesktop.org/show_bug.cgi?id=96580 Saad Naji changed: What|Removed |Added Keywords||regression -- You are receiving this mail because: You are the assignee for the bug. -- next part -- An HTML attachment was scrubbed... URL: <https://lists.freedesktop.org/archives/dri-devel/attachments/20160618/b1a796c3/attachment.html>
[Bug 96580] GPU lockup on AMD 7970M when playing games
https://bugs.freedesktop.org/show_bug.cgi?id=96580 --- Comment #2 from Saad Naji --- Created attachment 124593 --> https://bugs.freedesktop.org/attachment.cgi?id=124593&action=edit Xorg.0.log -- You are receiving this mail because: You are the assignee for the bug. -- next part -- An HTML attachment was scrubbed... URL: <https://lists.freedesktop.org/archives/dri-devel/attachments/20160618/fb1855cd/attachment.html>
[Bug 96580] GPU lockup on AMD 7970M when playing games
https://bugs.freedesktop.org/show_bug.cgi?id=96580 --- Comment #1 from Saad Naji --- Created attachment 124592 --> https://bugs.freedesktop.org/attachment.cgi?id=124592&action=edit xorg.conf -- You are receiving this mail because: You are the assignee for the bug. -- next part -- An HTML attachment was scrubbed... URL: <https://lists.freedesktop.org/archives/dri-devel/attachments/20160618/8c6c438c/attachment.html>
[Bug 96580] GPU lockup on AMD 7970M when playing games
https://bugs.freedesktop.org/show_bug.cgi?id=96580 Bug ID: 96580 Summary: GPU lockup on AMD 7970M when playing games Product: DRI Version: XOrg git Hardware: x86-64 (AMD64) OS: Linux (All) Status: NEW Severity: blocker Priority: medium Component: DRM/Radeon Assignee: dri-devel at lists.freedesktop.org Reporter: saad.naji at tutanota.com Created attachment 124591 --> https://bugs.freedesktop.org/attachment.cgi?id=124591&action=edit Dmesg-ouput [Description] When playing any games from Steam such as Counter-Stike:Go. The game launches but as soon the map starts to load the GPU lock-up happens and GPU (AMD 7970M) starts to speed to maximum. Afterwards, the game freezes, and the process has to be killed. [Setup] Software: Kernel Version : 4.6.2-1-ARCH Mesa Version: mesa 11.2.2-1 Launching Steam using DRI PRIME with DRI 3 option on Intel and Radeon in Xorg.conf Hardware: Clevo laptop P150EM CPU: Intel ivy-bridge core-i7 3610M GPU: AMD 7970M (Muxless) -- You are receiving this mail because: You are the assignee for the bug. -- next part -- An HTML attachment was scrubbed... URL: <https://lists.freedesktop.org/archives/dri-devel/attachments/20160618/a04d50b6/attachment.html>
[PATCH v2] drm/fsl-dcu: Exchange fail_encoder and fail_connector
On 2016-06-16 21:02, Meng Yi wrote: > The lable fail_connector should placed before fail_encoder since encoder was > initialized before connector. which should also be called after > connector initialization failed. > > Hi Stefan, > > What do you think? The current error handling is wrong, I agree. Just looked into it a bit closer, I think the right thing to do would be to use drm_mode_config_cleanup in any case, which will call all the destroy functions. I will send out a patch which removes the current error handling and uses drm_mode_config_cleanup. -- Stefan > >> --- >> Change in V2: >> -add prefix "drm/fsl-dcu" to subject >> --- >> drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_kms.c | 4 ++-- >> 1 file changed, 2 insertions(+), 2 deletions(-) >> >> diff --git a/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_kms.c >> b/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_kms.c >> index c564ec6..759527e 100644 >> --- a/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_kms.c >> +++ b/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_kms.c >> @@ -51,9 +51,9 @@ int fsl_dcu_drm_modeset_init(struct fsl_dcu_drm_device >> *fsl_dev) >> drm_kms_helper_poll_init(fsl_dev->drm); >> >> return 0; >> -fail_encoder: >> -fsl_dev->crtc.funcs->destroy(&fsl_dev->crtc); >> fail_connector: >> fsl_dev->encoder.funcs->destroy(&fsl_dev->encoder); >> +fail_encoder: >> +fsl_dev->crtc.funcs->destroy(&fsl_dev->crtc); >> return ret; >> } >> -- >> 2.1.0.27.g96db324 > > Best Regards, > Meng Yi
[PATCH -next] drm/msm/dsi: Fix return value check in msm_dsi_host_set_display_mode()
From: Wei Yongjun In case of error, the function drm_mode_duplicate() returns NULL pointer not ERR_PTR(). The IS_ERR() test in the return value check should be replaced with NULL test. Signed-off-by: Wei Yongjun --- drivers/gpu/drm/msm/dsi/dsi_host.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/msm/dsi/dsi_host.c b/drivers/gpu/drm/msm/dsi/dsi_host.c index a3e47ad8..97e5a4d 100644 --- a/drivers/gpu/drm/msm/dsi/dsi_host.c +++ b/drivers/gpu/drm/msm/dsi/dsi_host.c @@ -2245,9 +2245,9 @@ int msm_dsi_host_set_display_mode(struct mipi_dsi_host *host, } msm_host->mode = drm_mode_duplicate(msm_host->dev, mode); - if (IS_ERR(msm_host->mode)) { + if (!msm_host->mode) { pr_err("%s: cannot duplicate mode\n", __func__); - return PTR_ERR(msm_host->mode); + return -ENOMEM; } return 0;
[PATCH v2] drm: Protect drm_connector_register_all() under DRIVER_MODESET
On Sat, Jun 18, 2016 at 04:25:46PM +0100, Emil Velikov wrote: > On 18 June 2016 at 14:46, Chris Wilson wrote: > > 0-day kbuilder found > > > > [1.360244] BUG: unable to handle kernel NULL pointer dereference at > > (null) > > [1.360972] IP: [] mutex_lock_nested+0x11f/0x2c3 > > [1.361512] *pde = > > [1.361827] Oops: 0002 [#1] > > [1.362123] Modules linked in: > > [1.362451] CPU: 0 PID: 1 Comm: swapper Not tainted > > 4.7.0-rc2-00564-ge28cd4d #1 > > [1.363202] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS > > Debian-1.8.2-1 04/01/2014 > > [1.364105] task: c03d ti: d28da000 task.ti: d28da000 > > [1.364636] EIP: 0060:[] EFLAGS: 00210096 CPU: 0 > > [1.365215] EIP is at mutex_lock_nested+0x11f/0x2c3 > > [1.365703] EAX: EBX: d39e8ae8 ECX: d39e8b14 EDX: c1361cf9 > > [1.366351] ESI: c03d EDI: d28dbed0 EBP: d28dbeec ESP: d28dbec0 > > [1.367010] DS: 007b ES: 007b FS: GS: SS: 0068 > > [1.367534] CR0: 80050033 CR2: CR3: 019a9000 CR4: 0690 > > [1.368152] Stack: > > [1.368356] d39e8b14 d39e8b24 c1361cf9 00200246 d39e8b14 > > d28dbed0 > > [1.369235] d39e8800 d39e8ae8 d28dbf08 c1361cf9 d28dbf0c > > c10b25be d39e8800 > > [1.370087] d28dbf1c c135e37d fff4 > > d28dbf28 > > [1.371012] Call Trace: > > [1.371272] [] ? drm_connector_register_all+0x1a/0x92 > > [1.371847] [] drm_connector_register_all+0x1a/0x92 > > [1.372421] [] ? kstrdup+0x25/0x3a > > [1.372863] [] drm_dev_register+0x59/0x99 > > [1.373358] [] vgem_init+0x34/0x49 > > [1.373770] [] ? mipi_dsi_bus_init+0xf/0xf > > [1.374257] [] do_one_initcall+0x7c/0xfd > > [1.374754] [] ? parse_args+0x1fd/0x314 > > [1.375259] [] ? kernel_init_freeable+0xd0/0x179 > > [1.375837] [] kernel_init_freeable+0xec/0x179 > > [1.376371] [] kernel_init+0x8/0xcb > > [1.376806] [] ret_from_kernel_thread+0xe/0x30 > > [1.377322] [] ? rest_init+0x10e/0x10e > > [1.377754] Code: 89 fa e8 71 c5 b7 ff 8b 4e 04 89 fa 89 d8 e8 8e c6 b7 > > ff 8d 43 2c 89 45 d4 8b 43 30 8d 4b 2c 89 45 e8 89 7b 30 89 4d e4 8b 55 dc > > <89> 38 8d 43 3c 89 75 ec e8 c9 dd b7 ff eb 0c 31 c0 87 03 48 > > +75 > > [1.380442] EIP: [] mutex_lock_nested+0x11f/0x2c3 SS:ESP > > 0068:d28dbec0 > > [1.381174] CR2: > > > > when loading the non-modesetting vGEM module. To prevent use of the > > uninitialised dev->mode_config from drm_dev_register() we move the > > drm_connector_register_all() under a DRIVER_MODESET guard. Longer term, > > we probably want to initialise the embedded dev->mode_config automatically > > from drm_dev_init() for all DRIVER_MODESET drivers. > > > > v2: Also protect drm_dev_unregister. > > > > Fixes: e28cd4d0a223 ("drm: Automatically register/unregister all > > connectors") > > Signed-off-by: Chris Wilson > > Cc: Daniel Vetter > > Cc: Emil Velikov > > Reviewed-by: Emil Velikov Can also add Testcase: igt/vgem_reload_basic -Chris -- Chris Wilson, Intel Open Source Technology Centre
[Bug 120591] BUG() in dmesg after loading nouveau module
https://bugzilla.kernel.org/show_bug.cgi?id=120591 Ilia Mirkin changed: What|Removed |Added CC||imirkin at alum.mit.edu --- Comment #2 from Ilia Mirkin --- Looks like commit f045f459d925138fe7d6193a8c86406bda7e49da Author: Ben Skeggs Date: Thu Jun 2 12:23:31 2016 +1000 drm/nouveau/fbcon: fix out-of-bounds memory accesses does not properly deal with disabled fbdev emulation. Can you add a if (fbcon->helper.fbdev) before that added line in nouveau_fbcon_init? I assume that will resolve your issue. -- You are receiving this mail because: You are watching the assignee of the bug.
[PATCH v2] drm: Protect drm_connector_register_all() under DRIVER_MODESET
On 18 June 2016 at 14:46, Chris Wilson wrote: > 0-day kbuilder found > > [1.360244] BUG: unable to handle kernel NULL pointer dereference at > (null) > [1.360972] IP: [] mutex_lock_nested+0x11f/0x2c3 > [1.361512] *pde = > [1.361827] Oops: 0002 [#1] > [1.362123] Modules linked in: > [1.362451] CPU: 0 PID: 1 Comm: swapper Not tainted > 4.7.0-rc2-00564-ge28cd4d #1 > [1.363202] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS > Debian-1.8.2-1 04/01/2014 > [1.364105] task: c03d ti: d28da000 task.ti: d28da000 > [1.364636] EIP: 0060:[] EFLAGS: 00210096 CPU: 0 > [1.365215] EIP is at mutex_lock_nested+0x11f/0x2c3 > [1.365703] EAX: EBX: d39e8ae8 ECX: d39e8b14 EDX: c1361cf9 > [1.366351] ESI: c03d EDI: d28dbed0 EBP: d28dbeec ESP: d28dbec0 > [1.367010] DS: 007b ES: 007b FS: GS: SS: 0068 > [1.367534] CR0: 80050033 CR2: CR3: 019a9000 CR4: 0690 > [1.368152] Stack: > [1.368356] d39e8b14 d39e8b24 c1361cf9 00200246 d39e8b14 > d28dbed0 > [1.369235] d39e8800 d39e8ae8 d28dbf08 c1361cf9 d28dbf0c > c10b25be d39e8800 > [1.370087] d28dbf1c c135e37d fff4 > d28dbf28 > [1.371012] Call Trace: > [1.371272] [] ? drm_connector_register_all+0x1a/0x92 > [1.371847] [] drm_connector_register_all+0x1a/0x92 > [1.372421] [] ? kstrdup+0x25/0x3a > [1.372863] [] drm_dev_register+0x59/0x99 > [1.373358] [] vgem_init+0x34/0x49 > [1.373770] [] ? mipi_dsi_bus_init+0xf/0xf > [1.374257] [] do_one_initcall+0x7c/0xfd > [1.374754] [] ? parse_args+0x1fd/0x314 > [1.375259] [] ? kernel_init_freeable+0xd0/0x179 > [1.375837] [] kernel_init_freeable+0xec/0x179 > [1.376371] [] kernel_init+0x8/0xcb > [1.376806] [] ret_from_kernel_thread+0xe/0x30 > [1.377322] [] ? rest_init+0x10e/0x10e > [1.377754] Code: 89 fa e8 71 c5 b7 ff 8b 4e 04 89 fa 89 d8 e8 8e c6 b7 ff > 8d 43 2c 89 45 d4 8b 43 30 8d 4b 2c 89 45 e8 89 7b 30 89 4d e4 8b 55 dc <89> > 38 8d 43 3c 89 75 ec e8 c9 dd b7 ff eb 0c 31 c0 87 03 48 > +75 > [1.380442] EIP: [] mutex_lock_nested+0x11f/0x2c3 SS:ESP > 0068:d28dbec0 > [1.381174] CR2: > > when loading the non-modesetting vGEM module. To prevent use of the > uninitialised dev->mode_config from drm_dev_register() we move the > drm_connector_register_all() under a DRIVER_MODESET guard. Longer term, > we probably want to initialise the embedded dev->mode_config automatically > from drm_dev_init() for all DRIVER_MODESET drivers. > > v2: Also protect drm_dev_unregister. > > Fixes: e28cd4d0a223 ("drm: Automatically register/unregister all connectors") > Signed-off-by: Chris Wilson > Cc: Daniel Vetter > Cc: Emil Velikov Reviewed-by: Emil Velikov Thanks Emil
[PATCH 3/3] drm/vgem: Enable dmabuf interface for export
Enable the standard GEM dma-buf interface provided by the DRM core, but only for exporting the VGEM object. This allows passing around the VGEM objects created from the dumb interface and using them as sources elsewhere. Creating a VGEM object for a foriegn handle is not supported. Testcase: igt/vgem_basic/dmabuf-mmap Signed-off-by: Chris Wilson --- drivers/gpu/drm/vgem/vgem_drv.c | 29 - 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/vgem/vgem_drv.c b/drivers/gpu/drm/vgem/vgem_drv.c index 4747b7f98e7a..27f9a7625a87 100644 --- a/drivers/gpu/drm/vgem/vgem_drv.c +++ b/drivers/gpu/drm/vgem/vgem_drv.c @@ -193,14 +193,41 @@ static const struct file_operations vgem_driver_fops = { .release= drm_release, }; +static int vgem_prime_mmap(struct drm_gem_object *obj, + struct vm_area_struct *vma) +{ + int ret; + + if (obj->size < vma->vm_end - vma->vm_start) + return -EINVAL; + + if (!obj->filp) + return -ENODEV; + + ret = obj->filp->f_op->mmap(obj->filp, vma); + if (ret) + return ret; + + fput(vma->vm_file); + vma->vm_file = get_file(obj->filp); + + return 0; +} + static struct drm_driver vgem_driver = { - .driver_features= DRIVER_GEM, + .driver_features= DRIVER_GEM | DRIVER_PRIME, .gem_free_object_unlocked = vgem_gem_free_object, .gem_vm_ops = &vgem_gem_vm_ops, .ioctls = vgem_ioctls, .fops = &vgem_driver_fops, + .dumb_create= vgem_gem_dumb_create, .dumb_map_offset= vgem_gem_dumb_map, + + .prime_handle_to_fd = drm_gem_prime_handle_to_fd, + .gem_prime_export = drm_gem_prime_export, + .gem_prime_mmap = vgem_prime_mmap, + .name = DRIVER_NAME, .desc = DRIVER_DESC, .date = DRIVER_DATE, -- 2.8.1
[PATCH 2/3] drm/vgem: Fix mmaping
The vGEM mmap code has bitrotted slightly and now immediately BUGs. Since vGEM was last updated, there are new core GEM facilities to provide more common functions, so let's use those here. Testcase: igt/vgem_basic/mmap Signed-off-by: Chris Wilson --- drivers/gpu/drm/vgem/vgem_drv.c | 163 +++- drivers/gpu/drm/vgem/vgem_drv.h | 6 -- 2 files changed, 61 insertions(+), 108 deletions(-) diff --git a/drivers/gpu/drm/vgem/vgem_drv.c b/drivers/gpu/drm/vgem/vgem_drv.c index 1b4cc8b27080..4747b7f98e7a 100644 --- a/drivers/gpu/drm/vgem/vgem_drv.c +++ b/drivers/gpu/drm/vgem/vgem_drv.c @@ -42,81 +42,39 @@ #define DRIVER_MAJOR 1 #define DRIVER_MINOR 0 -void vgem_gem_put_pages(struct drm_vgem_gem_object *obj) -{ - drm_gem_put_pages(&obj->base, obj->pages, false, false); - obj->pages = NULL; -} - static void vgem_gem_free_object(struct drm_gem_object *obj) { struct drm_vgem_gem_object *vgem_obj = to_vgem_bo(obj); drm_gem_free_mmap_offset(obj); - - if (vgem_obj->use_dma_buf && obj->dma_buf) { - dma_buf_put(obj->dma_buf); - obj->dma_buf = NULL; - } - drm_gem_object_release(obj); - - if (vgem_obj->pages) - vgem_gem_put_pages(vgem_obj); - - vgem_obj->pages = NULL; - kfree(vgem_obj); } -int vgem_gem_get_pages(struct drm_vgem_gem_object *obj) -{ - struct page **pages; - - if (obj->pages || obj->use_dma_buf) - return 0; - - pages = drm_gem_get_pages(&obj->base); - if (IS_ERR(pages)) { - return PTR_ERR(pages); - } - - obj->pages = pages; - - return 0; -} - static int vgem_gem_fault(struct vm_area_struct *vma, struct vm_fault *vmf) { struct drm_vgem_gem_object *obj = vma->vm_private_data; - loff_t num_pages; - pgoff_t page_offset; - int ret; - /* We don't use vmf->pgoff since that has the fake offset */ - page_offset = ((unsigned long)vmf->virtual_address - vma->vm_start) >> - PAGE_SHIFT; - - num_pages = DIV_ROUND_UP(obj->base.size, PAGE_SIZE); - - if (page_offset > num_pages) - return VM_FAULT_SIGBUS; - - ret = vm_insert_page(vma, (unsigned long)vmf->virtual_address, -obj->pages[page_offset]); - switch (ret) { - case 0: - return VM_FAULT_NOPAGE; - case -ENOMEM: - return VM_FAULT_OOM; - case -EBUSY: - return VM_FAULT_RETRY; - case -EFAULT: - case -EINVAL: - return VM_FAULT_SIGBUS; - default: - WARN_ON(1); - return VM_FAULT_SIGBUS; + unsigned long vaddr = (unsigned long)vmf->virtual_address; + struct page *page; + + page = shmem_read_mapping_page(file_inode(obj->base.filp)->i_mapping, + (vaddr - vma->vm_start) >> PAGE_SHIFT); + if (!IS_ERR(page)) { + vmf->page = page; + return VM_FAULT_LOCKED; + } else switch (PTR_ERR(page)) { + case -ENOSPC: + case -ENOMEM: + return VM_FAULT_OOM; + case -EBUSY: + return VM_FAULT_RETRY; + case -EFAULT: + case -EINVAL: + return VM_FAULT_SIGBUS; + default: + WARN_ON_ONCE(PTR_ERR(page)); + return VM_FAULT_SIGBUS; } } @@ -134,57 +92,43 @@ static struct drm_gem_object *vgem_gem_create(struct drm_device *dev, unsigned long size) { struct drm_vgem_gem_object *obj; - struct drm_gem_object *gem_object; - int err; - - size = roundup(size, PAGE_SIZE); + int ret; obj = kzalloc(sizeof(*obj), GFP_KERNEL); if (!obj) return ERR_PTR(-ENOMEM); - gem_object = &obj->base; - - err = drm_gem_object_init(dev, gem_object, size); - if (err) - goto out; - - err = vgem_gem_get_pages(obj); - if (err) - goto out; - - err = drm_gem_handle_create(file, gem_object, handle); - if (err) - goto handle_out; + ret = drm_gem_object_init(dev, &obj->base, roundup(size, PAGE_SIZE)); + if (ret) + goto err_free; - drm_gem_object_unreference_unlocked(gem_object); + ret = drm_gem_handle_create(file, &obj->base, handle); + drm_gem_object_unreference_unlocked(&obj->base); + if (ret) + goto err; - return gem_object; + return &obj->base; -handle_out: - drm_gem_object_release(gem_object); -out: +err_free: kfree(obj); - return ERR_PTR(err); +err: + return ERR_PTR(ret); } static int vgem_gem_dumb_create(struct drm_file *file, struct drm_device *dev, struc
[PATCH 1/3] drm: Wait on the reservation object when sync'ing dmabufs
Rendering operations to the dma-buf are tracked implicitly via the reservation_object (dmabuf->resv). The dmabuf sync ioctl allows userspace to wait upon outstanding rendering and prepare the object for CPU access (provided by the prime dma_buf_ops.begin_cpu_access). Fill this out for the generic drm_gem_prime by waiting on outstanding rendering via dmabuf->resv. (This offers an alternative to using poll that is consistent with other drivers that may need to more work to prepare the object for access by the CPU.) Signed-off-by: Chris Wilson --- drivers/gpu/drm/drm_prime.c | 18 ++ 1 file changed, 18 insertions(+) diff --git a/drivers/gpu/drm/drm_prime.c b/drivers/gpu/drm/drm_prime.c index 780589b420a4..479ff7cc3634 100644 --- a/drivers/gpu/drm/drm_prime.c +++ b/drivers/gpu/drm/drm_prime.c @@ -28,6 +28,7 @@ #include #include +#include #include #include @@ -288,6 +289,22 @@ static int drm_gem_dmabuf_mmap(struct dma_buf *dma_buf, return dev->driver->gem_prime_mmap(obj, vma); } +static int drm_gem_begin_cpu_access(struct dma_buf *dma_buf, + enum dma_data_direction direction) +{ + bool write = (direction == DMA_BIDIRECTIONAL || + direction == DMA_TO_DEVICE); + struct reservation_object *resv = dma_buf->resv; + long ret; + + ret = reservation_object_wait_timeout_rcu(resv, write, true, + MAX_SCHEDULE_TIMEOUT); + if (ret < 0) + return ret; + + return 0; +} + static const struct dma_buf_ops drm_gem_prime_dmabuf_ops = { .attach = drm_gem_map_attach, .detach = drm_gem_map_detach, @@ -301,6 +318,7 @@ static const struct dma_buf_ops drm_gem_prime_dmabuf_ops = { .mmap = drm_gem_dmabuf_mmap, .vmap = drm_gem_dmabuf_vmap, .vunmap = drm_gem_dmabuf_vunmap, + .begin_cpu_access = drm_gem_begin_cpu_access, }; /** -- 2.8.1
[Bug 120591] BUG() in dmesg after loading nouveau module
https://bugzilla.kernel.org/show_bug.cgi?id=120591 --- Comment #1 from Dmitrii Tcvetkov --- Created attachment 220571 --> https://bugzilla.kernel.org/attachment.cgi?id=220571&action=edit kernel config -- You are receiving this mail because: You are watching the assignee of the bug.
[Bug 120591] New: BUG() in dmesg after loading nouveau module
https://bugzilla.kernel.org/show_bug.cgi?id=120591 Bug ID: 120591 Summary: BUG() in dmesg after loading nouveau module Product: Drivers Version: 2.5 Kernel Version: 4.7-rc3 Hardware: x86-64 OS: Linux Tree: Mainline Status: NEW Severity: high Priority: P1 Component: Video(DRI - non Intel) Assignee: drivers_video-dri at kernel-bugs.osdl.org Reporter: demfloro at demfloro.ru Regression: No Created attachment 220561 --> https://bugzilla.kernel.org/attachment.cgi?id=220561&action=edit dmesg OS: Arch Linux Video adapter: GeForce GTX 780 Ti xf86-nouveau: 1.0.12 I blacklisted nouveau module for full OS initialisation before reproducing, then issued: # modprobe nouveau debug=trace After that screen becomes black and in dmesg appears: BUG: unable to handle kernel NULL pointer dereference at 0210 Bug is not reproducible with 4.7-rc2 or earlier mainline. -- You are receiving this mail because: You are watching the assignee of the bug.
[PATCH igt 2/2] igt: Add basic exercise of vGEM
Signed-off-by: Chris Wilson --- lib/Makefile.sources| 2 + lib/igt_vgem.c | 80 ++ lib/igt_vgem.h | 42 ++ tests/Makefile.sources | 2 + tests/vgem_basic.c | 145 tests/vgem_reload_basic | 22 6 files changed, 293 insertions(+) create mode 100644 lib/igt_vgem.c create mode 100644 lib/igt_vgem.h create mode 100644 tests/vgem_basic.c create mode 100755 tests/vgem_reload_basic diff --git a/lib/Makefile.sources b/lib/Makefile.sources index f50ff4d..7f3f8c6 100644 --- a/lib/Makefile.sources +++ b/lib/Makefile.sources @@ -18,6 +18,8 @@ libintel_tools_la_SOURCES = \ igt_stats.h \ igt_sysfs.c \ igt_sysfs.h \ + igt_vgem.c \ + igt_vgem.h \ instdone.c \ instdone.h \ intel_batchbuffer.c \ diff --git a/lib/igt_vgem.c b/lib/igt_vgem.c new file mode 100644 index 000..9977903 --- /dev/null +++ b/lib/igt_vgem.c @@ -0,0 +1,80 @@ +/* + * Copyright © 2016 Intel Corporation + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +#include "igt.h" +#include "igt_vgem.h" + +#include + +int __vgem_create(int fd, struct vgem_bo *bo) +{ + struct drm_mode_create_dumb arg; + + memset(&arg, 0, sizeof(arg)); + arg.width = bo->width; + arg.height = bo->height; + arg.bpp = bo->bpp; + + if (drmIoctl(fd, DRM_IOCTL_MODE_CREATE_DUMB, &arg)) + return -errno; + + bo->handle = arg.handle; + bo->pitch = arg.pitch; + bo->size = arg.size; + + return 0; +} + +void vgem_create(int fd, struct vgem_bo *bo) +{ + igt_assert_eq(__vgem_create(fd, bo), 0); +} + +void *__vgem_mmap(int fd, struct vgem_bo *bo, unsigned prot) +{ + struct drm_mode_map_dumb arg; + void *ptr; + + memset(&arg, 0, sizeof(arg)); + arg.handle = bo->handle; + if (drmIoctl(fd, DRM_IOCTL_MODE_MAP_DUMB, &arg)) + return NULL; + + ptr = mmap(0, bo->size, prot, MAP_SHARED, fd, arg.offset); + if (ptr == MAP_FAILED) + return NULL; + + return ptr; +} + +void *vgem_mmap(int fd, struct vgem_bo *bo, unsigned prot) +{ + void *ptr; + + igt_assert_f((ptr = __vgem_mmap(fd, bo, prot)), +"vgem_map(fd=%d, bo->handle=%d, prot=%x)\n", +fd, bo->handle, prot); + + return ptr; +} + diff --git a/lib/igt_vgem.h b/lib/igt_vgem.h new file mode 100644 index 000..9e4a55e --- /dev/null +++ b/lib/igt_vgem.h @@ -0,0 +1,42 @@ +/* + * Copyright © 2016 Intel Corporation + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +#ifndef IGT_VGEM_H +#define IGT_VGEM_H + +#include + +struct vgem_bo {
[PATCH igt 1/2] lib: Support opening vGEM device
Signed-off-by: Chris Wilson --- lib/drmtest.c | 47 --- lib/drmtest.h | 7 --- 2 files changed, 36 insertions(+), 18 deletions(-) diff --git a/lib/drmtest.c b/lib/drmtest.c index c59cabe..30eae19 100644 --- a/lib/drmtest.c +++ b/lib/drmtest.c @@ -90,24 +90,29 @@ static int __get_drm_device_name(int fd, char *name) return -1; } -bool is_i915_device(int fd) +static bool __is_device(int fd, const char *expect) { - int ret; char name[5] = ""; - ret = __get_drm_device_name(fd, name); + if (__get_drm_device_name(fd, name)) + return false; - return !ret && strcmp("i915", name) == 0; + return strcmp(expect, name) == 0; } -static bool is_vc4_device(int fd) +bool is_i915_device(int fd) { - int ret; - char name[5] = ""; + return __is_device(fd, "i915"); +} - ret = __get_drm_device_name(fd, name); +static bool is_vc4_device(int fd) +{ + return __is_device(fd, "vc4"); +} - return !ret && strcmp("vc4", name) == 0; +static bool is_vgem_device(int fd) +{ + return __is_device(fd, "vgem"); } static bool has_known_intel_chipset(int fd) @@ -213,6 +218,13 @@ int drm_get_card(void) return -1; } +static void modprobe(const char *driver) +{ + char buf[128]; + snprintf(buf, sizeof(buf), "/sbin/modprobe %s", driver); + system(buf); +} + /** * __drm_open_driver: * @chipset: OR'd flags for each chipset to search, eg. #DRIVER_INTEL @@ -224,23 +236,28 @@ int drm_get_card(void) */ int __drm_open_driver(int chipset) { + if (chipset & DRIVER_VGEM) + modprobe("vgem"); + for (int i = 0; i < 16; i++) { char name[80]; int fd; - bool found_intel, found_vc4; sprintf(name, "/dev/dri/card%u", i); fd = open(name, O_RDWR); if (fd == -1) continue; - found_intel = is_i915_device(fd) && - has_known_intel_chipset(fd) && - (chipset & DRIVER_INTEL); + if (chipset & DRIVER_INTEL && is_i915_device(fd) && + has_known_intel_chipset(fd)) + return fd; - found_vc4 = is_vc4_device(fd) && (chipset & DRIVER_VC4); + if (chipset & DRIVER_VC4 && + is_vc4_device(fd)) + return fd; - if ((chipset & DRIVER_ANY) || found_intel || found_vc4) + if (chipset & DRIVER_VGEM && + is_vgem_device(fd)) return fd; close(fd); diff --git a/lib/drmtest.h b/lib/drmtest.h index c391464..8ce32a6 100644 --- a/lib/drmtest.h +++ b/lib/drmtest.h @@ -38,9 +38,10 @@ #include "intel_batchbuffer.h" -#define DRIVER_ANY 0x1 -#define DRIVER_INTEL (0x1 << 1) -#define DRIVER_VC4 (0x1 << 2) +#define DRIVER_INTEL (1 << 0) +#define DRIVER_VC4 (1 << 1) +#define DRIVER_VGEM(1 << 2) +#define DRIVER_ANY ~(DRIVER_VGEM) #ifdef ANDROID #if (!(defined HAVE_MMAP64)) && (!(defined __x86_64__)) -- 2.8.1
[PATCH v2] drm: Protect drm_connector_register_all() under DRIVER_MODESET
0-day kbuilder found [1.360244] BUG: unable to handle kernel NULL pointer dereference at (null) [1.360972] IP: [] mutex_lock_nested+0x11f/0x2c3 [1.361512] *pde = [1.361827] Oops: 0002 [#1] [1.362123] Modules linked in: [1.362451] CPU: 0 PID: 1 Comm: swapper Not tainted 4.7.0-rc2-00564-ge28cd4d #1 [1.363202] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS Debian-1.8.2-1 04/01/2014 [1.364105] task: c03d ti: d28da000 task.ti: d28da000 [1.364636] EIP: 0060:[] EFLAGS: 00210096 CPU: 0 [1.365215] EIP is at mutex_lock_nested+0x11f/0x2c3 [1.365703] EAX: EBX: d39e8ae8 ECX: d39e8b14 EDX: c1361cf9 [1.366351] ESI: c03d EDI: d28dbed0 EBP: d28dbeec ESP: d28dbec0 [1.367010] DS: 007b ES: 007b FS: GS: SS: 0068 [1.367534] CR0: 80050033 CR2: CR3: 019a9000 CR4: 0690 [1.368152] Stack: [1.368356] d39e8b14 d39e8b24 c1361cf9 00200246 d39e8b14 d28dbed0 [1.369235] d39e8800 d39e8ae8 d28dbf08 c1361cf9 d28dbf0c c10b25be d39e8800 [1.370087] d28dbf1c c135e37d fff4 d28dbf28 [1.371012] Call Trace: [1.371272] [] ? drm_connector_register_all+0x1a/0x92 [1.371847] [] drm_connector_register_all+0x1a/0x92 [1.372421] [] ? kstrdup+0x25/0x3a [1.372863] [] drm_dev_register+0x59/0x99 [1.373358] [] vgem_init+0x34/0x49 [1.373770] [] ? mipi_dsi_bus_init+0xf/0xf [1.374257] [] do_one_initcall+0x7c/0xfd [1.374754] [] ? parse_args+0x1fd/0x314 [1.375259] [] ? kernel_init_freeable+0xd0/0x179 [1.375837] [] kernel_init_freeable+0xec/0x179 [1.376371] [] kernel_init+0x8/0xcb [1.376806] [] ret_from_kernel_thread+0xe/0x30 [1.377322] [] ? rest_init+0x10e/0x10e [1.377754] Code: 89 fa e8 71 c5 b7 ff 8b 4e 04 89 fa 89 d8 e8 8e c6 b7 ff 8d 43 2c 89 45 d4 8b 43 30 8d 4b 2c 89 45 e8 89 7b 30 89 4d e4 8b 55 dc <89> 38 8d 43 3c 89 75 ec e8 c9 dd b7 ff eb 0c 31 c0 87 03 48 +75 [1.380442] EIP: [] mutex_lock_nested+0x11f/0x2c3 SS:ESP 0068:d28dbec0 [1.381174] CR2: when loading the non-modesetting vGEM module. To prevent use of the uninitialised dev->mode_config from drm_dev_register() we move the drm_connector_register_all() under a DRIVER_MODESET guard. Longer term, we probably want to initialise the embedded dev->mode_config automatically from drm_dev_init() for all DRIVER_MODESET drivers. v2: Also protect drm_dev_unregister. Fixes: e28cd4d0a223 ("drm: Automatically register/unregister all connectors") Signed-off-by: Chris Wilson Cc: Daniel Vetter Cc: Emil Velikov Cc: dri-devel at lists.freedesktop.org --- drivers/gpu/drm/drm_drv.c | 6 -- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/drm_drv.c b/drivers/gpu/drm/drm_drv.c index 2067ff089380..c7101c06b02e 100644 --- a/drivers/gpu/drm/drm_drv.c +++ b/drivers/gpu/drm/drm_drv.c @@ -687,7 +687,8 @@ int drm_dev_register(struct drm_device *dev, unsigned long flags) goto err_minors; } - drm_connector_register_all(dev); + if (drm_core_check_feature(dev, DRIVER_MODESET)) + drm_connector_register_all(dev); ret = 0; goto out_unlock; @@ -719,7 +720,8 @@ void drm_dev_unregister(struct drm_device *dev) drm_lastclose(dev); - drm_connector_unregister_all(dev); + if (drm_core_check_feature(dev, DRIVER_MODESET)) + drm_connector_unregister_all(dev); if (dev->driver->unload) dev->driver->unload(dev); -- 2.8.1
[Intel-gfx] [PATCH] drm: Protect drm_connector_register_all() under DRIVER_MODESET
On Sat, Jun 18, 2016 at 02:26:36PM +0100, Emil Velikov wrote: > Hi Chris, > > On 18 June 2016 at 13:13, Chris Wilson wrote: > > > > > - drm_connector_register_all(dev); > > + if (drm_core_check_feature(dev, DRIVER_MODESET)) > > + drm_connector_register_all(dev); > > > Shouldn't the drm_connector_unregister_all() call in > drm_dev_unregister() be guarded by a similar check ? Yes, kbuild doesn't unload the module Better add that to my test as well. -Chris -- Chris Wilson, Intel Open Source Technology Centre
[PATCH v2] gpu: host1x: hw: intr_hw: Remove create_workqueue
System workqueues have been able to handle high level of concurrency for a long time now and there's no reason to use dedicated workqueues just to gain concurrency. Since the workqueue host->intr_wq is involved in sync point interrupts, and sync point wait and is not being used on a memory reclaim path, dedicated host->intr_wq has been replaced with the use of system_wq. Unlike a dedicated per-cpu workqueue created with create_workqueue(), system_wq allows multiple work items to overlap executions even on the same CPU; however, a per-cpu workqueue doesn't have any CPU locality or global ordering guarantees unless the target CPU is explicitly specified and thus the increase of local concurrency shouldn't make any difference. cancel_work_sync() has been used in _host1x_free_syncpt_irq() to ensure that no work is pending by the time exit path runs. Signed-off-by: Bhaktipriya Shridhar --- Changes in v2: -Changed commit description drivers/gpu/host1x/dev.h| 1 - drivers/gpu/host1x/hw/intr_hw.c | 8 ++-- drivers/gpu/host1x/intr.c | 4 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/drivers/gpu/host1x/dev.h b/drivers/gpu/host1x/dev.h index dace124..136c3a9 100644 --- a/drivers/gpu/host1x/dev.h +++ b/drivers/gpu/host1x/dev.h @@ -109,7 +109,6 @@ struct host1x { struct clk *clk; struct mutex intr_mutex; - struct workqueue_struct *intr_wq; int intr_syncpt_irq; const struct host1x_syncpt_ops *syncpt_op; diff --git a/drivers/gpu/host1x/hw/intr_hw.c b/drivers/gpu/host1x/hw/intr_hw.c index e1e31e9..10f8168 100644 --- a/drivers/gpu/host1x/hw/intr_hw.c +++ b/drivers/gpu/host1x/hw/intr_hw.c @@ -38,7 +38,7 @@ static void host1x_intr_syncpt_handle(struct host1x_syncpt *syncpt) host1x_sync_writel(host, BIT_MASK(id), HOST1X_SYNC_SYNCPT_THRESH_CPU0_INT_STATUS(BIT_WORD(id))); - queue_work(host->intr_wq, &syncpt->intr.work); + schedule_work(&syncpt->intr.work); } static irqreturn_t syncpt_thresh_isr(int irq, void *dev_id) @@ -127,8 +127,12 @@ static void _host1x_intr_disable_syncpt_intr(struct host1x *host, u32 id) static int _host1x_free_syncpt_irq(struct host1x *host) { + int i; + devm_free_irq(host->dev, host->intr_syncpt_irq, host); - flush_workqueue(host->intr_wq); + + for (i = 0; i < host->info->nb_pts; i++) + cancel_work_sync(&host->syncpt[i].intr.work); return 0; } diff --git a/drivers/gpu/host1x/intr.c b/drivers/gpu/host1x/intr.c index 2491bf8..81de286 100644 --- a/drivers/gpu/host1x/intr.c +++ b/drivers/gpu/host1x/intr.c @@ -277,9 +277,6 @@ int host1x_intr_init(struct host1x *host, unsigned int irq_sync) mutex_init(&host->intr_mutex); host->intr_syncpt_irq = irq_sync; - host->intr_wq = create_workqueue("host_syncpt"); - if (!host->intr_wq) - return -ENOMEM; for (id = 0; id < nb_pts; ++id) { struct host1x_syncpt *syncpt = host->syncpt + id; @@ -299,7 +296,6 @@ int host1x_intr_init(struct host1x *host, unsigned int irq_sync) void host1x_intr_deinit(struct host1x *host) { host1x_intr_stop(host); - destroy_workqueue(host->intr_wq); } void host1x_intr_start(struct host1x *host) -- 2.1.4
[Intel-gfx] [PATCH] drm: Protect drm_connector_register_all() under DRIVER_MODESET
Hi Chris, On 18 June 2016 at 13:13, Chris Wilson wrote: > > - drm_connector_register_all(dev); > + if (drm_core_check_feature(dev, DRIVER_MODESET)) > + drm_connector_register_all(dev); > Shouldn't the drm_connector_unregister_all() call in drm_dev_unregister() be guarded by a similar check ? -Emil
[PATCH] mtip32xx: Remove deprecated create_workqueue
alloc_workqueue replaces deprecated create_workqueue(). A dedicated workqueue has been used since the workqueue isr_workq is involved in irq handling path of block driver and requires forward progress under memory pressure. Hence, WQ_MEM_RECLAIM has been set. Since there are only a fixed number of work items, explicit concurrency limit is unnecessary here. flush_workqueue is unnecessary since destroy_workqueue() itself calls drain_workqueue() which flushes repeatedly till the workqueue becomes empty. Hence the calls to flush_workqueue() before destroy_workqueue() have been dropped. Signed-off-by: Bhaktipriya Shridhar --- drivers/block/mtip32xx/mtip32xx.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/block/mtip32xx/mtip32xx.c b/drivers/block/mtip32xx/mtip32xx.c index 6053e46..4bfb75b 100644 --- a/drivers/block/mtip32xx/mtip32xx.c +++ b/drivers/block/mtip32xx/mtip32xx.c @@ -4437,7 +4437,7 @@ static int mtip_pci_probe(struct pci_dev *pdev, memset(dd->workq_name, 0, 32); snprintf(dd->workq_name, 31, "mtipq%d", dd->instance); - dd->isr_workq = create_workqueue(dd->workq_name); + dd->isr_workq = alloc_workqueue(dd->workq_name, WQ_MEM_RECLAIM, 0); if (!dd->isr_workq) { dev_warn(&pdev->dev, "Can't create wq %d\n", dd->instance); rv = -ENOMEM; @@ -4538,7 +4538,6 @@ block_initialize_err: msi_initialize_err: if (dd->isr_workq) { - flush_workqueue(dd->isr_workq); destroy_workqueue(dd->isr_workq); drop_cpu(dd->work[0].cpu_binding); drop_cpu(dd->work[1].cpu_binding); @@ -4599,7 +4598,6 @@ static void mtip_pci_remove(struct pci_dev *pdev) mtip_block_remove(dd); if (dd->isr_workq) { - flush_workqueue(dd->isr_workq); destroy_workqueue(dd->isr_workq); drop_cpu(dd->work[0].cpu_binding); drop_cpu(dd->work[1].cpu_binding); -- 2.1.4
[PATCH] drm: Protect drm_connector_register_all() under DRIVER_MODESET
0-day kbuilder found [1.360244] BUG: unable to handle kernel NULL pointer dereference at (null) [1.360972] IP: [] mutex_lock_nested+0x11f/0x2c3 [1.361512] *pde = [1.361827] Oops: 0002 [#1] [1.362123] Modules linked in: [1.362451] CPU: 0 PID: 1 Comm: swapper Not tainted 4.7.0-rc2-00564-ge28cd4d #1 [1.363202] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS Debian-1.8.2-1 04/01/2014 [1.364105] task: c03d ti: d28da000 task.ti: d28da000 [1.364636] EIP: 0060:[] EFLAGS: 00210096 CPU: 0 [1.365215] EIP is at mutex_lock_nested+0x11f/0x2c3 [1.365703] EAX: EBX: d39e8ae8 ECX: d39e8b14 EDX: c1361cf9 [1.366351] ESI: c03d EDI: d28dbed0 EBP: d28dbeec ESP: d28dbec0 [1.367010] DS: 007b ES: 007b FS: GS: SS: 0068 [1.367534] CR0: 80050033 CR2: CR3: 019a9000 CR4: 0690 [1.368152] Stack: [1.368356] d39e8b14 d39e8b24 c1361cf9 00200246 d39e8b14 d28dbed0 [1.369235] d39e8800 d39e8ae8 d28dbf08 c1361cf9 d28dbf0c c10b25be d39e8800 [1.370087] d28dbf1c c135e37d fff4 d28dbf28 [1.371012] Call Trace: [1.371272] [] ? drm_connector_register_all+0x1a/0x92 [1.371847] [] drm_connector_register_all+0x1a/0x92 [1.372421] [] ? kstrdup+0x25/0x3a [1.372863] [] drm_dev_register+0x59/0x99 [1.373358] [] vgem_init+0x34/0x49 [1.373770] [] ? mipi_dsi_bus_init+0xf/0xf [1.374257] [] do_one_initcall+0x7c/0xfd [1.374754] [] ? parse_args+0x1fd/0x314 [1.375259] [] ? kernel_init_freeable+0xd0/0x179 [1.375837] [] kernel_init_freeable+0xec/0x179 [1.376371] [] kernel_init+0x8/0xcb [1.376806] [] ret_from_kernel_thread+0xe/0x30 [1.377322] [] ? rest_init+0x10e/0x10e [1.377754] Code: 89 fa e8 71 c5 b7 ff 8b 4e 04 89 fa 89 d8 e8 8e c6 b7 ff 8d 43 2c 89 45 d4 8b 43 30 8d 4b 2c 89 45 e8 89 7b 30 89 4d e4 8b 55 dc <89> 38 8d 43 3c 89 75 ec e8 c9 dd b7 ff eb 0c 31 c0 87 03 48 +75 [1.380442] EIP: [] mutex_lock_nested+0x11f/0x2c3 SS:ESP 0068:d28dbec0 [1.381174] CR2: when loading the non-modesetting vGEM module. To prevent use of the uninitialised dev->mode_config from drm_dev_register() we move the drm_connector_register_all() under a DRIVER_MODESET guard. Longer term, we probably want to initialise the embedded dev->mode_config automatically from drm_dev_init() for all DRIVER_MODESET drivers. Fixes: e28cd4d0a223 ("drm: Automatically register/unregister all connectors") Signed-off-by: Chris Wilson Cc: Daniel Vetter Cc: dri-devel at lists.freedesktop.org --- drivers/gpu/drm/drm_drv.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/drm_drv.c b/drivers/gpu/drm/drm_drv.c index 2067ff089380..1f44a0a5a527 100644 --- a/drivers/gpu/drm/drm_drv.c +++ b/drivers/gpu/drm/drm_drv.c @@ -687,7 +687,8 @@ int drm_dev_register(struct drm_device *dev, unsigned long flags) goto err_minors; } - drm_connector_register_all(dev); + if (drm_core_check_feature(dev, DRIVER_MODESET)) + drm_connector_register_all(dev); ret = 0; goto out_unlock; -- 2.8.1
[PATCH v6 2/2] drm/panel: Add JDI LT070ME05000 WUXGA DSI Panel
On Sat, Jun 18, 2016 at 5:58 AM, Emil Velikov wrote: > Hi Vinay, > > On 17 June 2016 at 19:23, Vinay Simha BN wrote: > >> v6: >> * emil review comments incorporated >>PANEL_NUM_REGULATORS dropped, return ret added at necessary >>places, if checks dropped for backlight and gpios > > Looks like some of my suggestions went below the radar. Did you miss > them or I've I lost the plot somewhere ? In case of the latter don't > be shy to point out :-) > > >> +struct jdi_panel { >> + struct drm_panel base; >> + struct mipi_dsi_device *dsi; >> + >> + struct regulator_bulk_data supplies[3]; >> + > struct regulator_bulk_data supplies[ARRAY_SIZE(regulator_names)]; > > >> +static int jdi_panel_off(struct jdi_panel *jdi) >> +{ >> + struct mipi_dsi_device *dsi = jdi->dsi; >> + int ret; >> + >> + dsi->mode_flags &= ~MIPI_DSI_MODE_LPM; >> + >> + ret = mipi_dsi_dcs_set_display_off(dsi); >> + if (ret < 0) >> + return ret; >> + > IMHO neither this function nor its caller jdi_panel_unprepare() should > stop in the middle/return prematurely. > > Or in other words - one should change the function return type to void > and drop the returns. > > >> +static int jdi_panel_unprepare(struct drm_panel *panel) >> +{ >> + struct jdi_panel *jdi = to_jdi_panel(panel); >> + struct device *dev = &jdi->dsi->dev; >> + int ret; >> + >> + if (!jdi->prepared) >> + return 0; >> + >> + ret = jdi_panel_off(jdi); >> + if (ret) { >> + dev_err(panel->dev, "failed to set panel off: %d\n", ret); >> + return ret; > As suggested above, drop this return. > i can make the function void for jdi_panel_off and drop the return, but i cannot make void for jdi_panel_unprepare, since drm_panel_prepare requires 0 or negative value. * call to drm_panel_prepare(). * * Return: 0 on success or a negative error code on failure. */ static inline int drm_panel_unprepare(struct drm_panel *panel) { if (panel && panel->funcs && panel->funcs->unprepare) return panel->funcs->unprepare(panel); return panel ? -ENOSYS : -EINVAL; } > > >> +static int jdi_panel_prepare(struct drm_panel *panel) >> +{ >> + struct jdi_panel *jdi = to_jdi_panel(panel); >> + struct device *dev = &jdi->dsi->dev; >> + int ret; >> + >> + if (jdi->prepared) >> + return 0; >> + >> + ret = regulator_bulk_enable(ARRAY_SIZE(jdi->supplies), >> jdi->supplies); >> + if (ret < 0) { >> + dev_err(dev, "regulator enable failed, %d\n", ret); >> + return ret; >> + } >> + >> + msleep(20); >> + >> + if (jdi->reset_gpio) { > You can drop the check. > >> + gpiod_set_value(jdi->reset_gpio, 1); >> + usleep_range(10, 20); >> + } >> + >> + if (jdi->enable_gpio) { > Ditto. > > >> + >> +poweroff: >> + gpiod_set_value(jdi->enable_gpio, 0); >> + gpiod_set_value(jdi->reset_gpio, 0); >> + > Just noticed that you're missing regulator_bulk_disable() here. > > > Regards, > Emil -- Regards, Vinay Simha.B.N.
[patch] drm/amdgpu: precedence bug in amdgpu_device_init()
! has higher precedence than bitwise & so we need to add parenthesis for this to work as intended. Fixes: 048765ad5af7 ('amdgpu: fix asic initialization for virtualized environments (v2)') Signed-off-by: Dan Carpenter diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c index 66482b4..6e92008 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c @@ -1535,7 +1535,7 @@ int amdgpu_device_init(struct amdgpu_device *adev, /* Post card if necessary */ if (!amdgpu_card_posted(adev) || (adev->virtualization.is_virtual && -!adev->virtualization.caps & AMDGPU_VIRT_CAPS_SRIOV_EN)) { +!(adev->virtualization.caps & AMDGPU_VIRT_CAPS_SRIOV_EN))) { if (!adev->bios) { dev_err(adev->dev, "Card not posted and no BIOS - ignoring\n"); return -EINVAL;
[RFC PATCH 06/13] pinctrl: pinconf: Add generic helper function for freeing mappings
On Fri, Jun 17, 2016 at 2:03 PM, Jon Hunter wrote: > The pinconf-generic.h file exposes functions for creating generic mappings > but it does not expose a function for freeing the mappings. Add a function > for freeing generic mappings. > > Signed-off-by: Jon Hunter Looks reasonable. Can I apply it in isolation or do you need to keep it in your series with my ACK? Acked-by: Linus Walleij Yours, Linus Walleij
[Bug 92974] Fiji Nano long boot up and long X startup with amdgpu-powerplay enabled
https://bugs.freedesktop.org/show_bug.cgi?id=92974 --- Comment #17 from charlie --- The bios was updated from 0801 to 2603. The machine booted normally with an unpatched kernel. I restored previous overclocking settings and the long boot bug returned. Among testing a few bios parameters I found that adjusting "NB Configuration--PCIEX16_1"--like forcing auto(PCIEX16_2), X16 or X8--has no effect on the bug. "APU Frequency" or base clock is the only setting found to effect the long boot/startx bug. Any base clock values greater than 100 causes the bug. Underclocking CPU, NB and RAM has no effect when base clock is set to 101--the bug remains. This behavior did not occur before the commit mentioned earlier in this bug report thread as the base clock remained the same since before I first submitted the bug and until my recent testing today. With "amdgpu.pcie_gen_cap=0x00030003" applied through LILO this machine is capable of running at 104 base clock stable with system RAM near 2500mhz--without the long boot/startx bug. -- You are receiving this mail because: You are the assignee for the bug. -- next part -- An HTML attachment was scrubbed... URL: <https://lists.freedesktop.org/archives/dri-devel/attachments/20160618/a79b9ce0/attachment.html>
[PATCH -next] drm/hisilicon: Fix return value check in ade_dts_parse()
Thanks! On 2016/6/18 2:29, weiyj_lk at 163.com wrote: > From: Wei Yongjun > > In case of error, the function devm_clk_get() returns ERR_PTR() > and never returns NULL. The NULL test in the return value check > should be replaced with IS_ERR(). > > Signed-off-by: Wei Yongjun Reviewed-by: Chen Feng > --- > drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c | 12 ++-- > 1 file changed, 6 insertions(+), 6 deletions(-) > > diff --git a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c > b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c > index ed76baad..16834f4 100644 > --- a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c > +++ b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c > @@ -965,21 +965,21 @@ static int ade_dts_parse(struct platform_device *pdev, > struct ade_hw_ctx *ctx) > } > > ctx->ade_core_clk = devm_clk_get(dev, "clk_ade_core"); > - if (!ctx->ade_core_clk) { > + if (IS_ERR(ctx->ade_core_clk)) { > DRM_ERROR("failed to parse clk ADE_CORE\n"); > - return -ENODEV; > + return PTR_ERR(ctx->ade_core_clk); > } > > ctx->media_noc_clk = devm_clk_get(dev, "clk_codec_jpeg"); > - if (!ctx->media_noc_clk) { > + if (IS_ERR(ctx->media_noc_clk)) { > DRM_ERROR("failed to parse clk CODEC_JPEG\n"); > - return -ENODEV; > + return PTR_ERR(ctx->media_noc_clk); > } > > ctx->ade_pix_clk = devm_clk_get(dev, "clk_ade_pix"); > - if (!ctx->ade_pix_clk) { > + if (IS_ERR(ctx->ade_pix_clk)) { > DRM_ERROR("failed to parse clk ADE_PIX\n"); > - return -ENODEV; > + return PTR_ERR(ctx->ade_pix_clk); > } > > return 0; > > > > > > > . >
[PATCHv16 08/13] DocBook/media: add CEC documentation
On Fri, Jun 17, 2016 at 08:37:38AM -0300, Mauro Carvalho Chehab wrote: > Em Fri, 17 Jun 2016 13:09:10 +0200 > Hans Verkuil escreveu: > > > On 06/17/2016 11:50 AM, Mauro Carvalho Chehab wrote: > > One area where I am uncertain is when remote control messages are received > > and > > passed on by the framework to the RC input device. > > > > Suppose the application is the one receiving a password, then that password > > appears > > both in the input device and the cec device. What I think will be useful is > > if the > > application can prevent the use of an input device to pass on remote > > control messages. > > > > CEC_ADAP_S_LOG_ADDRS has a flags field that I intended for just that > > purpose. > > > > Note that RC messages are always passed on to CEC followers even if there > > is an > > input device since some RC messages have additional arguments that the rc > > subsystem > > can't handle. Also I think that it is often easier to handle all messages > > from the > > same CEC device instead of having to read from two devices (cec and input). > > I > > actually considered removing the input support, but it turned out to be > > useful in > > existing video streaming apps since they don't need to add special cec > > support to > > handle remote control presses. > > > > Question: is there a way for applications to get exclusive access to an > > input device? > > Or can anyone always read from it? > > That's a very good question. I did a quick test to check how this is > currently protected, by running: > > $ strace ir-keytable -t > ... > open("/dev/input/event12", O_RDONLY)= -1 EACCES (Permission denied) > ... > > It turns that the input device was created by udev with those > permissions: > > crw-rw 1 root input 13, 76 Jun 17 08:26 /dev/input/event12 > > Changing access to 666 allowed to run ir-keytable -t without the > need of being root. > > Yet, maybe there's a way to get exclusive access to input/event > device, but I never needed to go that deep at the input subsystem. > Maybe Dmitry could shed some light on that. Adding him in the loop. EVIOCGRAB ioctl will do what you want. Thanks. -- Dmitry
[drm] e28cd4d0a2: INFO: trying to register non-static key.
1.376371] [] kernel_init+0x8/0xcb [1.376806] [] ret_from_kernel_thread+0xe/0x30 [1.377322] [] ? rest_init+0x10e/0x10e [1.377754] Code: 89 fa e8 71 c5 b7 ff 8b 4e 04 89 fa 89 d8 e8 8e c6 b7 ff 8d 43 2c 89 45 d4 8b 43 30 8d 4b 2c 89 45 e8 89 7b 30 89 4d e4 8b 55 dc <89> 38 8d 43 3c 89 75 ec e8 c9 dd b7 ff eb 0c 31 c0 87 03 48 75 [1.380442] EIP: [] mutex_lock_nested+0x11f/0x2c3 SS:ESP 0068:d28dbec0 [1.381174] CR2: [1.381503] ---[ end trace e260f2ca50706006 ]--- [1.381966] Kernel panic - not syncing: Fatal exception FYI, raw QEMU command line is: qemu-system-i386 -enable-kvm -kernel /pkg/linux/i386-randconfig-b0-06172203/gcc-6/e28cd4d0a223e1bcea616326e2281900e7e7e9a2/vmlinuz-4.7.0-rc2-00564-ge28cd4d -append 'root=/dev/ram0 user=lkp job=/lkp/scheduled/vm-lkp-wsx03-yocto-i386-2/bisect_boot-1-yocto-minimal-i386.cgz-i386-randconfig-b0-06172203-e28cd4d0a223e1bcea616326e2281900e7e7e9a2-20160618-131023-156vzgq-0.yaml~ ARCH=i386 kconfig=i386-randconfig-b0-06172203 branch=linux-devel/devel-spot-201606172115 commit=e28cd4d0a223e1bcea616326e2281900e7e7e9a2 BOOT_IMAGE=/pkg/linux/i386-randconfig-b0-06172203/gcc-6/e28cd4d0a223e1bcea616326e2281900e7e7e9a2/vmlinuz-4.7.0-rc2-00564-ge28cd4d max_uptime=600 RESULT_ROOT=/result/boot/1/vm-lkp-wsx03-yocto-i386/yocto-minimal-i386.cgz/i386-randconfig-b0-06172203/gcc-6/e28cd4d0a223e1bcea616326e2281900e7e7e9a2/0 LKP_SERVER=inn earlyprintk=ttyS0,115200 systemd.log_level=err debug apic=debug sysrq_always_enabled rcupdate.rcu_cpu_stall_timeout=100 panic=-1 softlockup_panic=1 nmi_watchdog=panic oops=panic load_ramdisk=2 prompt_ramdisk=0 console=ttyS0,115200 console=tty0 vga=normal rw ip=vm-lkp-wsx03-yocto-i386-2::dhcp drbd.minor_count=8' -initrd /fs/sdc1/initrd-vm-lkp-wsx03-yocto-i386-2 -m 320 -smp 1 -device e1000,netdev=net0 -netdev user,id=net0 -boot order=nc -no-reboot -watchdog i6300esb -rtc base=localtime -drive file=/fs/sdc1/disk0-vm-lkp-wsx03-yocto-i386-2,media=disk,if=virtio -pidfile /dev/shm/kboot/pid-vm-lkp-wsx03-yocto-i386-2 -serial file:/dev/shm/kboot/serial-vm-lkp-wsx03-yocto-i386-2 -daemonize -display none -monitor null Thanks, Kernel Test Robot -- next part -- # # Automatically generated file; DO NOT EDIT. # Linux/i386 4.7.0-rc2 Kernel Configuration # # CONFIG_64BIT is not set CONFIG_X86_32=y CONFIG_X86=y CONFIG_INSTRUCTION_DECODER=y CONFIG_OUTPUT_FORMAT="elf32-i386" CONFIG_ARCH_DEFCONFIG="arch/x86/configs/i386_defconfig" CONFIG_LOCKDEP_SUPPORT=y CONFIG_STACKTRACE_SUPPORT=y CONFIG_MMU=y CONFIG_ARCH_MMAP_RND_BITS_MIN=8 CONFIG_ARCH_MMAP_RND_BITS_MAX=16 CONFIG_ARCH_MMAP_RND_COMPAT_BITS_MIN=8 CONFIG_ARCH_MMAP_RND_COMPAT_BITS_MAX=16 CONFIG_NEED_SG_DMA_LENGTH=y CONFIG_GENERIC_ISA_DMA=y CONFIG_GENERIC_BUG=y CONFIG_GENERIC_HWEIGHT=y CONFIG_ARCH_MAY_HAVE_PC_FDC=y CONFIG_RWSEM_XCHGADD_ALGORITHM=y CONFIG_GENERIC_CALIBRATE_DELAY=y CONFIG_ARCH_HAS_CPU_RELAX=y CONFIG_ARCH_HAS_CACHE_LINE_SIZE=y CONFIG_HAVE_SETUP_PER_CPU_AREA=y CONFIG_NEED_PER_CPU_EMBED_FIRST_CHUNK=y CONFIG_NEED_PER_CPU_PAGE_FIRST_CHUNK=y CONFIG_ARCH_HIBERNATION_POSSIBLE=y CONFIG_ARCH_SUSPEND_POSSIBLE=y CONFIG_ARCH_WANT_HUGE_PMD_SHARE=y CONFIG_ARCH_WANT_GENERAL_HUGETLB=y CONFIG_ARCH_SUPPORTS_OPTIMIZED_INLINING=y CONFIG_ARCH_SUPPORTS_DEBUG_PAGEALLOC=y CONFIG_X86_32_LAZY_GS=y CONFIG_ARCH_HWEIGHT_CFLAGS="-fcall-saved-ecx -fcall-saved-edx" CONFIG_ARCH_SUPPORTS_UPROBES=y CONFIG_FIX_EARLYCON_MEM=y CONFIG_DEBUG_RODATA=y CONFIG_PGTABLE_LEVELS=2 CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config" CONFIG_CONSTRUCTORS=y CONFIG_IRQ_WORK=y CONFIG_BUILDTIME_EXTABLE_SORT=y # # General setup # CONFIG_BROKEN_ON_SMP=y CONFIG_INIT_ENV_ARG_LIMIT=32 CONFIG_CROSS_COMPILE="" # CONFIG_COMPILE_TEST is not set CONFIG_LOCALVERSION="" CONFIG_LOCALVERSION_AUTO=y CONFIG_HAVE_KERNEL_GZIP=y CONFIG_HAVE_KERNEL_BZIP2=y CONFIG_HAVE_KERNEL_LZMA=y CONFIG_HAVE_KERNEL_XZ=y CONFIG_HAVE_KERNEL_LZO=y CONFIG_HAVE_KERNEL_LZ4=y # CONFIG_KERNEL_GZIP is not set # CONFIG_KERNEL_BZIP2 is not set # CONFIG_KERNEL_LZMA is not set # CONFIG_KERNEL_XZ is not set # CONFIG_KERNEL_LZO is not set CONFIG_KERNEL_LZ4=y CONFIG_DEFAULT_HOSTNAME="(none)" CONFIG_SWAP=y # CONFIG_SYSVIPC is not set # CONFIG_POSIX_MQUEUE is not set CONFIG_CROSS_MEMORY_ATTACH=y CONFIG_FHANDLE=y # CONFIG_USELIB is not set # CONFIG_AUDIT is not set CONFIG_HAVE_ARCH_AUDITSYSCALL=y # # IRQ subsystem # CONFIG_GENERIC_IRQ_PROBE=y CONFIG_GENERIC_IRQ_SHOW=y CONFIG_IRQ_DOMAIN=y CONFIG_IRQ_DOMAIN_HIERARCHY=y # CONFIG_IRQ_DOMAIN_DEBUG is not set CONFIG_IRQ_FORCED_THREADING=y CONFIG_SPARSE_IRQ=y CONFIG_CLOCKSOURCE_WATCHDOG=y CONFIG_ARCH_CLOCKSOURCE_DATA=y CONFIG_CLOCKSOURCE_VALIDATE_LAST_CYCLE=y CONFIG_GENERIC_TIME_VSYSCALL=y CONFIG_GENERIC_CLOCKEVENTS=y CONFIG_GENERIC_CLOCKEVENTS_BROADCAST=y CONFIG_GENERIC_CLOCKEVENTS_MIN_ADJUST=y CONFIG_GENERIC_CMOS_UPDATE=y # # Timers subsystem # CONFIG_TICK_ONESHOT=y CONFIG
[Intel-gfx] [PATCH 3/7] drm/atmel-hlcdc: Remove redundant calls to drm_connector_register_all()
On 17 June 2016 at 09:25, Chris Wilson wrote: > Up to now, the recommendation was for drivers to call drm_dev_register() > followed by drm_connector_register_all(). Now that > drm_connector_register() is safe against multiple invocations, we can > move drm_connector_register_all() to drm_dev_register() and not suffer > from any backwards compatibility issues with drivers not following the > more rigorous init ordering. > > Signed-off-by: Chris Wilson > Cc: Daniel Vetter > Cc: Boris Brezillon > Cc: David Airlie > Cc: dri-devel at lists.freedesktop.org > --- > drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c | 7 --- > 1 file changed, 7 deletions(-) > > diff --git a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c > b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c > index 9ecf16c7911d..99c4af697c8a 100644 > --- a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c > +++ b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c > @@ -815,15 +815,8 @@ static int atmel_hlcdc_dc_drm_probe(struct > platform_device *pdev) > if (ret) > goto err_unload; > > - ret = drm_connector_register_all(ddev); > - if (ret) > - goto err_unregister; > - > return 0; > > -err_unregister: > - drm_dev_unregister(ddev); > - > err_unload: > atmel_hlcdc_dc_unload(ddev); > This should also kill off atmel_hlcdc_dc_connector_unplug_all() ? The later of which has calls drm_connector_unregister_all() guarded by mode_config.mutex :-\ -Emil
[PATCH v6 2/2] drm/panel: Add JDI LT070ME05000 WUXGA DSI Panel
Hi Vinay, On 17 June 2016 at 19:23, Vinay Simha BN wrote: > v6: > * emil review comments incorporated >PANEL_NUM_REGULATORS dropped, return ret added at necessary >places, if checks dropped for backlight and gpios Looks like some of my suggestions went below the radar. Did you miss them or I've I lost the plot somewhere ? In case of the latter don't be shy to point out :-) > +struct jdi_panel { > + struct drm_panel base; > + struct mipi_dsi_device *dsi; > + > + struct regulator_bulk_data supplies[3]; > + struct regulator_bulk_data supplies[ARRAY_SIZE(regulator_names)]; > +static int jdi_panel_off(struct jdi_panel *jdi) > +{ > + struct mipi_dsi_device *dsi = jdi->dsi; > + int ret; > + > + dsi->mode_flags &= ~MIPI_DSI_MODE_LPM; > + > + ret = mipi_dsi_dcs_set_display_off(dsi); > + if (ret < 0) > + return ret; > + IMHO neither this function nor its caller jdi_panel_unprepare() should stop in the middle/return prematurely. Or in other words - one should change the function return type to void and drop the returns. > +static int jdi_panel_unprepare(struct drm_panel *panel) > +{ > + struct jdi_panel *jdi = to_jdi_panel(panel); > + struct device *dev = &jdi->dsi->dev; > + int ret; > + > + if (!jdi->prepared) > + return 0; > + > + ret = jdi_panel_off(jdi); > + if (ret) { > + dev_err(panel->dev, "failed to set panel off: %d\n", ret); > + return ret; As suggested above, drop this return. > +static int jdi_panel_prepare(struct drm_panel *panel) > +{ > + struct jdi_panel *jdi = to_jdi_panel(panel); > + struct device *dev = &jdi->dsi->dev; > + int ret; > + > + if (jdi->prepared) > + return 0; > + > + ret = regulator_bulk_enable(ARRAY_SIZE(jdi->supplies), jdi->supplies); > + if (ret < 0) { > + dev_err(dev, "regulator enable failed, %d\n", ret); > + return ret; > + } > + > + msleep(20); > + > + if (jdi->reset_gpio) { You can drop the check. > + gpiod_set_value(jdi->reset_gpio, 1); > + usleep_range(10, 20); > + } > + > + if (jdi->enable_gpio) { Ditto. > + > +poweroff: > + gpiod_set_value(jdi->enable_gpio, 0); > + gpiod_set_value(jdi->reset_gpio, 0); > + Just noticed that you're missing regulator_bulk_disable() here. Regards, Emil
[PATCH 13/16] drm: Refactor drop/set master code a bit
On 18 June 2016 at 00:00, Emil Velikov wrote: >> @@ -134,24 +152,21 @@ static int drm_new_set_master(struct drm_device *dev, >> struct drm_file *fpriv) >> >> /* take another reference for the copy in the local file priv */ >> old_master = fpriv->master; >> - fpriv->master = drm_master_get(dev->master); >> + fpriv->master = drm_master_create(dev); To avoid the leak just drop the fpriv->minor->dev->master = drm_master_create() a few lines above (+ the associated comment/error handling drm_master_put(fpriv->minor->dev->master)) >> + if (!fpriv->master) >> + return -ENOMEM; >> ... and restore the old_master before the return "fpriv->master = old_master;" With that and the other minor comments the series is Reviewed-by: Emil Velikov Thanks Emil
[PATCH 16/16] drm: document drm_auth.c
On 17 June 2016 at 08:33, Daniel Vetter wrote: > Also extract drm_auth.h for nicer grouping. > > v2: Nuke the other comments since they don't really explain a lot, and > within the drm core we generally only document functions exported to > drivers: The main audience for these docs are driver writers. > > v3: Limit the exposure of drm_master internals by only including > drm_auth.h where it is neede (Chris). > > Cc: Chris Wilson > Signed-off-by: Daniel Vetter > --- > Documentation/DocBook/gpu.tmpl | 6 > drivers/gpu/drm/drm_auth.c | 69 > + > drivers/gpu/drm/drm_crtc.c | 1 + > drivers/gpu/drm/drm_ioctl.c | 1 + > drivers/gpu/drm/i915/i915_drv.h | 1 + > drivers/gpu/drm/vmwgfx/vmwgfx_drv.h | 1 + > include/drm/drmP.h | 30 +--- > include/drm/drm_auth.h | 59 +++ > include/drm/drm_legacy.h| 2 ++ > 9 files changed, 112 insertions(+), 58 deletions(-) > create mode 100644 include/drm/drm_auth.h > > diff --git a/Documentation/DocBook/gpu.tmpl b/Documentation/DocBook/gpu.tmpl > index 94c6bdee8080..b7f6316b7bee 100644 > --- a/Documentation/DocBook/gpu.tmpl > +++ b/Documentation/DocBook/gpu.tmpl > @@ -3103,6 +3103,12 @@ int num_ioctls; > !Pdrivers/gpu/drm/drm_vma_manager.c getunique and setversion story > > > + Primary Nodes, DRM Master and Authentication > +!Pdrivers/gpu/drm_auth.c master and authentication > +!Edrivers/gpu/drm_auth.c > +!Einclude/drm/drm_auth.h > + > + >Render nodes > > DRM core provides multiple character-devices for user-space to use. > diff --git a/drivers/gpu/drm/drm_auth.c b/drivers/gpu/drm/drm_auth.c > index b4dfa8ab20d7..3774b9964dbe 100644 > --- a/drivers/gpu/drm/drm_auth.c > +++ b/drivers/gpu/drm/drm_auth.c > @@ -32,18 +32,27 @@ > #include "drm_internal.h" > #include "drm_legacy.h" > > -/** > - * drm_getmagic - Get unique magic of a client > - * @dev: DRM device to operate on > - * @data: ioctl data containing the drm_auth object > - * @file_priv: DRM file that performs the operation > +/** DOC: master and authentication > + * > + * struct &drm_master is used to track groups of clients with open > + * primary/legacy device nodes. For every struct &drm_file which at least > once s/which at least/which has had at least/ > + * successfully became the device master (either through the SET_MASTER > IOCTL, > + * or implicitly through opening the primary device node when no one else is > the > + * current master that time) there exists one &drm_master. This is noted in > the/ > + * is_master member of &drm_master. All other clients have just a pointer to > the s/member of &drm_master/member of &drm_file/ > + * &drm_master they are associated with. > * > - * This looks up the unique magic of the passed client and returns it. If the > - * client did not have a magic assigned, yet, a new one is registered. The > magic > - * is stored in the passed drm_auth object. > + * In addition only one &drm_master can be the current master for a > &drm_device. > + * It can be switched through the DROP_MASTER and SET_MASTER IOCTL, or > + * implicitly through closing/openeing the primary device node. See also > + * drm_is_current_master(). > * > - * Returns: 0 on success, negative error code on failure. > + * Clients can authenticate against the current master (if it matches their > own) > + * using the GETMAGIC and AUTHMAGIC IOCTLs. Together with exchanging masters, > + * this allows controlled access to the device for an entire group of > mutually > + * trusted clients. > */ > + > int drm_getmagic(struct drm_device *dev, void *data, struct drm_file > *file_priv) > { > struct drm_auth *auth = data; > @@ -64,16 +73,6 @@ int drm_getmagic(struct drm_device *dev, void *data, > struct drm_file *file_priv) > return ret < 0 ? ret : 0; > } > > -/** > - * drm_authmagic - Authenticate client with a magic > - * @dev: DRM device to operate on > - * @data: ioctl data containing the drm_auth object > - * @file_priv: DRM file that performs the operation > - * > - * This looks up a DRM client by the passed magic and authenticates it. > - * > - * Returns: 0 on success, negative error code on failure. > - */ Why is this and drm_getmagic()'s documetation going away ? Kernel doc isn't restricted to EXPORTED_SYMBOL(s) only, is it ? > int drm_authmagic(struct drm_device *dev, void *data, > struct drm_file *file_priv) > { > @@ -126,16 +125,6 @@ static int drm_set_master(struct drm_device *dev, struct > drm_file *fpriv, > return ret; > } > > -/* > - * drm_new_set_master - Allocate a new master object and become master for > the > - * associated master realm. > - * > - * @dev: The associated device. > - * @fpriv: File private identifying the client. > - * > - * This function must be called with dev::master_mutex held. > - * Returns negative erro
[drm] e28cd4d0a2: INFO: trying to register non-static key.
On Sat, Jun 18, 2016 at 12:19 AM, Chris Wilson wrote: > On Sat, Jun 18, 2016 at 05:24:30AM +0800, kernel test robot wrote: >> >> >> FYI, we noticed the following commit: >> >> git://anongit.freedesktop.org/drm-intel topic/drm-misc >> commit e28cd4d0a223e1bcea616326e2281900e7e7e9a2 ("drm: Automatically >> register/unregister all connectors") >> >> >> on test machine: vm-lkp-wsx03-yocto-i386: 1 threads qemu-system-i386 >> -enable-kvm with 320M memory >> >> caused below changes: > > So one driver skips drm_mode_config_init() and so > drm_connector_register_all() dies on the mutex_lock(). > > Maybe > > if (list_empty_safe(&dev->mode_config.connector_list)) > return; > > or we could add a boolean to indicate an active mode_config? list_empty_safe seems to be the simplest solution, I'd go with that one. -Daniel -- Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch
[PATCH 15/16] drm: Clear up master tracking booleans
On 17 June 2016 at 08:33, Daniel Vetter wrote: > @@ -315,10 +313,10 @@ struct drm_file { > /* true if client understands atomic properties */ > unsigned atomic:1; > /* > -* This client is allowed to gain master privileges for @master. > +* This client is the create the master. You've missed a word here. -Emil
[PATCH 13/16] drm: Refactor drop/set master code a bit
Hi Daniel, It doesn't look quite right I'm afraid. This causes a leak plus there's a small style issue. See below for details. On 17 June 2016 at 08:33, Daniel Vetter wrote: > @@ -134,24 +152,21 @@ static int drm_new_set_master(struct drm_device *dev, > struct drm_file *fpriv) > > /* take another reference for the copy in the local file priv */ > old_master = fpriv->master; > - fpriv->master = drm_master_get(dev->master); > + fpriv->master = drm_master_create(dev); > + if (!fpriv->master) > + return -ENOMEM; > Now dev->master != fpriv->master > if (dev->driver->master_create) { > ret = dev->driver->master_create(dev, fpriv->master); > if (ret) > goto out_err; > } > - if (dev->driver->master_set) { > - ret = dev->driver->master_set(dev, fpriv, true); > - if (ret) > - goto out_err; > - } > - > - fpriv->is_master = 1; > fpriv->allowed_master = 1; > fpriv->authenticated = 1; > - if (old_master) > - drm_master_put(&old_master); > + > + ret = drm_set_master(dev, fpriv, true); > +static int drm_set_master(struct drm_device *dev, struct drm_file *fpriv, > + bool new_master) > +{ > + int ret = 0; > + > + dev->master = drm_master_get(fpriv->master); drm_master_get() is defined as follows kref_get(&master->refcount); return master; Since dev->master != fpriv->master, we'll leak the former. > +void drm_drop_master(struct drm_device *dev, > +struct drm_file *fpriv) Function is used only locally thus it should be static. Regards, Emil