[drm:drm-next-amd-dc-staging 8/9] drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm.c:581:2: error: implicit declaration of function 'for_each_connector_in_state'

2017-10-08 Thread kbuild test robot
tree:   git://people.freedesktop.org/~airlied/linux.git drm-next-amd-dc-staging
head:   e7b8e99bed73e9c42f1c074ad6009cb59a79bd52
commit: b9e56e41e0c55c2b2ab5919c5e167faa4200b083 [8/9] Merge branch 
'drm-next-4.15-dc' of git://people.freedesktop.org/~agd5f/linux into drm-next
config: ia64-allmodconfig (attached as .config)
compiler: ia64-linux-gcc (GCC) 6.2.0
reproduce:
wget 
https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O 
~/bin/make.cross
chmod +x ~/bin/make.cross
git checkout b9e56e41e0c55c2b2ab5919c5e167faa4200b083
# save the attached .config to linux build tree
make.cross ARCH=ia64 

Note: the drm/drm-next-amd-dc-staging HEAD 
e7b8e99bed73e9c42f1c074ad6009cb59a79bd52 builds fine.
  It only hurts bisectibility.

All error/warnings (new ones prefixed by >>):

   drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm.c: In function 
'amdgpu_dm_find_first_crct_matching_connector':
>> drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm.c:581:2: error: 
>> implicit declaration of function 'for_each_connector_in_state' 
>> [-Werror=implicit-function-declaration]
 for_each_connector_in_state(
 ^~~
>> drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm.c:585:6: error: 
>> expected ';' before '{' token
  i) {
 ^
   drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm.c:579:19: warning: 
unused variable 'crtc_from_state' [-Wunused-variable]
 struct drm_crtc *crtc_from_state;
  ^~~
   drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm.c: In function 
'amdgpu_dm_display_resume':
>> drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm.c:655:2: error: 
>> implicit declaration of function 'for_each_crtc_in_state' 
>> [-Werror=implicit-function-declaration]
 for_each_crtc_in_state(adev->dm.cached_state, crtc, crtc_state, i)
 ^~
>> drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm.c:656:4: error: 
>> expected ';' before 'crtc_state'
   crtc_state->active_changed = true;
   ^~
   drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm.c: In function 
'amdgpu_dm_commit_planes':
>> drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm.c:3893:2: error: 
>> implicit declaration of function 'for_each_plane_in_state' 
>> [-Werror=implicit-function-declaration]
 for_each_plane_in_state(state, plane, old_plane_state, i) {
 ^~~
   drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm.c:3893:60: error: 
expected ';' before '{' token
 for_each_plane_in_state(state, plane, old_plane_state, i) {
   ^
   drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm.c:3890:16: 
warning: unused variable 'flags' [-Wunused-variable]
 unsigned long flags;
   ^
   drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm.c:3889:6: warning: 
unused variable 'planes_count' [-Wunused-variable]
 int planes_count = 0;
 ^~~~
   drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm.c:3888:24: 
warning: unused variable 'acrtc_state' [-Wunused-variable]
 struct dm_crtc_state *acrtc_state = to_dm_crtc_state(pcrtc->state);
   ^~~
   drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm.c:3887:22: 
warning: unused variable 'acrtc_attach' [-Wunused-variable]
 struct amdgpu_crtc *acrtc_attach = to_amdgpu_crtc(pcrtc);
 ^~~~
   drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm.c:3886:25: 
warning: unused variable 'plane_states_constructed' [-Wunused-variable]
 struct dc_plane_state *plane_states_constructed[MAX_SURFACES];
^~~~
   drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm.c:3885:26: 
warning: unused variable 'dc_stream_attach' [-Wunused-variable]
 struct dc_stream_state *dc_stream_attach;
 ^~~~
   drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm.c: In function 
'amdgpu_dm_atomic_commit':
   drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm.c:3990:52: error: 
expected ';' before '{' token
 for_each_crtc_in_state(state, crtc, new_state, i) {
   ^
   drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm.c:3980:24: 
warning: unused variable 'adev' [-Wunused-variable]
 struct amdgpu_device *adev = dev->dev_private;
   ^~~~
   drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm.c: In function 
'amdgpu_dm_atomic_commit_tail':
   drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm.c:4027:57: error: 
expected ';' before '{' token
 for_each_crtc_in_state(state, crtc, old_crtc_state, i) {
^
   

Re: [amd-staging-drm-next] regression - no fan info (sensors) on RX580

2017-10-08 Thread Dieter Nützel

OK, got it but can't revert the commit clean.

amdgpu-pci-0100
Adapter: PCI adapter
fan1: 873 RPM
temp1:+26.0°C  (crit =  +0.0°C, hyst =  +0.0°C)

SOURCE/amd-staging-drm-next> git bisect good
0944c350c8eddf4064e7abb881dd245032fdfa23 is the first bad commit
commit 0944c350c8eddf4064e7abb881dd245032fdfa23
Author: Rex Zhu 
Date:   Mon Sep 25 18:51:50 2017 +0800

drm/amdgpu: delete pp_enable in adev

amdgpu not care powerplay or dpm is enabled.
just check ip functions and pp functions

Change-Id: Iaac75d45170ef9b20e212465f837eaaa798365bd
Reviewed-by: Alex Deucher 
Signed-off-by: Rex Zhu 

:04 04 72361654709479890586e383ec73088e535a1cf5 
2b6d5a75ffc3b6fd48c63e79bf28faddcc734918 M drivers


Greetings,
Dieter


Am 09.10.2017 02:19, schrieb Dieter Nützel:

Sorry Rex,

after return from our vacation,
I've tested latest amd-staging-drm-next (e5f6a57e350a)
but it is NOT solved on my RX580.
I'll try bisecting if I find some more time in the coming days.

amdgpu-pci-0100
Adapter: PCI adapter
temp1:+27.0°C  (crit =  +0.0°C, hyst =  +0.0°C)

01:00.0 VGA compatible controller: Advanced Micro Devices, Inc.
[AMD/ATI] Ellesmere [Radeon RX 470/480/570/580] (rev e7) (prog-if 00
[VGA controller])
Subsystem: Sapphire Technology Limited Radeon RX 570

[36.740] (--) AMDGPU(0): Chipset: "Radeon RX 580 Series" (ChipID = 
0x67df)


Thanks,
Dieter

Am 30.09.2017 05:09, schrieb Zhu, Rex:

Yes, caused by the commit e37a7b4088da
("drm/amd/powerplay: tidy up ret checks in amd_powerplay.c")

Replace error when split patches.

Have sent the fix patch.
Please review.

Best Regards
Rex


-Original Message-
From: Alex Deucher [mailto:alexdeuc...@gmail.com]
Sent: Friday, September 29, 2017 10:11 PM
To: Dieter Nützel; Zhu, Rex
Cc: amd-devel; DRI Devel; Wentland, Harry; Michel Dänzer
Subject: Re: [amd-staging-drm-next] regression - no fan info (sensors) 
on RX580


Rex, probably related to the recent cleanups in powerplay.

On Fri, Sep 29, 2017 at 10:09 AM, Dieter Nützel  
wrote:

Hello all,

since latest update

1d7da702e70d3c27408a3bb312c71d6be9f7bebe
drm/amd/powerplay: fix spelling mistake: "dividable" -> "divisible"

I didn't get fan info with my RX580 (Polaris21) any longer.

Worked with this commit:

786df0b89fe5a0b405d4de0a1ce03003c0743ec3
drm/amd/display: fix pflip irq registor for raven

Sorry, I do not have full time for bisect, because we are on way to
our vacation.

Maybe in the evening (only a few commits).

Greetings,
Dieter

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[pull] radeon, amdgpu, and ttm drm-next-4.15

2017-10-08 Thread Alex Deucher
Hi Dave,

More new stuff for 4.15. Highlights:
- Add clock query interface for raven
- Add new FENCE_TO_HANDLE ioctl
- UVD video encode ring support on polaris
- transparent huge page DMA support
- deadlock fixes
- compute pipe lru tweaks
- powerplay cleanups and regression fixes
- fix duplicate symbol issue with radeon and amdgpu
- misc bug fixes

The following changes since commit 6f87a895709eecc1542fe947e349364ad061ac00:

  drm/amdgpu: clarify license in amdgpu_trace_points.c (2017-09-26 15:14:37 
-0400)

are available in the git repository at:

  git://people.freedesktop.org/~agd5f/linux drm-next-4.15

for you to fetch changes up to d3f04c98ead2b89887e1e3c09b26e4917bacdd9e:

  drm/radeon/dp: make radeon_dp_get_dp_link_config static (2017-10-08 20:16:29 
-0400)


Alex Deucher (3):
  drm/amdgpu: fix vf error handling
  drm/radeon: move ci_send_msg_to_smc to where it's used
  drm/radeon/dp: make radeon_dp_get_dp_link_config static

Andres Rodriguez (3):
  drm/amdgpu: use multipipe compute policy on non PL11 asics
  drm/amdgpu: add option for force enable multipipe policy for compute
  drm/amdgpu: map compute rings by least recently used pipe

Christian König (4):
  drm/ttm: remove unsued options from ttm_mem_global_alloc_page
  drm/ttm: add support for different pool sizes
  drm/ttm: add transparent huge page support for DMA allocations v2
  drm/amdgpu: minor coding style fix

Colin Ian King (2):
  drm/amd/powerplay: fix spelling mistake: "dividable" -> "divisible"
  drm/radeon: make functions alloc_pasid and free_pasid static

Dave Airlie (17):
  amdgpu: don't ask about CHASH just default it for now.
  amdgpu/powerplay: constify large struct
  drm/amdgpu/pp: constify some powerplay tables
  drm/amdgpu/vega10: static constify channel_number
  amdgpu/pp: remove ci_smc/smumgr split.
  amdgpu/pp: move PhwVega10_Magic to static const.
  amdgpu/pp: move amdgpu_fuses_default into static const.
  amdgpu/pp: slim down the pwr virus tables.
  drm/amdgpu: use designated initialiser for thermal_irq_src.
  amdgpu/pp: reduce size of vega10_fuses_default
  amdgfx/gfx: don't use static objects for ce/de meta. (v2)
  amdgpu/pp: use array_size to size the pwrvirus tables.
  amdgpu/pp: constify soft_dummy_pp_table.
  amdgpu/soc15: make the pcie index/data registers constant.
  amdgpu/nbio: use constant nbio_hdp_flush_reg structs.
  amdgpu/pp: rewrite polaris pwrvirus upload code.
  amdgpu/pp: rewrite fiji pwr virus upload code.

Evan Quan (6):
  drm/amd/powerplay: fixed wrong return value on error (v2)
  drm/amd/powerplay: added new raven ppsmc messages
  drm/amd/powerplay: get raven max/min gfx clocks (v2)
  drm/amd/powerplay: get raven current sclk and mclk (v2)
  drm/amd/powerplay: get raven sclk and mclk levels (v2)
  drm/amd/powerplay: fix typo on avfs disable

Felix Kuehling (2):
  drm/amd/chash: Fix typo
  drm/amdgpu: Handle GPUVM fault storms

Horace Chen (1):
  drm/amdgpu: Add a new flag for SR-IOV to share memory between PF & VF

James Zhu (9):
  drm/amdgpu: add uvd enc registers in header
  drm/amdgpu: add uvd enc command in header
  drm/amdgpu: add new uvd enc ring methods
  drm/amdgpu: add uvd enc rings
  drm/amdgpu: add uvd enc into run queue
  drm/amdgpu: add uvd enc vm functions (v2)
  drm/amdgpu: add uvd enc ring test
  drm/amdgpu: add uvd enc ib test
  drm/amdgpu: add uvd enc irq

Marek Olšák (3):
  drm/syncobj: extract two helpers from drm_syncobj_create
  drm/syncobj: add a new helper drm_syncobj_get_fd
  drm/amdgpu: add FENCE_TO_HANDLE ioctl that returns syncobj or sync_file

Nicolai Hähnle (5):
  drm/amd/sched: rename amd_sched_entity_pop_job
  drm/amd/sched: fix an outdated comment
  drm/amd/sched: move adding finish callback to amd_sched_job_begin
  drm/amd/sched: NULL out the s_fence field after run_job
  drm/amd/sched: fix deadlock caused by unsignaled fences of deleted jobs

Rex Zhu (15):
  drm/amdgpu: move common pm sysfs code to amdgpu_device.c
  drm/amdgpu: move amdgpu_ucode_init_bo to amdgpu_device.c
  drm/amd/powerplay: fix memory leak in powerplay
  drm/amdgpu: delete dead code about fw load check
  drm/amdgpu: delete pp_enable in adev
  drm/amdgpu: add cgs interface to register pp handle
  drm/amdgpu: create powerplay by cgs interface
  drm/amd/powerplay: change dmesg log level in powerplay
  drm/amdgpu: add comments in struct amd_pm_funcs define
  drm/amd/powerplay: export new interfaces in amd_pm_funcs
  drm/amd/powerplay: refine code in amd_powerplay.c (v2)
  drm/amd/powerplay: tidy up ret checks in amd_powerplay.c (v3)
  drm/amd/powerplay: move set_clockgating_by_smu to pp func table
  drm/amd/powerplay: delete flag PP_VALID
  drm/amd/powerplay: 

Re: [amd-staging-drm-next] regression - no fan info (sensors) on RX580

2017-10-08 Thread Dieter Nützel

Sorry Rex,

after return from our vacation,
I've tested latest amd-staging-drm-next (e5f6a57e350a)
but it is NOT solved on my RX580.
I'll try bisecting if I find some more time in the coming days.

amdgpu-pci-0100
Adapter: PCI adapter
temp1:+27.0°C  (crit =  +0.0°C, hyst =  +0.0°C)

01:00.0 VGA compatible controller: Advanced Micro Devices, Inc. 
[AMD/ATI] Ellesmere [Radeon RX 470/480/570/580] (rev e7) (prog-if 00 
[VGA controller])

Subsystem: Sapphire Technology Limited Radeon RX 570

[36.740] (--) AMDGPU(0): Chipset: "Radeon RX 580 Series" (ChipID = 
0x67df)


Thanks,
Dieter

Am 30.09.2017 05:09, schrieb Zhu, Rex:

Yes, caused by the commit e37a7b4088da
("drm/amd/powerplay: tidy up ret checks in amd_powerplay.c")

Replace error when split patches.

Have sent the fix patch.
Please review.

Best Regards
Rex


-Original Message-
From: Alex Deucher [mailto:alexdeuc...@gmail.com]
Sent: Friday, September 29, 2017 10:11 PM
To: Dieter Nützel; Zhu, Rex
Cc: amd-devel; DRI Devel; Wentland, Harry; Michel Dänzer
Subject: Re: [amd-staging-drm-next] regression - no fan info (sensors) 
on RX580


Rex, probably related to the recent cleanups in powerplay.

On Fri, Sep 29, 2017 at 10:09 AM, Dieter Nützel  
wrote:

Hello all,

since latest update

1d7da702e70d3c27408a3bb312c71d6be9f7bebe
drm/amd/powerplay: fix spelling mistake: "dividable" -> "divisible"

I didn't get fan info with my RX580 (Polaris21) any longer.

Worked with this commit:

786df0b89fe5a0b405d4de0a1ce03003c0743ec3
drm/amd/display: fix pflip irq registor for raven

Sorry, I do not have full time for bisect, because we are on way to
our vacation.

Maybe in the evening (only a few commits).

Greetings,
Dieter

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[Bug 29725] EXT_framebuffer_object extension with free radeon driver

2017-10-08 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=29725

Timothy Arceri  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution|--- |FIXED

--- Comment #7 from Timothy Arceri  ---
Assuming fixed.

-- 
You are receiving this mail because:
You are the assignee for the bug.___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[Bug 92755] [APITRACE] Shadow of Mordor locks up R600

2017-10-08 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=92755

vitor@gmail.com changed:

   What|Removed |Added

 CC||vitor@gmail.com

--- Comment #5 from vitor@gmail.com ---
I think I have a similar problem in R9 280X.
My lockups don't result in a kernel panic and the system simply stops, but I
also have the "ring 0/3 stalled for more than Xmsec" messages prior to the
lockup.
Eventually I also end up with the following messages:

[drm:atom_op_jump [radeon]] *ERROR* atombios stuck in loop for more than 5secs
aborting
[drm:atom_execute_table_locked [radeon]] *ERROR* atombios stuck executing CFB6
(len 62, WS 0, PS 0) @ 0xCFD2
[drm:atom_op_jump [radeon]] *ERROR* atombios stuck in loop for more than 5secs
aborting
[drm:atom_execute_table_locked [radeon]] *ERROR* atombios stuck executing CFB6
(len 62, WS 0, PS 0) @ 0xCFD2

Please ask for more information and I'll abide.

Note: currently on Linux 4.13 and using latest Padoka mesa packages.

-- 
You are receiving this mail because:
You are the assignee for the bug.___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH] drm: vc4: Fix race during binding

2017-10-08 Thread Eric Anholt
Stefan Wahren  writes:

> Hi Eric,
>
>> Eric Anholt  hat am 6. Oktober 2017 um 21:42 geschrieben:
>> 
>> 
>> Stefan Wahren  writes:
>> 
>> > This fixes the race between vc4_overflow_mem_work and the init of the
>> > job lock. Otherwise we could trigger a NULL pointer dereference
>> > during VC4 binding.
>> >
>> > Link: https://github.com/anholt/linux/issues/114
>> > Signed-off-by: Stefan Wahren 
>> > Fixes: d5b1a78a772f ("drm/vc4: Add support for drawing 3D frames.")
>> > ---
>> >  drivers/gpu/drm/vc4/vc4_gem.c | 1 -
>> >  drivers/gpu/drm/vc4/vc4_irq.c | 1 +
>> >  2 files changed, 1 insertion(+), 1 deletion(-)
>> >
>> > diff --git a/drivers/gpu/drm/vc4/vc4_gem.c b/drivers/gpu/drm/vc4/vc4_gem.c
>> > index d0c6bfb..47d964f 100644
>> > --- a/drivers/gpu/drm/vc4/vc4_gem.c
>> > +++ b/drivers/gpu/drm/vc4/vc4_gem.c
>> > @@ -1088,7 +1088,6 @@ vc4_gem_init(struct drm_device *dev)
>> >INIT_LIST_HEAD(>render_job_list);
>> >INIT_LIST_HEAD(>job_done_list);
>> >INIT_LIST_HEAD(>seqno_cb_list);
>> > -  spin_lock_init(>job_lock);
>> >  
>> >INIT_WORK(>hangcheck.reset_work, vc4_reset_work);
>> >setup_timer(>hangcheck.timer,
>> > diff --git a/drivers/gpu/drm/vc4/vc4_irq.c b/drivers/gpu/drm/vc4/vc4_irq.c
>> > index 7d7af3a..d508d13 100644
>> > --- a/drivers/gpu/drm/vc4/vc4_irq.c
>> > +++ b/drivers/gpu/drm/vc4/vc4_irq.c
>> > @@ -195,6 +195,7 @@ vc4_irq_preinstall(struct drm_device *dev)
>> >struct vc4_dev *vc4 = to_vc4_dev(dev);
>> >  
>> >init_waitqueue_head(>job_wait_queue);
>> > +  spin_lock_init(>job_lock);
>> >INIT_WORK(>overflow_mem_work, vc4_overflow_mem_work);
>> >  
>> >/* Clear any pending interrupts someone might have left around
>> 
>> Are you sure this is a fix?  We don't attach the IRQ handler until V3D
>> bind, and vc4_gem_init happens before component_bind_all(), right?
>
> i agree i should have mark it as a RFC. But is it really impossible
> that vc4_overflow_mem_work is triggered before vc4_gem_init?

As far as I can see, it gets queued from the IRQ handler, the IRQ
handler is added during V3D bind, and binding happens after GEM init.

Hmm.  If we fail out of component binding and try again, we'll end up
doing the job_wait_queue and overflow_mem_work initialization on the
same pointer twice.  Will that cause any trouble?  We cancel any pending
work during uninstall (V3D unbind path), but does drm_irq_uninstall()
make sure that the irq handler has finished?


signature.asc
Description: PGP signature
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[Bug 50325] Glyphy bad render on r600g (software render is fine) - too many registers?

2017-10-08 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=50325

--- Comment #8 from Gert Wollny  ---
Could you re-test with the latest mesa-git? As of mid September some patches
landed that improved the register use. 

I myself tried it on an AMD 6850 HD and the trace works fine now.

-- 
You are receiving this mail because:
You are the assignee for the bug.___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH v3] drm/tinydrm: Replace dev_error with DRM_DEV_ERROR

2017-10-08 Thread Harsha Sharma
Convert instances of dev_error to DRM_DEV_ERROR as we have
DRM_DEV_ERROR variants of drm print macros.

Signed-off-by: Harsha Sharma 
---
Changes in v3:
 -Solve merge conflicts
Changes in v2:
 -Fix alignment issues
 drivers/gpu/drm/tinydrm/mi0283qt.c |  8 
 drivers/gpu/drm/tinydrm/repaper.c  | 28 +---
 drivers/gpu/drm/tinydrm/st7586.c   |  6 +++---
 3 files changed, 20 insertions(+), 22 deletions(-)

diff --git a/drivers/gpu/drm/tinydrm/mi0283qt.c 
b/drivers/gpu/drm/tinydrm/mi0283qt.c
index 7e5bb7d6f655..7dded506ba8c 100644
--- a/drivers/gpu/drm/tinydrm/mi0283qt.c
+++ b/drivers/gpu/drm/tinydrm/mi0283qt.c
@@ -31,7 +31,7 @@ static int mi0283qt_init(struct mipi_dbi *mipi)
 
ret = regulator_enable(mipi->regulator);
if (ret) {
-   dev_err(dev, "Failed to enable regulator %d\n", ret);
+   DRM_DEV_ERROR(dev, "Failed to enable regulator %d\n", ret);
return ret;
}
 
@@ -42,7 +42,7 @@ static int mi0283qt_init(struct mipi_dbi *mipi)
mipi_dbi_hw_reset(mipi);
ret = mipi_dbi_command(mipi, MIPI_DCS_SOFT_RESET);
if (ret) {
-   dev_err(dev, "Error sending command %d\n", ret);
+   DRM_DEV_ERROR(dev, "Error sending command %d\n", ret);
regulator_disable(mipi->regulator);
return ret;
}
@@ -175,13 +175,13 @@ static int mi0283qt_probe(struct spi_device *spi)
 
mipi->reset = devm_gpiod_get_optional(dev, "reset", GPIOD_OUT_HIGH);
if (IS_ERR(mipi->reset)) {
-   dev_err(dev, "Failed to get gpio 'reset'\n");
+   DRM_DEV_ERROR(dev, "Failed to get gpio 'reset'\n");
return PTR_ERR(mipi->reset);
}
 
dc = devm_gpiod_get_optional(dev, "dc", GPIOD_OUT_LOW);
if (IS_ERR(dc)) {
-   dev_err(dev, "Failed to get gpio 'dc'\n");
+   DRM_DEV_ERROR(dev, "Failed to get gpio 'dc'\n");
return PTR_ERR(dc);
}
 
diff --git a/drivers/gpu/drm/tinydrm/repaper.c 
b/drivers/gpu/drm/tinydrm/repaper.c
index 30dc97b3ff21..028d428d4ab9 100644
--- a/drivers/gpu/drm/tinydrm/repaper.c
+++ b/drivers/gpu/drm/tinydrm/repaper.c
@@ -473,8 +473,7 @@ static void repaper_get_temperature(struct repaper_epd *epd)
 
ret = thermal_zone_get_temp(epd->thermal, );
if (ret) {
-   dev_err(>spi->dev, "Failed to get temperature (%d)\n",
-   ret);
+   DRM_DEV_ERROR(>spi->dev, "Failed to get temperature 
(%d)\n", ret);
return;
}
 
@@ -629,7 +628,7 @@ static int repaper_fb_dirty(struct drm_framebuffer *fb,
mutex_unlock(>dirty_lock);
 
if (ret)
-   dev_err(fb->dev->dev, "Failed to update display (%d)\n", ret);
+   DRM_DEV_ERROR(fb->dev->dev, "Failed to update display (%d)\n", 
ret);
kfree(buf);
 
return ret;
@@ -703,7 +702,7 @@ static void repaper_pipe_enable(struct 
drm_simple_display_pipe *pipe,
}
 
if (!i) {
-   dev_err(dev, "timeout waiting for panel to become ready.\n");
+   DRM_DEV_ERROR(dev, "timeout waiting for panel to become 
ready.\n");
power_off(epd);
return;
}
@@ -725,9 +724,9 @@ static void repaper_pipe_enable(struct 
drm_simple_display_pipe *pipe,
ret = repaper_read_val(spi, 0x0f);
if (ret < 0 || !(ret & 0x80)) {
if (ret < 0)
-   dev_err(dev, "failed to read chip (%d)\n", ret);
+   DRM_DEV_ERROR(dev, "failed to read chip (%d)\n", ret);
else
-   dev_err(dev, "panel is reported broken\n");
+   DRM_DEV_ERROR(dev, "panel is reported broken\n");
power_off(epd);
return;
}
@@ -767,7 +766,7 @@ static void repaper_pipe_enable(struct 
drm_simple_display_pipe *pipe,
/* check DC/DC */
ret = repaper_read_val(spi, 0x0f);
if (ret < 0) {
-   dev_err(dev, "failed to read chip (%d)\n", ret);
+   DRM_DEV_ERROR(dev, "failed to read chip (%d)\n", ret);
power_off(epd);
return;
}
@@ -779,7 +778,7 @@ static void repaper_pipe_enable(struct 
drm_simple_display_pipe *pipe,
}
 
if (!dc_ok) {
-   dev_err(dev, "dc/dc failed\n");
+   DRM_DEV_ERROR(dev, "dc/dc failed\n");
power_off(epd);
return;
}
@@ -959,7 +958,7 @@ static int repaper_probe(struct spi_device *spi)
if (IS_ERR(epd->panel_on)) {
ret = PTR_ERR(epd->panel_on);
if (ret != -EPROBE_DEFER)
-   dev_err(dev, "Failed to get gpio 'panel-on'\n");
+   DRM_DEV_ERROR(dev, "Failed to get gpio 'panel-on'\n");
return ret;

[PATCH v3] drm/i915: Replace *_reference/unreference() or *_ref/unref with _get/put()

2017-10-08 Thread Harsha Sharma
Replace instances of drm_framebuffer_reference/unreference() with
*_get/put() suffixes and drm_dev_unref with *_put() suffix
because get/put is shorter and consistent with the
kernel use of *_get/put suffixes.
Done with following coccinelle semantic patch

@@
expression ex;
@@

(
-drm_framebuffer_unreference(ex);
+drm_framebuffer_put(ex);
|
-drm_dev_unref(ex);
+drm_dev_put(ex);
|
-drm_framebuffer_reference(ex);
+drm_framebuffer_get(ex);
)

Signed-off-by: Harsha Sharma 
---
Changes in v3:
 -Removed changes in selftests
Changes in v2:
 -Added cocinelle patch in log message
 -cc to all driver-specific mailing lists

 drivers/gpu/drm/i915/i915_pci.c  |  2 +-
 drivers/gpu/drm/i915/intel_display.c | 10 +-
 drivers/gpu/drm/i915/intel_fbdev.c   |  4 ++--
 3 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_pci.c b/drivers/gpu/drm/i915/i915_pci.c
index 09d97e0990b7..2f106cca46b4 100644
--- a/drivers/gpu/drm/i915/i915_pci.c
+++ b/drivers/gpu/drm/i915/i915_pci.c
@@ -510,7 +510,7 @@ static void i915_pci_remove(struct pci_dev *pdev)
struct drm_device *dev = pci_get_drvdata(pdev);
 
i915_driver_unload(dev);
-   drm_dev_unref(dev);
+   drm_dev_put(dev);
 }
 
 static int i915_pci_probe(struct pci_dev *pdev, const struct pci_device_id 
*ent)
diff --git a/drivers/gpu/drm/i915/intel_display.c 
b/drivers/gpu/drm/i915/intel_display.c
index f17275519484..92f83045878f 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -2856,7 +2856,7 @@ intel_find_initial_plane_obj(struct intel_crtc 
*intel_crtc,
 
if (intel_plane_ggtt_offset(state) == plane_config->base) {
fb = c->primary->fb;
-   drm_framebuffer_reference(fb);
+   drm_framebuffer_get(fb);
goto valid_fb;
}
}
@@ -2887,7 +2887,7 @@ intel_find_initial_plane_obj(struct intel_crtc 
*intel_crtc,
  intel_crtc->pipe, PTR_ERR(intel_state->vma));
 
intel_state->vma = NULL;
-   drm_framebuffer_unreference(fb);
+   drm_framebuffer_put(fb);
return;
}
 
@@ -2908,7 +2908,7 @@ intel_find_initial_plane_obj(struct intel_crtc 
*intel_crtc,
if (i915_gem_object_is_tiled(obj))
dev_priv->preserve_bios_swizzle = true;
 
-   drm_framebuffer_reference(fb);
+   drm_framebuffer_get(fb);
primary->fb = primary->state->fb = fb;
primary->crtc = primary->state->crtc = _crtc->base;
 
@@ -9847,7 +9847,7 @@ mode_fits_in_fbdev(struct drm_device *dev,
if (obj->base.size < mode->vdisplay * fb->pitches[0])
return NULL;
 
-   drm_framebuffer_reference(fb);
+   drm_framebuffer_get(fb);
return fb;
 #else
return NULL;
@@ -10028,7 +10028,7 @@ int intel_get_load_detect_pipe(struct drm_connector 
*connector,
if (ret)
goto fail;
 
-   drm_framebuffer_unreference(fb);
+   drm_framebuffer_put(fb);
 
ret = drm_atomic_set_mode_for_crtc(_state->base, mode);
if (ret)
diff --git a/drivers/gpu/drm/i915/intel_fbdev.c 
b/drivers/gpu/drm/i915/intel_fbdev.c
index 262e75c00dd2..1ff714935c38 100644
--- a/drivers/gpu/drm/i915/intel_fbdev.c
+++ b/drivers/gpu/drm/i915/intel_fbdev.c
@@ -189,7 +189,7 @@ static int intelfb_create(struct drm_fb_helper *helper,
  " releasing it\n",
  intel_fb->base.width, intel_fb->base.height,
  sizes->fb_width, sizes->fb_height);
-   drm_framebuffer_unreference(_fb->base);
+   drm_framebuffer_put(_fb->base);
intel_fb = ifbdev->fb = NULL;
}
if (!intel_fb || WARN_ON(!intel_fb->obj)) {
@@ -624,7 +624,7 @@ static bool intel_fbdev_init_bios(struct drm_device *dev,
ifbdev->preferred_bpp = fb->base.format->cpp[0] * 8;
ifbdev->fb = fb;
 
-   drm_framebuffer_reference(>fb->base);
+   drm_framebuffer_put(>fb->base);
 
/* Final pass to check if any active pipes don't have fbs */
for_each_crtc(dev, crtc) {
-- 
2.11.0

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[BUG] gma500: Possible sleep-in-atomic bugs in gma_resume_pci

2017-10-08 Thread Jia-Ju Bai

The driver may sleep under a spinlock, and the function call paths are:
gma_power_begin (acquire the spinlock)
  gma_resume_pci
pci_set_power_state
  __pci_start_power_transition (drivers/pci/pci.c)
msleep --> may sleep

gma_power_begin (acquire the spinlock)
  gma_resume_pci
pci_enable_device
  pci_enable_device_flags (drivers/pci/pci.c)
do_pci_enable_device
  pci_set_power_state
__pci_start_power_transition
  msleep --> may sleep

A possible fix is to replace msleep with mdelay in 
__pci_start_power_transition in drivers/pci/pci.c.


These bugs are found by my static analysis tool and my code review.


Thanks,
Jia-Ju Bai

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH v3 0/3] Split default display handling out from VGA arbiter

2017-10-08 Thread Bjorn Helgaas
On Wed, Sep 27, 2017 at 01:52:55PM +1000, Daniel Axtens wrote:
> Hi Bjorn,
> 
> Yes, this works:
> 
> Tested-by: Daniel Axtens  # arm64, ppc64-qemu-tcg

I guess I was assuming you'd pick this up, but that doesn't really
make sense because I didn't give you a signed-off-by or anything.
I'll post this with a changelog and signed-off-by so it doesn't get
lost.

I also noticed that I didn't correctly handle the powerpc quirk case
where it doesn't require the device to be enabled at all.  I'll try to
fix that up, too.

Bjorn

> > On Fri, Sep 01, 2017 at 05:27:41PM +1000, Daniel Axtens wrote:
> >> This patch set:
> >> 
> >>  - splits the default display handling out from VGA arbiter, into its
> >>own file and behind its own Kconfig option (and gives the functions
> >>better names).
> >> 
> >>  - adds extra detection of default devices. To be nominated, the vga
> >>arbiter and platform hooks must not have nominated a default. A
> >>card will then only be nominated if it has a driver attached and
> >>has IO or memory decoding enabled.
> >> 
> >>  - adds relevant documentation.
> >> 
> >> The practical impact of this is improved X autoconfiguration on some
> >> arm64 systems.
> >
> > I think I gave you bad advice about trying to separate the "default
> > device" idea from the VGA arbiter.
> >
> > It is true that the "VGA arbiter" per se is related to routing the
> > legacy VGA resources, and the arbiter currently only selects a default
> > device if it finds a device to which those resources are routed.
> >
> > We have some cases where we want to select a default device that may
> > not support the legacy VGA resources, or where they might not be
> > routed to the device:
> >
> >   - systems where we match the EFI framebuffer address with a BAR, and
> > select that device as default,
> >
> >   - powerpc systems where there may be no host bridge window that maps
> > to the legacy VGA resources,
> >
> >   - your ARM64 systems where the default device may be behind a bridge
> > that doesn't support legacy VGA routing (PCI_BRIDGE_CTL_VGA)
> >
> > But I think trying to split the "default device" part out from the VGA
> > arbiter ends up being overkill and making things more complicated
> > instead of simpler.
> >
> > Would something like the following work for you as well as the powerpc
> > case?  On powerpc, we already use vga_set_default_device() to select a
> > device that doesn't use legacy VGA resources, so maybe we can just do
> > the same on ARM64?
> >
> > I suppose there might be wrinkles in how the arbiter deals with
> > multiple graphics devices on those systems, since I don't think it
> > identifies these devices that don't use the legacy resources, but it
> > seems like we live with whatever those on are powerpc and probably can
> > on ARM64 as well.
> >
> >
> > diff --git a/arch/powerpc/kernel/pci-common.c 
> > b/arch/powerpc/kernel/pci-common.c
> > index 02831a396419..0ac7aa346c69 100644
> > --- a/arch/powerpc/kernel/pci-common.c
> > +++ b/arch/powerpc/kernel/pci-common.c
> > @@ -1740,15 +1740,3 @@ static void fixup_hide_host_resource_fsl(struct 
> > pci_dev *dev)
> >  }
> >  DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_MOTOROLA, PCI_ANY_ID, 
> > fixup_hide_host_resource_fsl);
> >  DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_FREESCALE, PCI_ANY_ID, 
> > fixup_hide_host_resource_fsl);
> > -
> > -static void fixup_vga(struct pci_dev *pdev)
> > -{
> > -   u16 cmd;
> > -
> > -   pci_read_config_word(pdev, PCI_COMMAND, );
> > -   if ((cmd & (PCI_COMMAND_IO | PCI_COMMAND_MEMORY)) || 
> > !vga_default_device())
> > -   vga_set_default_device(pdev);
> > -
> > -}
> > -DECLARE_PCI_FIXUP_CLASS_FINAL(PCI_ANY_ID, PCI_ANY_ID,
> > - PCI_CLASS_DISPLAY_VGA, 8, fixup_vga);
> > diff --git a/drivers/gpu/vga/vgaarb.c b/drivers/gpu/vga/vgaarb.c
> > index 76875f6299b8..9df4802c5f04 100644
> > --- a/drivers/gpu/vga/vgaarb.c
> > +++ b/drivers/gpu/vga/vgaarb.c
> > @@ -1468,6 +1468,21 @@ static int __init vga_arb_device_init(void)
> > vgaarb_info(dev, "no bridge control possible\n");
> > }
> >  
> > +   if (!vga_default_device()) {
> > +   list_for_each_entry(vgadev, _list, list) {
> > +   struct device *dev = >pdev->dev;
> > +   u16 cmd;
> > +
> > +   pdev = vgadev->pdev;
> > +   pci_read_config_word(pdev, PCI_COMMAND, );
> > +   if (cmd & (PCI_COMMAND_IO | PCI_COMMAND_MEMORY)) {
> > +   vgaarb_info(dev, "setting as boot device\n");
> > +   vga_set_default_device(pdev);
> > +   break;
> > +   }
> > +   }
> > +   }
> > +
> > pr_info("loaded\n");
> > return rc;
> >  }
> 
> 
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH 0/2] vgaarb: Select fallback default VGA device

2017-10-08 Thread Bjorn Helgaas
These patches are supposed to fix a problem Daniel Axtens found on the
HiSilicon D05 board.  The VGA device there is behind a bridge that doesn't
support PCI_BRIDGE_CTL_VGA, so the arbiter never selects the device as the
default.

The first patch extends the arbiter so that if it can't find an enabled VGA
device with legacy resources, it selects the first enabled device *without*
legacy resources (this is what fixes the D05).  If that fails, it selects
the first device that isn't enabled.  The combination of both changes
should make the current powerpc fixup_vga() quirk unnecessary.

N.B. It changes the powerpc behavior: if there are several enabled VGA
devices, the current quirk selects the last one, while this patch selects
the first one.  If this is a problem, I can drop that part of the patch and
keep the quirk.

The second patch pulls out this fallback device detection (and the EFI
override) from vga_arb_device_init() to make it easier to read.

---

Bjorn Helgaas (2):
  vgaarb: Select a default VGA device even if there's no legacy VGA
  vgaarb: Factor out EFI and fallback default device selection


 arch/powerpc/kernel/pci-common.c |   12 --
 drivers/gpu/vga/vgaarb.c |   72 +-
 2 files changed, 55 insertions(+), 29 deletions(-)
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Fwd: linux video documentation ?

2017-10-08 Thread Brad Walker
I noticed this email address is listed as the relevant area for the
Documentation/devicetree/bindings/video/ directory in the Linux kernel. I
have a question about this.

I noticed the Documentation/devicetree/bindings/video/ is no longer in the
Linux kernel repo. It was in release 4.3.6 but got dropped in release
v4.4-rc1.

Is there a reason for this? I ask because I am using the
"simple-framebuffer" and wanted to possibly make some improvements to the
documentation.

Thanks for any insight you can provide.

-brad w.
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH 2/2] vgaarb: Factor out EFI and fallback default device selection

2017-10-08 Thread Bjorn Helgaas
From: Bjorn Helgaas 

The default VGA device is normally set in vga_arbiter_add_pci_device() when
we call it for the first enabled device that can be accessed with the
legacy VGA resources ([mem 0xa-0xb], etc.)

That default device can be overridden by an EFI device that owns the boot
framebuffer.  As a fallback, we can also select a VGA device that can't be
accessed via legacy VGA resources, or a VGA device that isn't even enabled.

Factor out this EFI and fallback selection from vga_arb_device_init() into
a separate vga_arb_select_default_device() function.  This doesn't change
any behavior, but it untangles the "bridge control possible" checking and
messages from the default device selection.

Signed-off-by: Bjorn Helgaas 
---
 drivers/gpu/vga/vgaarb.c |   57 --
 1 file changed, 35 insertions(+), 22 deletions(-)

diff --git a/drivers/gpu/vga/vgaarb.c b/drivers/gpu/vga/vgaarb.c
index aeb41f793ed4..7803e35a3702 100644
--- a/drivers/gpu/vga/vgaarb.c
+++ b/drivers/gpu/vga/vgaarb.c
@@ -1402,29 +1402,14 @@ static struct miscdevice vga_arb_device = {
MISC_DYNAMIC_MINOR, "vga_arbiter", _arb_device_fops
 };
 
-static int __init vga_arb_device_init(void)
+static void __init vga_arb_select_default_device(void)
 {
-   int rc;
struct pci_dev *pdev;
struct vga_device *vgadev;
 
-   rc = misc_register(_arb_device);
-   if (rc < 0)
-   pr_err("error %d registering device\n", rc);
-
-   bus_register_notifier(_bus_type, _notifier);
-
-   /* We add all pci devices satisfying vga class in the arbiter by
-* default */
-   pdev = NULL;
-   while ((pdev =
-   pci_get_subsys(PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID,
-  PCI_ANY_ID, pdev)) != NULL)
-   vga_arbiter_add_pci_device(pdev);
-
+#if defined(CONFIG_X86) || defined(CONFIG_IA64)
list_for_each_entry(vgadev, _list, list) {
struct device *dev = >pdev->dev;
-#if defined(CONFIG_X86) || defined(CONFIG_IA64)
/*
 * Override vga_arbiter_add_pci_device()'s I/O based detection
 * as it may take the wrong device (e.g. on Apple system under
@@ -1461,12 +1446,8 @@ static int __init vga_arb_device_init(void)
vgaarb_info(dev, "overriding boot device\n");
vga_set_default_device(vgadev->pdev);
}
-#endif
-   if (vgadev->bridge_has_one_vga)
-   vgaarb_info(dev, "bridge control possible\n");
-   else
-   vgaarb_info(dev, "no bridge control possible\n");
}
+#endif
 
if (!vga_default_device()) {
list_for_each_entry(vgadev, _list, list) {
@@ -1492,6 +1473,38 @@ static int __init vga_arb_device_init(void)
vga_set_default_device(pdev);
}
}
+}
+
+static int __init vga_arb_device_init(void)
+{
+   int rc;
+   struct pci_dev *pdev;
+   struct vga_device *vgadev;
+
+   rc = misc_register(_arb_device);
+   if (rc < 0)
+   pr_err("error %d registering device\n", rc);
+
+   bus_register_notifier(_bus_type, _notifier);
+
+   /* We add all PCI devices satisfying VGA class in the arbiter by
+* default */
+   pdev = NULL;
+   while ((pdev =
+   pci_get_subsys(PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID,
+  PCI_ANY_ID, pdev)) != NULL)
+   vga_arbiter_add_pci_device(pdev);
+
+   list_for_each_entry(vgadev, _list, list) {
+   struct device *dev = >pdev->dev;
+
+   if (vgadev->bridge_has_one_vga)
+   vgaarb_info(dev, "bridge control possible\n");
+   else
+   vgaarb_info(dev, "no bridge control possible\n");
+   }
+
+   vga_arb_select_default_device();
 
pr_info("loaded\n");
return rc;

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH] drm: vc4: Fix race during binding

2017-10-08 Thread Stefan Wahren
Hi Eric,

> Eric Anholt  hat am 6. Oktober 2017 um 21:42 geschrieben:
> 
> 
> Stefan Wahren  writes:
> 
> > This fixes the race between vc4_overflow_mem_work and the init of the
> > job lock. Otherwise we could trigger a NULL pointer dereference
> > during VC4 binding.
> >
> > Link: https://github.com/anholt/linux/issues/114
> > Signed-off-by: Stefan Wahren 
> > Fixes: d5b1a78a772f ("drm/vc4: Add support for drawing 3D frames.")
> > ---
> >  drivers/gpu/drm/vc4/vc4_gem.c | 1 -
> >  drivers/gpu/drm/vc4/vc4_irq.c | 1 +
> >  2 files changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/drivers/gpu/drm/vc4/vc4_gem.c b/drivers/gpu/drm/vc4/vc4_gem.c
> > index d0c6bfb..47d964f 100644
> > --- a/drivers/gpu/drm/vc4/vc4_gem.c
> > +++ b/drivers/gpu/drm/vc4/vc4_gem.c
> > @@ -1088,7 +1088,6 @@ vc4_gem_init(struct drm_device *dev)
> > INIT_LIST_HEAD(>render_job_list);
> > INIT_LIST_HEAD(>job_done_list);
> > INIT_LIST_HEAD(>seqno_cb_list);
> > -   spin_lock_init(>job_lock);
> >  
> > INIT_WORK(>hangcheck.reset_work, vc4_reset_work);
> > setup_timer(>hangcheck.timer,
> > diff --git a/drivers/gpu/drm/vc4/vc4_irq.c b/drivers/gpu/drm/vc4/vc4_irq.c
> > index 7d7af3a..d508d13 100644
> > --- a/drivers/gpu/drm/vc4/vc4_irq.c
> > +++ b/drivers/gpu/drm/vc4/vc4_irq.c
> > @@ -195,6 +195,7 @@ vc4_irq_preinstall(struct drm_device *dev)
> > struct vc4_dev *vc4 = to_vc4_dev(dev);
> >  
> > init_waitqueue_head(>job_wait_queue);
> > +   spin_lock_init(>job_lock);
> > INIT_WORK(>overflow_mem_work, vc4_overflow_mem_work);
> >  
> > /* Clear any pending interrupts someone might have left around
> 
> Are you sure this is a fix?  We don't attach the IRQ handler until V3D
> bind, and vc4_gem_init happens before component_bind_all(), right?

i agree i should have mark it as a RFC. But is it really impossible that 
vc4_overflow_mem_work is triggered before vc4_gem_init?
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH 1/2] vgaarb: Select a default VGA device even if there's no legacy VGA

2017-10-08 Thread Bjorn Helgaas
From: Bjorn Helgaas 

Daniel Axtens reported that on the HiSilicon D05 board, the VGA device is
behind a bridge that doesn't support PCI_BRIDGE_CTL_VGA, so the VGA arbiter
never selects it as the default, which means Xorg auto-detection doesn't
work.

VGA is a legacy PCI feature: a VGA device can respond to addresses, e.g.,
[mem 0xa-0xb], [io 0x3b0-0x3bb], [io 0x3c0-0x3df], etc., that are
not configurable by BARs.  Consequently, multiple VGA devices can conflict
with each other.  The VGA arbiter avoids conflicts by ensuring that those
legacy resources are only routed to one VGA device at a time.

The arbiter identifies the "default VGA" device, i.e., a legacy VGA device
that was used by boot firmware.  It selects the first device that:

  - is of PCI_CLASS_DISPLAY_VGA,
  - has both PCI_COMMAND_IO and PCI_COMMAND_MEMORY enabled, and
  - has PCI_BRIDGE_CTL_VGA set in all upstream bridges.

Some systems don't have such a device.  For example, if a host bridge
doesn't support I/O space, PCI_COMMAND_IO probably won't be enabled for any
devices below it.  Or, as on the HiSilicon D05, the VGA device may be
behind a bridge that doesn't support PCI_BRIDGE_CTL_VGA, so accesses to the
legacy VGA resources will never reach the device.

This patch extends the arbiter so that if it doesn't find a device that
meets all the above criteria, it selects the first device that:

  - is of PCI_CLASS_DISPLAY_VGA and
  - has PCI_COMMAND_IO or PCI_COMMAND_MEMORY enabled

If it doesn't find even that, it selects the first device that:

  - is of class PCI_CLASS_DISPLAY_VGA.

Such a device may not be able to use the legacy VGA resources, but most
drivers can operate the device without those.  Setting it as the default
device means its "boot_vga" sysfs file will contain "1", which Xorg (via
libpciaccess) uses to help select its default output device.

This fixes Xorg auto-detection on some arm64 systems (HiSilicon D05 in
particular; see the link below).

It also replaces the powerpc fixup_vga() quirk, albeit with slightly
different semantics: the quirk selected the first VGA device we found, and
overrode that selection with any enabled VGA device we found.  If there
were several enabled VGA devices, the *last* one we found would become the
default.

The code here instead selects the *first* enabled VGA device we find, and
if none are enabled, the first VGA device we find.

Link: http://lkml.kernel.org/r/20170901072744.2409-1-...@axtens.net
Tested-by: Daniel Axtens # arm64, ppc64-qemu-tcg
Signed-off-by: Bjorn Helgaas 
---
 arch/powerpc/kernel/pci-common.c |   12 
 drivers/gpu/vga/vgaarb.c |   25 +
 2 files changed, 25 insertions(+), 12 deletions(-)

diff --git a/arch/powerpc/kernel/pci-common.c b/arch/powerpc/kernel/pci-common.c
index 02831a396419..0ac7aa346c69 100644
--- a/arch/powerpc/kernel/pci-common.c
+++ b/arch/powerpc/kernel/pci-common.c
@@ -1740,15 +1740,3 @@ static void fixup_hide_host_resource_fsl(struct pci_dev 
*dev)
 }
 DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_MOTOROLA, PCI_ANY_ID, 
fixup_hide_host_resource_fsl);
 DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_FREESCALE, PCI_ANY_ID, 
fixup_hide_host_resource_fsl);
-
-static void fixup_vga(struct pci_dev *pdev)
-{
-   u16 cmd;
-
-   pci_read_config_word(pdev, PCI_COMMAND, );
-   if ((cmd & (PCI_COMMAND_IO | PCI_COMMAND_MEMORY)) || 
!vga_default_device())
-   vga_set_default_device(pdev);
-
-}
-DECLARE_PCI_FIXUP_CLASS_FINAL(PCI_ANY_ID, PCI_ANY_ID,
- PCI_CLASS_DISPLAY_VGA, 8, fixup_vga);
diff --git a/drivers/gpu/vga/vgaarb.c b/drivers/gpu/vga/vgaarb.c
index 76875f6299b8..aeb41f793ed4 100644
--- a/drivers/gpu/vga/vgaarb.c
+++ b/drivers/gpu/vga/vgaarb.c
@@ -1468,6 +1468,31 @@ static int __init vga_arb_device_init(void)
vgaarb_info(dev, "no bridge control possible\n");
}
 
+   if (!vga_default_device()) {
+   list_for_each_entry(vgadev, _list, list) {
+   struct device *dev = >pdev->dev;
+   u16 cmd;
+
+   pdev = vgadev->pdev;
+   pci_read_config_word(pdev, PCI_COMMAND, );
+   if (cmd & (PCI_COMMAND_IO | PCI_COMMAND_MEMORY)) {
+   vgaarb_info(dev, "setting as boot device (VGA 
legacy resources not available)\n");
+   vga_set_default_device(pdev);
+   break;
+   }
+   }
+   }
+
+   if (!vga_default_device()) {
+   vgadev = list_first_entry_or_null(_list,
+ struct vga_device, list);
+   if (vgadev) {
+   struct device *dev = >pdev->dev;
+   vgaarb_info(dev, "setting as boot device (VGA legacy 
resources not available)\n");
+   

Re: [PATCH 2/2] drm/atomic: Make atomic iterators less surprising

2017-10-08 Thread Dmitry Osipenko
On 06.10.2017 12:07, Maarten Lankhorst wrote:
> Op 27-09-17 om 14:53 schreef Dmitry Osipenko:
>> On 27.09.2017 11:35, Maarten Lankhorst wrote:
>>> Commit 669c9215afea ("drm/atomic: Make async plane update checks work as
>>> intended, v2.") assumed incorrectly that if only 1 plane is matched in
>>> the loop, the variables will be set to that plane. In reality we reset
>>> them to NULL every time a new plane was iterated. This behavior is
>>> surprising, so fix this by making the for loops only assign the
>>> variables on a match.
>>>
>>> Cc: Dmitry Osipenko 
>>> Fixes: 669c9215afea ("drm/atomic: Make async plane update checks work as 
>>> intended, v2.")
>>> Signed-off-by: Maarten Lankhorst 
>>> ---
>>>  include/drm/drm_atomic.h | 85 
>>> 
>>>  1 file changed, 42 insertions(+), 43 deletions(-)
>>>
>>> diff --git a/include/drm/drm_atomic.h b/include/drm/drm_atomic.h
>>> index 6fae95f28e10..5afd6e364fb6 100644
>>> --- a/include/drm/drm_atomic.h
>>> +++ b/include/drm/drm_atomic.h
>>> @@ -585,12 +585,12 @@ void drm_state_dump(struct drm_device *dev, struct 
>>> drm_printer *p);
>>>   */
>>>  #define for_each_oldnew_connector_in_state(__state, connector, 
>>> old_connector_state, new_connector_state, __i) \
>>> for ((__i) = 0; 
>>> \
>>> -(__i) < (__state)->num_connector &&
>>> \
>>> -((connector) = (__state)->connectors[__i].ptr, 
>>> \
>>> -(old_connector_state) = (__state)->connectors[__i].old_state,  
>>> \
>>> -(new_connector_state) = (__state)->connectors[__i].new_state, 1);  
>>> \
>>> -(__i)++)   \
>>> -   for_each_if (connector)
>>> +(__i) < (__state)->num_connector;  
>>> \
>>> +(__i)++)   
>>> \
>>> +   for_each_if ((__state)->connectors[__i].ptr &&  
>>> \
>>> +((connector) = (__state)->connectors[__i].ptr, 
>>> \
>>> +(old_connector_state) = 
>>> (__state)->connectors[__i].old_state,  \
>>> +(new_connector_state) = 
>>> (__state)->connectors[__i].new_state, 1))
>>>  
>>>  /**
>>>   * for_each_old_connector_in_state - iterate over all connectors in an 
>>> atomic update
>>> @@ -606,11 +606,11 @@ void drm_state_dump(struct drm_device *dev, struct 
>>> drm_printer *p);
>>>   */
>>>  #define for_each_old_connector_in_state(__state, connector, 
>>> old_connector_state, __i) \
>>> for ((__i) = 0; 
>>> \
>>> -(__i) < (__state)->num_connector &&
>>> \
>>> -((connector) = (__state)->connectors[__i].ptr, 
>>> \
>>> -(old_connector_state) = (__state)->connectors[__i].old_state, 1);  
>>> \
>>> -(__i)++)   \
>>> -   for_each_if (connector)
>>> +(__i) < (__state)->num_connector;  
>>> \
>>> +(__i)++)   
>>> \
>>> +   for_each_if ((__state)->connectors[__i].ptr &&  
>>> \
>>> +((connector) = (__state)->connectors[__i].ptr, 
>>> \
>>> +(old_connector_state) = 
>>> (__state)->connectors[__i].old_state, 1))
>>>  
>>>  /**
>>>   * for_each_new_connector_in_state - iterate over all connectors in an 
>>> atomic update
>>> @@ -626,11 +626,11 @@ void drm_state_dump(struct drm_device *dev, struct 
>>> drm_printer *p);
>>>   */
>>>  #define for_each_new_connector_in_state(__state, connector, 
>>> new_connector_state, __i) \
>>> for ((__i) = 0; 
>>> \
>>> -(__i) < (__state)->num_connector &&
>>> \
>>> -((connector) = (__state)->connectors[__i].ptr, 
>>> \
>>> -(new_connector_state) = (__state)->connectors[__i].new_state, 1);  
>>> \
>>> -(__i)++)   \
>>> -   for_each_if (connector)
>>> +(__i) < (__state)->num_connector;  
>>> \
>>> +(__i)++)   
>>> \
>>> +   for_each_if ((__state)->connectors[__i].ptr &&  
>>> \
>>> +((connector) = (__state)->connectors[__i].ptr, 
>>> \
>>> +(new_connector_state) = 
>>> (__state)->connectors[__i].new_state, 1))
>>>  
>>>  /**
>>>   * for_each_oldnew_crtc_in_state - iterate over all CRTCs in an atomic 
>>> update
>>> @@ -646,12 

Re: [PATCH v2] drm/i915: Replace *_reference/unreference() or *_ref/unref with _get/put()

2017-10-08 Thread Harsha Sharma
On Fri, Sep 29, 2017 at 10:00 AM, Harsha Sharma
 wrote:
> Replace instances of drm_framebuffer_reference/unreference() with
> *_get/put() suffixes and drm_dev_unref with *_put() suffix
> because get/put is shorter and consistent with the
> kernel use of *_get/put suffixes.
> Done with following coccinelle semantic patch
>
> @@
> expression ex;
> @@
>
> (
> -drm_framebuffer_unreference(ex);
> +drm_framebuffer_put(ex);
> |
> -drm_dev_unref(ex);
> +drm_dev_put(ex);
> |
> -drm_framebuffer_reference(ex);
> +drm_framebuffer_get(ex);
> )
>
>
> Signed-off-by: Harsha Sharma 
> ---
> Changes in v2:
>  -Added coccinelle patch in log message
>  -cc to all driver-specific mailing lists
>
>  drivers/gpu/drm/i915/i915_pci.c|  2 +-
>  drivers/gpu/drm/i915/intel_display.c   | 10 +-
>  drivers/gpu/drm/i915/intel_fbdev.c |  4 ++--
>  drivers/gpu/drm/i915/selftests/i915_gem_dmabuf.c   |  2 +-
>  drivers/gpu/drm/i915/selftests/i915_gem_evict.c|  2 +-
>  drivers/gpu/drm/i915/selftests/i915_gem_gtt.c  |  2 +-
>  drivers/gpu/drm/i915/selftests/i915_gem_object.c   |  2 +-
>  drivers/gpu/drm/i915/selftests/i915_gem_request.c  |  2 +-
>  drivers/gpu/drm/i915/selftests/i915_vma.c  |  2 +-
>  drivers/gpu/drm/i915/selftests/intel_breadcrumbs.c |  2 +-
>  10 files changed, 15 insertions(+), 15 deletions(-)
>

Hi,
Any update regarding this ?
Thanks.

Regards,
Harsha Sharma

> diff --git a/drivers/gpu/drm/i915/i915_pci.c b/drivers/gpu/drm/i915/i915_pci.c
> index 09d97e0..2f106cc 100644
> --- a/drivers/gpu/drm/i915/i915_pci.c
> +++ b/drivers/gpu/drm/i915/i915_pci.c
> @@ -510,7 +510,7 @@ static void i915_pci_remove(struct pci_dev *pdev)
> struct drm_device *dev = pci_get_drvdata(pdev);
>
> i915_driver_unload(dev);
> -   drm_dev_unref(dev);
> +   drm_dev_put(dev);
>  }
>
>  static int i915_pci_probe(struct pci_dev *pdev, const struct pci_device_id 
> *ent)
> diff --git a/drivers/gpu/drm/i915/intel_display.c 
> b/drivers/gpu/drm/i915/intel_display.c
> index f172755..92f8304 100644
> --- a/drivers/gpu/drm/i915/intel_display.c
> +++ b/drivers/gpu/drm/i915/intel_display.c
> @@ -2856,7 +2856,7 @@ static int skl_format_to_fourcc(int format, bool 
> rgb_order, bool alpha)
>
> if (intel_plane_ggtt_offset(state) == plane_config->base) {
> fb = c->primary->fb;
> -   drm_framebuffer_reference(fb);
> +   drm_framebuffer_get(fb);
> goto valid_fb;
> }
> }
> @@ -2887,7 +2887,7 @@ static int skl_format_to_fourcc(int format, bool 
> rgb_order, bool alpha)
>   intel_crtc->pipe, PTR_ERR(intel_state->vma));
>
> intel_state->vma = NULL;
> -   drm_framebuffer_unreference(fb);
> +   drm_framebuffer_put(fb);
> return;
> }
>
> @@ -2908,7 +2908,7 @@ static int skl_format_to_fourcc(int format, bool 
> rgb_order, bool alpha)
> if (i915_gem_object_is_tiled(obj))
> dev_priv->preserve_bios_swizzle = true;
>
> -   drm_framebuffer_reference(fb);
> +   drm_framebuffer_get(fb);
> primary->fb = primary->state->fb = fb;
> primary->crtc = primary->state->crtc = _crtc->base;
>
> @@ -9847,7 +9847,7 @@ struct drm_framebuffer *
> if (obj->base.size < mode->vdisplay * fb->pitches[0])
> return NULL;
>
> -   drm_framebuffer_reference(fb);
> +   drm_framebuffer_get(fb);
> return fb;
>  #else
> return NULL;
> @@ -10028,7 +10028,7 @@ int intel_get_load_detect_pipe(struct drm_connector 
> *connector,
> if (ret)
> goto fail;
>
> -   drm_framebuffer_unreference(fb);
> +   drm_framebuffer_put(fb);
>
> ret = drm_atomic_set_mode_for_crtc(_state->base, mode);
> if (ret)
> diff --git a/drivers/gpu/drm/i915/intel_fbdev.c 
> b/drivers/gpu/drm/i915/intel_fbdev.c
> index 262e75c..1ff7149 100644
> --- a/drivers/gpu/drm/i915/intel_fbdev.c
> +++ b/drivers/gpu/drm/i915/intel_fbdev.c
> @@ -189,7 +189,7 @@ static int intelfb_create(struct drm_fb_helper *helper,
>   " releasing it\n",
>   intel_fb->base.width, intel_fb->base.height,
>   sizes->fb_width, sizes->fb_height);
> -   drm_framebuffer_unreference(_fb->base);
> +   drm_framebuffer_put(_fb->base);
> intel_fb = ifbdev->fb = NULL;
> }
> if (!intel_fb || WARN_ON(!intel_fb->obj)) {
> @@ -624,7 +624,7 @@ static bool intel_fbdev_init_bios(struct drm_device *dev,
> ifbdev->preferred_bpp = fb->base.format->cpp[0] * 8;
> ifbdev->fb = fb;
>
> -   drm_framebuffer_reference(>fb->base);
> +   drm_framebuffer_put(>fb->base);
>
> /* Final pass to check if any active pipes don't have fbs */
>   

[PATCH] drm: vc4: Fix race during binding

2017-10-08 Thread Stefan Wahren
This fixes the race between vc4_overflow_mem_work and the init of the
job lock. Otherwise we could trigger a NULL pointer dereference
during VC4 binding.

Link: https://github.com/anholt/linux/issues/114
Signed-off-by: Stefan Wahren 
Fixes: d5b1a78a772f ("drm/vc4: Add support for drawing 3D frames.")
---
 drivers/gpu/drm/vc4/vc4_gem.c | 1 -
 drivers/gpu/drm/vc4/vc4_irq.c | 1 +
 2 files changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/vc4/vc4_gem.c b/drivers/gpu/drm/vc4/vc4_gem.c
index d0c6bfb..47d964f 100644
--- a/drivers/gpu/drm/vc4/vc4_gem.c
+++ b/drivers/gpu/drm/vc4/vc4_gem.c
@@ -1088,7 +1088,6 @@ vc4_gem_init(struct drm_device *dev)
INIT_LIST_HEAD(>render_job_list);
INIT_LIST_HEAD(>job_done_list);
INIT_LIST_HEAD(>seqno_cb_list);
-   spin_lock_init(>job_lock);
 
INIT_WORK(>hangcheck.reset_work, vc4_reset_work);
setup_timer(>hangcheck.timer,
diff --git a/drivers/gpu/drm/vc4/vc4_irq.c b/drivers/gpu/drm/vc4/vc4_irq.c
index 7d7af3a..d508d13 100644
--- a/drivers/gpu/drm/vc4/vc4_irq.c
+++ b/drivers/gpu/drm/vc4/vc4_irq.c
@@ -195,6 +195,7 @@ vc4_irq_preinstall(struct drm_device *dev)
struct vc4_dev *vc4 = to_vc4_dev(dev);
 
init_waitqueue_head(>job_wait_queue);
+   spin_lock_init(>job_lock);
INIT_WORK(>overflow_mem_work, vc4_overflow_mem_work);
 
/* Clear any pending interrupts someone might have left around
-- 
2.7.4

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [Intel-gfx] [PATCH v3] drm/i915: Replace *_reference/unreference() or *_ref/unref with _get/put()

2017-10-08 Thread Chris Wilson
Quoting Harsha Sharma (2017-10-08 15:04:07)
> @@ -624,7 +624,7 @@ static bool intel_fbdev_init_bios(struct drm_device *dev,
> ifbdev->preferred_bpp = fb->base.format->cpp[0] * 8;
> ifbdev->fb = fb;
>  
> -   drm_framebuffer_reference(>fb->base);
> +   drm_framebuffer_put(>fb->base);

Whoops.
-Chris
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[Bug 197103] BUG: unable to handle kernel NULL pointer dereference at 0000000000000008 / IP: nouveau_fbcon_set_suspend_work+0x45/0xf0 [nouveau]

2017-10-08 Thread bugzilla-daemon
https://bugzilla.kernel.org/show_bug.cgi?id=197103

Pierre Moreau (pierre.mor...@free.fr) changed:

   What|Removed |Added

 CC||pierre.mor...@free.fr

--- Comment #3 from Pierre Moreau (pierre.mor...@free.fr) ---
Nouveau bugs, regardless of whether they lie in the kernel, Mesa or the Nouveau
DDX, should be reported at bugs.freedesktop.org (see
https://nouveau.freedesktop.org/wiki/Bugs/). You might want to add yourself to
the freedesktop bug, as updates are more likely to happen in that bug report
than this one.
Updates to this bug report are sent to the dri-devel mailing list, but not
every Nouveau developer follows it.

I’ll give 4.14-rc3 a try on my laptop (Optimus + GK107 as well).

-- 
You are receiving this mail because:
You are watching the assignee of the bug.
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH v3] drm/gem-fb-helper: Improve documentation

2017-10-08 Thread Noralf Trønnes


Den 22.09.2017 19.58, skrev Eric Anholt:

Noralf Trønnes  writes:


Make the docs read a little better.

This all looks nice to me.

Reviewed-by: Eric Anholt 


Thanks, applied to drm-misc.

Noralf.

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH v5 2/2] ARM: dts: exynos: Add HDMI and Sil9234 to Trats2 board

2017-10-08 Thread Krzysztof Kozlowski
On Thu, Oct 05, 2017 at 04:07:11PM +0200, Maciej Purski wrote:
> Add HDMI and Sil9234 MHL converter to Trats2 board.
> Following in SoC devices have been enabled:
> - HDMI (HDMI signal encoder),
> - Mixer (video buffer scanout device),
> - I2C_5 bus (used for HDMI DDC)
> - I2C_8 bus (used for HDMI_PHY control).
> 
> Based on previous work by:
> Tomasz Stanislawski 
> 
> Signed-off-by: Maciej Purski 
> ---
>  arch/arm/boot/dts/exynos4412-trats2.dts | 111 
> 
>  1 file changed, 111 insertions(+)

Unfortunately this does not apply. It is weird because there were no
changes around Trats2 DTS so it looks you based your change on some
unusual tree or version.

Can you rebase on top of my next/dt?
https://git.kernel.org/pub/scm/linux/kernel/git/krzk/linux.git/


Best regards,
Krzysztof

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[Bug 197103] BUG: unable to handle kernel NULL pointer dereference at 0000000000000008 / IP: nouveau_fbcon_set_suspend_work+0x45/0xf0 [nouveau]

2017-10-08 Thread bugzilla-daemon
https://bugzilla.kernel.org/show_bug.cgi?id=197103

Thorsten Leemhuis (regressi...@leemhuis.info) changed:

   What|Removed |Added

 CC||regressi...@leemhuis.info

--- Comment #2 from Thorsten Leemhuis (regressi...@leemhuis.info) ---
Did you try to bring this to the nouveau developer list? Not sure if the
drivers developers look here. Did you consider to bisect this? 

(BTW: Thx for pointing me to this bug, I added it to this weeks regression
report)

-- 
You are receiving this mail because:
You are watching the assignee of the bug.
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel