Re: [Nouveau] [PATCH] pci/quirks: Add quirk to reset nvgpu at boot for the Lenovo ThinkPad P50

2019-02-15 Thread Lyude Paul
On Thu, 2019-02-14 at 18:43 -0600, Bjorn Helgaas wrote:
> Hi Lyude,
> 
> On Tue, Feb 12, 2019 at 05:02:30PM -0500, Lyude Paul wrote:
> > On a very specific subset of ThinkPad P50 SKUs, particularly ones that
> > come with a Quadro M1000M chip instead of the M2000M variant, the BIOS
> > seems to have a very nasty habit of not always resetting the secondary
> > Nvidia GPU between full reboots if the laptop is configured in Hybrid
> > Graphics mode. The reason for this happening is unknown, but the
> > following steps and possibly a good bit of patience will reproduce the
> > issue:
> > 
> > 1. Boot up the laptop normally in Hybrid graphics mode
> > 2. Make sure nouveau is loaded and that the GPU is awake
> > 2. Allow the nvidia GPU to runtime suspend itself after being idle
> > 3. Reboot the machine, the more sudden the better (e.g sysrq-b may help)
> > 4. If nouveau loads up properly, reboot the machine again and go back to
> > step 2 until you reproduce the issue
> > 
> > This results in some very strange behavior: the GPU will
> > quite literally be left in exactly the same state it was in when the
> > previously booted kernel started the reboot. This has all sorts of bad
> > sideaffects: for starters, this completely breaks nouveau starting with a
> > mysterious EVO channel failure that happens well before we've actually
> > used the EVO channel for anything:
> 
> There are a lot of moving parts here that are probably obvious to you
> but not to me.  I need help untangling this a bit so I'm comfortable
> that we got to the root cause and that we're doing something logical
> as opposed to something that just happens to make things work.  I
> really don't know enough to even ask the right questions...

I completely understand! I'm pretty sure I'd be just as skeptical if I was in
your position reviewing a patch like this :P

> 
> Is there a bug report for this?  Bugzilla.kernel.org would be ideal,
> including "lspci -vvxxx" and dmidecode for the system.
> 
Not yet, but there has been discussion about this between nouveau developers
on our IRC channel.

> Is this running a current BIOS?  The date in your log below looks
> pretty recent, so I assume it is current.

Yes, this is the most up to date BIOS available for this system.

> 
> I assume "hybrid graphics" means you have two GPUs.  Do you select
> hybrid graphics mode in the BIOS?

Yes, the P50 has two available modes in the BIOS: Dedicated (e.g. only
the nvidia GPU is used for everything), and Hybrid (i915 drives the
built-in display panel, nouveau drives everything else). This bug only
seems to occur in Hybrid mode.

> 
> I assume when you say the Nvidia GPU doesn't get reset on a full
> reboot, you're talking about a "warm reboot", and that if you actually
> remove the power and do a cold reboot, there's no problem?

If you meant "unplugging the power adapter" when you said cutting the
power we don't need to go that far, but shutting down the machine and
restarting it by hand does avoid the problem yes.

> 
> I assume Nvidia GPU being active means you are using the performance
> GPU.  Does that mean the integrated GPU is completely unused and Linux
> does nothing at all with it?  Is Linux doing any switching between
> them?  If so, how?  I am not 100% confident in the code I've seen that
> does the switching.

"Switching" isn't really the right word to describe it these days as the
process for how this is handled has changed quite a bit in the last few
years. As I mentioned above, the main intel GPU is used for driving the
built-in display. As for the nvidia GPU, it's used to drive any kind of
external displays connected to the P50 and can also be used to do
rendering through DRI PRIME. The connector hookups are mostly hardcoded
as there isn't really much of a mux, unlike the old days where we could
actually do things like switch which GPU was driving the internal
display on the fly with  vga-switcheroo using the _DSM methods provided
by ACPI.

Nowadays muxless laptops like the ThinkPad P50 don't make much use of
_DSM for power management and instead just runtime suspend the dedicated
nvidia GPU when it's not in use. We rely on the PCI subsystem to invoke
the _PR3 ACPI methods for suspending and resuming the GPU and don't
handle much of it ourselves anymore:

https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/gpu/drm/nouveau/nouveau_drm.c?h=v5.0-rc6#n860

(You can ignore the call to nouveau_switcheroo_optimus_dsm() there; it
 doesn't do anything on systems like the P50 where we detect _PR3)

Additionally-if you see any problems with how we're handling things
there we're all ears! We've been trying to fix as many issues with
runtime PM as we can find.

Something else to consider here too: I've only ever managed to reproduce
this issue on this specific P50 SKU. Since I work on Desktop engineering
at Red Hat we have access to a very large number of laptops with hybrid
GPU setups. Interestingly I haven't ever reproduced 

[Nouveau] [Bug 109631] Moving gbm bo from GART to VRAM does not wait for rendering

2019-02-15 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=109631

JM9  changed:

   What|Removed |Added

Version|unspecified |git

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

Re: [Nouveau] [PATCH] drm/nouveau/bo: mark expected switch fall-through

2019-02-15 Thread Gustavo A. R. Silva
Hi all,

Alex Deucher requested me to send separate patches for each
driver, which makes this patch available to be taken,
again.

Thanks
--
Gustavo

On 2/15/19 10:02 AM, Gustavo A. R. Silva wrote:
> Hi,
> 
> Please drop this, as I have included this fix into
> the following patch, which addresses all the
> expected fall-throughs in drivers/gpu/drm:
> 
> https://lore.kernel.org/patchwork/patch/1042856/
> 
> Thanks
> --
> Gustavo
> 
> On 2/11/19 12:58 PM, Gustavo A. R. Silva wrote:
>> In preparation to enabling -Wimplicit-fallthrough, mark switch
>> cases where we are expecting to fall through.
>>
>> This patch fixes the following warning:
>>
>> drivers/gpu/drm/nouveau/nouveau_bo.c: In function 
>> ‘nouveau_ttm_io_mem_reserve’:
>> drivers/gpu/drm/nouveau/nouveau_bo.c:1434:53: warning: this statement may 
>> fall through [-Wimplicit-fallthrough=]
>>if (drm->client.mem->oclass < NVIF_CLASS_MEM_NV50 || !mem->kind)
>>~~^
>> drivers/gpu/drm/nouveau/nouveau_bo.c:1438:2: note: here
>>   case TTM_PL_VRAM:
>>   ^~~~
>>
>> Warning level 3 was used: -Wimplicit-fallthrough=3
>>
>> Notice that, in this particular case,  the code comment is modified
>> in accordance with what GCC is expecting to find.
>>
>> This patch is part of the ongoing efforts to enable
>> -Wimplicit-fallthrough.
>>
>> Signed-off-by: Gustavo A. R. Silva 
>> ---
>>  drivers/gpu/drm/nouveau/nouveau_bo.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/gpu/drm/nouveau/nouveau_bo.c 
>> b/drivers/gpu/drm/nouveau/nouveau_bo.c
>> index 73eff52036d2..a72be71c45b4 100644
>> --- a/drivers/gpu/drm/nouveau/nouveau_bo.c
>> +++ b/drivers/gpu/drm/nouveau/nouveau_bo.c
>> @@ -1434,7 +1434,7 @@ nouveau_ttm_io_mem_reserve(struct ttm_bo_device *bdev, 
>> struct ttm_mem_reg *reg)
>>  if (drm->client.mem->oclass < NVIF_CLASS_MEM_NV50 || !mem->kind)
>>  /* untiled */
>>  break;
>> -/* fallthrough, tiled memory */
>> +/* fall through - tiled memory */
>>  case TTM_PL_VRAM:
>>  reg->bus.offset = reg->start << PAGE_SHIFT;
>>  reg->bus.base = device->func->resource_addr(device, 1);
>>
___
Nouveau mailing list
Nouveau@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/nouveau

Re: [Nouveau] [PATCH] drm: Mark expected switch fall-throughs

2019-02-15 Thread Gustavo A. R. Silva


On 2/15/19 10:11 AM, Alex Deucher wrote:
> On Fri, Feb 15, 2019 at 11:08 AM Gustavo A. R. Silva
>  wrote:
>>
>> In preparation to enabling -Wimplicit-fallthrough, mark switch
>> cases where we are expecting to fall through.
>>
>> Warning level 3 was used: -Wimplicit-fallthrough=3
>>
>> Notice that, in some cases, the code comment is modified
>> in accordance with what GCC is expecting to find.
>>
>> This patch is part of the ongoing efforts to enable
>> -Wimplicit-fallthrough.
>>
>> Signed-off-by: Gustavo A. R. Silva 
> 
> Can you please split this up per driver?  A comment below as well.
> 

OK. Sure.

>> ---
>>  drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c   | 1 +
>>  drivers/gpu/drm/amd/amdgpu/si_dpm.c | 2 ++
>>  drivers/gpu/drm/amd/display/dc/bios/bios_parser2.c  | 2 ++
>>  drivers/gpu/drm/amd/display/dc/dce/dce_mem_input.c  | 2 +-
>>  drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c| 2 ++
>>  drivers/gpu/drm/amd/powerplay/smumgr/polaris10_smumgr.c | 1 +
>>  drivers/gpu/drm/drm_vm.c| 4 ++--
>>  drivers/gpu/drm/nouveau/nouveau_bo.c| 2 +-
>>  drivers/gpu/drm/radeon/ci_dpm.c | 2 ++
>>  drivers/gpu/drm/radeon/evergreen_cs.c   | 1 +
>>  drivers/gpu/drm/radeon/si_dpm.c | 2 ++
>>  11 files changed, 17 insertions(+), 4 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c 
>> b/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c
>> index b8e50a34bdb3..02955e6e9dd9 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c
>> +++ b/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c
>> @@ -3236,6 +3236,7 @@ static void gfx_v8_0_tiling_mode_table_init(struct 
>> amdgpu_device *adev)
>> dev_warn(adev->dev,
>>  "Unknown chip type (%d) in function 
>> gfx_v8_0_tiling_mode_table_init() falling through to CHIP_CARRIZO\n",
>>  adev->asic_type);
>> +   /* fall through */
>>
>> case CHIP_CARRIZO:
>> modearray[0] = (ARRAY_MODE(ARRAY_2D_TILED_THIN1) |
>> diff --git a/drivers/gpu/drm/amd/amdgpu/si_dpm.c 
>> b/drivers/gpu/drm/amd/amdgpu/si_dpm.c
>> index da58040fdbdc..41e01a7f57a4 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/si_dpm.c
>> +++ b/drivers/gpu/drm/amd/amdgpu/si_dpm.c
>> @@ -6216,10 +6216,12 @@ static void 
>> si_request_link_speed_change_before_state_change(struct amdgpu_devic
>> si_pi->force_pcie_gen = AMDGPU_PCIE_GEN2;
>> if (current_link_speed == AMDGPU_PCIE_GEN2)
>> break;
>> +   /* fall through */
>> case AMDGPU_PCIE_GEN2:
>> if (amdgpu_acpi_pcie_performance_request(adev, 
>> PCIE_PERF_REQ_PECI_GEN2, false) == 0)
>> break;
>>  #endif
>> +   /* fall through */
>> default:
>> si_pi->force_pcie_gen = 
>> si_get_current_pcie_speed(adev);
>> break;
>> diff --git a/drivers/gpu/drm/amd/display/dc/bios/bios_parser2.c 
>> b/drivers/gpu/drm/amd/display/dc/bios/bios_parser2.c
>> index a1c56f29cfeb..fd5266a58297 100644
>> --- a/drivers/gpu/drm/amd/display/dc/bios/bios_parser2.c
>> +++ b/drivers/gpu/drm/amd/display/dc/bios/bios_parser2.c
>> @@ -265,6 +265,7 @@ static struct atom_display_object_path_v2 
>> *get_bios_object(
>> && id.enum_id == obj_id.enum_id)
>> return 
>> >object_info_tbl.v1_4->display_path[i];
>> }
>> +   /* fall through */
>> case OBJECT_TYPE_CONNECTOR:
>> case OBJECT_TYPE_GENERIC:
>> /* Both Generic and Connector Object ID
>> @@ -277,6 +278,7 @@ static struct atom_display_object_path_v2 
>> *get_bios_object(
>> && id.enum_id == obj_id.enum_id)
>> return 
>> >object_info_tbl.v1_4->display_path[i];
>> }
>> +   /* fall through */
>> default:
>> return NULL;
>> }
>> diff --git a/drivers/gpu/drm/amd/display/dc/dce/dce_mem_input.c 
>> b/drivers/gpu/drm/amd/display/dc/dce/dce_mem_input.c
>> index 85686d917636..a24a2bda8656 100644
>> --- a/drivers/gpu/drm/amd/display/dc/dce/dce_mem_input.c
>> +++ b/drivers/gpu/drm/amd/display/dc/dce/dce_mem_input.c
>> @@ -479,7 +479,7 @@ static void program_grph_pixel_format(
>> case SURFACE_PIXEL_FORMAT_GRPH_ABGR16161616F:
>> sign = 1;
>> floating = 1;
>> -   /* no break */
>> +   /* fall through */
>> case SURFACE_PIXEL_FORMAT_GRPH_ARGB16161616F: /* shouldn't this get 
>> float too? */
>> case SURFACE_PIXEL_FORMAT_GRPH_ARGB16161616:
>> grph_depth = 3;
>> diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c 
>> 

Re: [Nouveau] [PATCH] drm/nouveau/bo: mark expected switch fall-through

2019-02-15 Thread Gustavo A. R. Silva
Hi,

Please drop this, as I have included this fix into
the following patch, which addresses all the
expected fall-throughs in drivers/gpu/drm:

https://lore.kernel.org/patchwork/patch/1042856/

Thanks
--
Gustavo

On 2/11/19 12:58 PM, Gustavo A. R. Silva wrote:
> In preparation to enabling -Wimplicit-fallthrough, mark switch
> cases where we are expecting to fall through.
> 
> This patch fixes the following warning:
> 
> drivers/gpu/drm/nouveau/nouveau_bo.c: In function 
> ‘nouveau_ttm_io_mem_reserve’:
> drivers/gpu/drm/nouveau/nouveau_bo.c:1434:53: warning: this statement may 
> fall through [-Wimplicit-fallthrough=]
>if (drm->client.mem->oclass < NVIF_CLASS_MEM_NV50 || !mem->kind)
>~~^
> drivers/gpu/drm/nouveau/nouveau_bo.c:1438:2: note: here
>   case TTM_PL_VRAM:
>   ^~~~
> 
> Warning level 3 was used: -Wimplicit-fallthrough=3
> 
> Notice that, in this particular case,  the code comment is modified
> in accordance with what GCC is expecting to find.
> 
> This patch is part of the ongoing efforts to enable
> -Wimplicit-fallthrough.
> 
> Signed-off-by: Gustavo A. R. Silva 
> ---
>  drivers/gpu/drm/nouveau/nouveau_bo.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/nouveau/nouveau_bo.c 
> b/drivers/gpu/drm/nouveau/nouveau_bo.c
> index 73eff52036d2..a72be71c45b4 100644
> --- a/drivers/gpu/drm/nouveau/nouveau_bo.c
> +++ b/drivers/gpu/drm/nouveau/nouveau_bo.c
> @@ -1434,7 +1434,7 @@ nouveau_ttm_io_mem_reserve(struct ttm_bo_device *bdev, 
> struct ttm_mem_reg *reg)
>   if (drm->client.mem->oclass < NVIF_CLASS_MEM_NV50 || !mem->kind)
>   /* untiled */
>   break;
> - /* fallthrough, tiled memory */
> + /* fall through - tiled memory */
>   case TTM_PL_VRAM:
>   reg->bus.offset = reg->start << PAGE_SHIFT;
>   reg->bus.base = device->func->resource_addr(device, 1);
> 
___
Nouveau mailing list
Nouveau@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/nouveau

Re: [Nouveau] [PATCH] drm: Mark expected switch fall-throughs

2019-02-15 Thread Alex Deucher
On Fri, Feb 15, 2019 at 11:08 AM Gustavo A. R. Silva
 wrote:
>
> In preparation to enabling -Wimplicit-fallthrough, mark switch
> cases where we are expecting to fall through.
>
> Warning level 3 was used: -Wimplicit-fallthrough=3
>
> Notice that, in some cases, the code comment is modified
> in accordance with what GCC is expecting to find.
>
> This patch is part of the ongoing efforts to enable
> -Wimplicit-fallthrough.
>
> Signed-off-by: Gustavo A. R. Silva 

Can you please split this up per driver?  A comment below as well.

> ---
>  drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c   | 1 +
>  drivers/gpu/drm/amd/amdgpu/si_dpm.c | 2 ++
>  drivers/gpu/drm/amd/display/dc/bios/bios_parser2.c  | 2 ++
>  drivers/gpu/drm/amd/display/dc/dce/dce_mem_input.c  | 2 +-
>  drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c| 2 ++
>  drivers/gpu/drm/amd/powerplay/smumgr/polaris10_smumgr.c | 1 +
>  drivers/gpu/drm/drm_vm.c| 4 ++--
>  drivers/gpu/drm/nouveau/nouveau_bo.c| 2 +-
>  drivers/gpu/drm/radeon/ci_dpm.c | 2 ++
>  drivers/gpu/drm/radeon/evergreen_cs.c   | 1 +
>  drivers/gpu/drm/radeon/si_dpm.c | 2 ++
>  11 files changed, 17 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c 
> b/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c
> index b8e50a34bdb3..02955e6e9dd9 100644
> --- a/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c
> +++ b/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c
> @@ -3236,6 +3236,7 @@ static void gfx_v8_0_tiling_mode_table_init(struct 
> amdgpu_device *adev)
> dev_warn(adev->dev,
>  "Unknown chip type (%d) in function 
> gfx_v8_0_tiling_mode_table_init() falling through to CHIP_CARRIZO\n",
>  adev->asic_type);
> +   /* fall through */
>
> case CHIP_CARRIZO:
> modearray[0] = (ARRAY_MODE(ARRAY_2D_TILED_THIN1) |
> diff --git a/drivers/gpu/drm/amd/amdgpu/si_dpm.c 
> b/drivers/gpu/drm/amd/amdgpu/si_dpm.c
> index da58040fdbdc..41e01a7f57a4 100644
> --- a/drivers/gpu/drm/amd/amdgpu/si_dpm.c
> +++ b/drivers/gpu/drm/amd/amdgpu/si_dpm.c
> @@ -6216,10 +6216,12 @@ static void 
> si_request_link_speed_change_before_state_change(struct amdgpu_devic
> si_pi->force_pcie_gen = AMDGPU_PCIE_GEN2;
> if (current_link_speed == AMDGPU_PCIE_GEN2)
> break;
> +   /* fall through */
> case AMDGPU_PCIE_GEN2:
> if (amdgpu_acpi_pcie_performance_request(adev, 
> PCIE_PERF_REQ_PECI_GEN2, false) == 0)
> break;
>  #endif
> +   /* fall through */
> default:
> si_pi->force_pcie_gen = 
> si_get_current_pcie_speed(adev);
> break;
> diff --git a/drivers/gpu/drm/amd/display/dc/bios/bios_parser2.c 
> b/drivers/gpu/drm/amd/display/dc/bios/bios_parser2.c
> index a1c56f29cfeb..fd5266a58297 100644
> --- a/drivers/gpu/drm/amd/display/dc/bios/bios_parser2.c
> +++ b/drivers/gpu/drm/amd/display/dc/bios/bios_parser2.c
> @@ -265,6 +265,7 @@ static struct atom_display_object_path_v2 
> *get_bios_object(
> && id.enum_id == obj_id.enum_id)
> return 
> >object_info_tbl.v1_4->display_path[i];
> }
> +   /* fall through */
> case OBJECT_TYPE_CONNECTOR:
> case OBJECT_TYPE_GENERIC:
> /* Both Generic and Connector Object ID
> @@ -277,6 +278,7 @@ static struct atom_display_object_path_v2 
> *get_bios_object(
> && id.enum_id == obj_id.enum_id)
> return 
> >object_info_tbl.v1_4->display_path[i];
> }
> +   /* fall through */
> default:
> return NULL;
> }
> diff --git a/drivers/gpu/drm/amd/display/dc/dce/dce_mem_input.c 
> b/drivers/gpu/drm/amd/display/dc/dce/dce_mem_input.c
> index 85686d917636..a24a2bda8656 100644
> --- a/drivers/gpu/drm/amd/display/dc/dce/dce_mem_input.c
> +++ b/drivers/gpu/drm/amd/display/dc/dce/dce_mem_input.c
> @@ -479,7 +479,7 @@ static void program_grph_pixel_format(
> case SURFACE_PIXEL_FORMAT_GRPH_ABGR16161616F:
> sign = 1;
> floating = 1;
> -   /* no break */
> +   /* fall through */
> case SURFACE_PIXEL_FORMAT_GRPH_ARGB16161616F: /* shouldn't this get 
> float too? */
> case SURFACE_PIXEL_FORMAT_GRPH_ARGB16161616:
> grph_depth = 3;
> diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c 
> b/drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c
> index c8f5c00dd1e7..48187acac59e 100644
> --- a/drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c
> +++ 

[Nouveau] [PATCH] drm: Mark expected switch fall-throughs

2019-02-15 Thread Gustavo A. R. Silva
In preparation to enabling -Wimplicit-fallthrough, mark switch
cases where we are expecting to fall through.

Warning level 3 was used: -Wimplicit-fallthrough=3

Notice that, in some cases, the code comment is modified
in accordance with what GCC is expecting to find.

This patch is part of the ongoing efforts to enable
-Wimplicit-fallthrough.

Signed-off-by: Gustavo A. R. Silva 
---
 drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c   | 1 +
 drivers/gpu/drm/amd/amdgpu/si_dpm.c | 2 ++
 drivers/gpu/drm/amd/display/dc/bios/bios_parser2.c  | 2 ++
 drivers/gpu/drm/amd/display/dc/dce/dce_mem_input.c  | 2 +-
 drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c| 2 ++
 drivers/gpu/drm/amd/powerplay/smumgr/polaris10_smumgr.c | 1 +
 drivers/gpu/drm/drm_vm.c| 4 ++--
 drivers/gpu/drm/nouveau/nouveau_bo.c| 2 +-
 drivers/gpu/drm/radeon/ci_dpm.c | 2 ++
 drivers/gpu/drm/radeon/evergreen_cs.c   | 1 +
 drivers/gpu/drm/radeon/si_dpm.c | 2 ++
 11 files changed, 17 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c 
b/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c
index b8e50a34bdb3..02955e6e9dd9 100644
--- a/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c
@@ -3236,6 +3236,7 @@ static void gfx_v8_0_tiling_mode_table_init(struct 
amdgpu_device *adev)
dev_warn(adev->dev,
 "Unknown chip type (%d) in function 
gfx_v8_0_tiling_mode_table_init() falling through to CHIP_CARRIZO\n",
 adev->asic_type);
+   /* fall through */
 
case CHIP_CARRIZO:
modearray[0] = (ARRAY_MODE(ARRAY_2D_TILED_THIN1) |
diff --git a/drivers/gpu/drm/amd/amdgpu/si_dpm.c 
b/drivers/gpu/drm/amd/amdgpu/si_dpm.c
index da58040fdbdc..41e01a7f57a4 100644
--- a/drivers/gpu/drm/amd/amdgpu/si_dpm.c
+++ b/drivers/gpu/drm/amd/amdgpu/si_dpm.c
@@ -6216,10 +6216,12 @@ static void 
si_request_link_speed_change_before_state_change(struct amdgpu_devic
si_pi->force_pcie_gen = AMDGPU_PCIE_GEN2;
if (current_link_speed == AMDGPU_PCIE_GEN2)
break;
+   /* fall through */
case AMDGPU_PCIE_GEN2:
if (amdgpu_acpi_pcie_performance_request(adev, 
PCIE_PERF_REQ_PECI_GEN2, false) == 0)
break;
 #endif
+   /* fall through */
default:
si_pi->force_pcie_gen = si_get_current_pcie_speed(adev);
break;
diff --git a/drivers/gpu/drm/amd/display/dc/bios/bios_parser2.c 
b/drivers/gpu/drm/amd/display/dc/bios/bios_parser2.c
index a1c56f29cfeb..fd5266a58297 100644
--- a/drivers/gpu/drm/amd/display/dc/bios/bios_parser2.c
+++ b/drivers/gpu/drm/amd/display/dc/bios/bios_parser2.c
@@ -265,6 +265,7 @@ static struct atom_display_object_path_v2 *get_bios_object(
&& id.enum_id == obj_id.enum_id)
return 
>object_info_tbl.v1_4->display_path[i];
}
+   /* fall through */
case OBJECT_TYPE_CONNECTOR:
case OBJECT_TYPE_GENERIC:
/* Both Generic and Connector Object ID
@@ -277,6 +278,7 @@ static struct atom_display_object_path_v2 *get_bios_object(
&& id.enum_id == obj_id.enum_id)
return 
>object_info_tbl.v1_4->display_path[i];
}
+   /* fall through */
default:
return NULL;
}
diff --git a/drivers/gpu/drm/amd/display/dc/dce/dce_mem_input.c 
b/drivers/gpu/drm/amd/display/dc/dce/dce_mem_input.c
index 85686d917636..a24a2bda8656 100644
--- a/drivers/gpu/drm/amd/display/dc/dce/dce_mem_input.c
+++ b/drivers/gpu/drm/amd/display/dc/dce/dce_mem_input.c
@@ -479,7 +479,7 @@ static void program_grph_pixel_format(
case SURFACE_PIXEL_FORMAT_GRPH_ABGR16161616F:
sign = 1;
floating = 1;
-   /* no break */
+   /* fall through */
case SURFACE_PIXEL_FORMAT_GRPH_ARGB16161616F: /* shouldn't this get 
float too? */
case SURFACE_PIXEL_FORMAT_GRPH_ARGB16161616:
grph_depth = 3;
diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c 
b/drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c
index c8f5c00dd1e7..48187acac59e 100644
--- a/drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c
+++ b/drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c
@@ -3681,10 +3681,12 @@ static int 
smu7_request_link_speed_change_before_state_change(
data->force_pcie_gen = PP_PCIEGen2;
if (current_link_speed == PP_PCIEGen2)
break;
+   /* fall through */
case 

Re: [Nouveau] [PATCH] drm/nouveau/nvkm: mark expected switch fall-throughs

2019-02-15 Thread Gustavo A. R. Silva
Hello,

Friendly ping (second one):

Who can take this, please?

Thanks
--
Gustavo

On 1/10/19 1:33 PM, Gustavo A. R. Silva wrote:
> Hi,
> 
> Friendly ping:
> 
> Who can take this?
> 
> Thanks
> -- 
> Gustavo
> 
> On 10/17/18 9:28 AM, Gustavo A. R. Silva wrote:
>> In preparation to enabling -Wimplicit-fallthrough, mark switch cases
>> where we are expecting to fall through.
>>
>> This patch aims to suppress 29 missing-break-in-switch false positives.
>>
>> Addresses-Coverity-ID: 1456891 ("Missing break in switch")
>> Addresses-Coverity-ID: 1324063 ("Missing break in switch")
>> Addresses-Coverity-ID: 1324063 ("Missing break in switch")
>> Addresses-Coverity-ID: 141432 ("Missing break in switch")
>> Addresses-Coverity-ID: 141433 ("Missing break in switch")
>> Addresses-Coverity-ID: 141434 ("Missing break in switch")
>> Addresses-Coverity-ID: 141435 ("Missing break in switch")
>> Addresses-Coverity-ID: 141436 ("Missing break in switch")
>> Signed-off-by: Gustavo A. R. Silva 
>> ---
>>   drivers/gpu/drm/nouveau/nvkm/engine/disp/hdmi.c    | 17 +
>>   drivers/gpu/drm/nouveau/nvkm/engine/dma/usernv04.c |  1 +
>>   drivers/gpu/drm/nouveau/nvkm/engine/fifo/nv04.c    |  2 ++
>>   drivers/gpu/drm/nouveau/nvkm/engine/fifo/nv40.c    |  1 +
>>   drivers/gpu/drm/nouveau/nvkm/subdev/bios/perf.c    |  1 +
>>   drivers/gpu/drm/nouveau/nvkm/subdev/bios/pll.c |  1 +
>>   drivers/gpu/drm/nouveau/nvkm/subdev/clk/base.c |  1 +
>>   drivers/gpu/drm/nouveau/nvkm/subdev/clk/mcp77.c    |  1 +
>>   drivers/gpu/drm/nouveau/nvkm/subdev/fb/ramnv40.c   |  2 ++
>>   drivers/gpu/drm/nouveau/nvkm/subdev/mxm/nv50.c |  1 +
>>   10 files changed, 28 insertions(+)
>>
>> diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/disp/hdmi.c 
>> b/drivers/gpu/drm/nouveau/nvkm/engine/disp/hdmi.c
>> index d131cca..10f2aa9 100644
>> --- a/drivers/gpu/drm/nouveau/nvkm/engine/disp/hdmi.c
>> +++ b/drivers/gpu/drm/nouveau/nvkm/engine/disp/hdmi.c
>> @@ -23,38 +23,55 @@ void pack_hdmi_infoframe(struct packed_hdmi_infoframe 
>> *packed_frame,
>>    */
>>   case 17:
>>   subpack1_high = (raw_frame[16] << 16);
>> +    /* fall through */
>>   case 16:
>>   subpack1_high |= (raw_frame[15] << 8);
>> +    /* fall through */
>>   case 15:
>>   subpack1_high |= raw_frame[14];
>> +    /* fall through */
>>   case 14:
>>   subpack1_low = (raw_frame[13] << 24);
>> +    /* fall through */
>>   case 13:
>>   subpack1_low |= (raw_frame[12] << 16);
>> +    /* fall through */
>>   case 12:
>>   subpack1_low |= (raw_frame[11] << 8);
>> +    /* fall through */
>>   case 11:
>>   subpack1_low |= raw_frame[10];
>> +    /* fall through */
>>   case 10:
>>   subpack0_high = (raw_frame[9] << 16);
>> +    /* fall through */
>>   case 9:
>>   subpack0_high |= (raw_frame[8] << 8);
>> +    /* fall through */
>>   case 8:
>>   subpack0_high |= raw_frame[7];
>> +    /* fall through */
>>   case 7:
>>   subpack0_low = (raw_frame[6] << 24);
>> +    /* fall through */
>>   case 6:
>>   subpack0_low |= (raw_frame[5] << 16);
>> +    /* fall through */
>>   case 5:
>>   subpack0_low |= (raw_frame[4] << 8);
>> +    /* fall through */
>>   case 4:
>>   subpack0_low |= raw_frame[3];
>> +    /* fall through */
>>   case 3:
>>   header = (raw_frame[2] << 16);
>> +    /* fall through */
>>   case 2:
>>   header |= (raw_frame[1] << 8);
>> +    /* fall through */
>>   case 1:
>>   header |= raw_frame[0];
>> +    /* fall through */
>>   case 0:
>>   break;
>>   }
>> diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/dma/usernv04.c 
>> b/drivers/gpu/drm/nouveau/nvkm/engine/dma/usernv04.c
>> index 49ef7e5..7f1adab 100644
>> --- a/drivers/gpu/drm/nouveau/nvkm/engine/dma/usernv04.c
>> +++ b/drivers/gpu/drm/nouveau/nvkm/engine/dma/usernv04.c
>> @@ -122,6 +122,7 @@ nv04_dmaobj_new(struct nvkm_dma *dma, const struct 
>> nvkm_oclass *oclass,
>>   break;
>>   case NV_MEM_ACCESS_WO:
>>   dmaobj->flags0 |= 0x8000;
>> +    /* fall through */
>>   case NV_MEM_ACCESS_RW:
>>   dmaobj->flags2 |= 0x0002;
>>   break;
>> diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/fifo/nv04.c 
>> b/drivers/gpu/drm/nouveau/nvkm/engine/fifo/nv04.c
>> index ad707ff..93493b3 100644
>> --- a/drivers/gpu/drm/nouveau/nvkm/engine/fifo/nv04.c
>> +++ b/drivers/gpu/drm/nouveau/nvkm/engine/fifo/nv04.c
>> @@ -117,8 +117,10 @@ nv04_fifo_swmthd(struct nvkm_device *device, u32 chid, 
>> u32 addr, u32 data)
>>   switch (mthd) {
>>   case 0x ... 0x: /* subchannel's engine -> software */
>>   nvkm_wr32(device, 0x003280, (engine &= ~mask));
>> +    /* fall through */
>>   case 0x0180 ... 0x01fc: /* handle -> instance */
>>   data = nvkm_rd32(device, 

Re: [Nouveau] [PATCH] pci/quirks: Add quirk to reset nvgpu at boot for the Lenovo ThinkPad P50

2019-02-15 Thread Sasha Levin
Hi,

[This is an automated email]

This commit has been processed because it contains a -stable tag.
The stable tag indicates that it's relevant for the following trees: all

The bot has tested the following trees: v4.20.8, v4.19.21, v4.14.99, v4.9.156, 
v4.4.174, v3.18.134.

v4.20.8: Build OK!
v4.19.21: Failed to apply! Possible dependencies:
01d5d7fa8376 ("PCI: Add macro for Switchtec quirk declarations")

v4.14.99: Failed to apply! Possible dependencies:
01d5d7fa8376 ("PCI: Add macro for Switchtec quirk declarations")
06dc4ee54e30 ("PCI: Disable MSI for Freescale Layerscape PCIe RC mode")
07f4f97d7b4b ("vga_switcheroo: Use device link for HDA controller")
8948ca1a12c9 ("vga_switcheroo: Deduplicate power state tracking")
ad281ecf1c7d ("PCI: Add DMA alias quirk for Microsemi Switchtec NTB")

v4.9.156: Failed to apply! Possible dependencies:
01d5d7fa8376 ("PCI: Add macro for Switchtec quirk declarations")
07f4f97d7b4b ("vga_switcheroo: Use device link for HDA controller")
3e13676862f9 ("thunderbolt: Add support for DMA configuration based 
mailbox")
46cd4b75cd0e ("efi: Add device path parser")
58c5475aba67 ("x86/efi: Retrieve and assign Apple device properties")
630b3aff8a51 ("treewide: Consolidate Apple DMI checks")
81a54b5e1986 ("thunderbolt: Let the connection manager handle all 
notifications")
8948ca1a12c9 ("vga_switcheroo: Deduplicate power state tracking")
9d3cce0b6136 ("thunderbolt: Introduce thunderbolt bus and connection 
manager")
ac6c44de503e ("thunderbolt: Expose get_route() to other files")
ad281ecf1c7d ("PCI: Add DMA alias quirk for Microsemi Switchtec NTB")
bfe778ac4982 ("thunderbolt: Convert switch to a device")
c9cc3aaa0281 ("thunderbolt: Use Device ROM retrieved from EFI")
da2da04b8d44 ("thunderbolt: Rework capability handling")
f67cf491175a ("thunderbolt: Add support for Internal Connection Manager 
(ICM)")
fa6d513aefe4 ("drivers:gpu: vga :vga_switcheroo.c : Fixed some coding style 
issues")

v4.4.174: Failed to apply! Possible dependencies:
01d5d7fa8376 ("PCI: Add macro for Switchtec quirk declarations")
07f4f97d7b4b ("vga_switcheroo: Use device link for HDA controller")
14d2000182ed ("drm/radeon: Defer probe if gmux is present but its driver 
isn't")
156d7d4120e1 ("vga_switcheroo: Add handler flags infrastructure")
3a848662c751 ("vga_switcheroo: Prettify documentation")
412c8f7de011 ("drm/radeon: Return -EPROBE_DEFER when amdkfd not loaded")
704ab614ec12 ("drm/i915: Defer probe if gmux is present but its driver 
isn't")
8948ca1a12c9 ("vga_switcheroo: Deduplicate power state tracking")
989561de9b51 ("PM / Domains: add setter for dev.pm_domain")
98b3a3402eb6 ("drm/nouveau: Defer probe if gmux is present but its driver 
isn't")
a345918d6ee6 ("vga_switcheroo: Support deferred probing of audio clients")
ad281ecf1c7d ("PCI: Add DMA alias quirk for Microsemi Switchtec NTB")
b00e5334ab1b ("vga_switcheroo: Add helper for deferred probing")
b5f88dd1d6ef ("Revert "ACPI / LPSS: allow to use specific PM domain during 
->probe()"")
c1e1655bb892 ("apple-gmux: Assign apple_gmux_data before registering")
c68f4528a2e9 ("drm/amdkfd: Track when module's init is complete")
fa6d513aefe4 ("drivers:gpu: vga :vga_switcheroo.c : Fixed some coding style 
issues")

v3.18.134: Failed to apply! Possible dependencies:
01d5d7fa8376 ("PCI: Add macro for Switchtec quirk declarations")
07f4f97d7b4b ("vga_switcheroo: Use device link for HDA controller")
083dba02947d ("drm/nouveau/device: recognise GM204")
2f4a58e852d1 ("drm/nouveau/subdev: always upcast through 
nouveau_subdev()/nouveau_engine()")
4766ec53945f ("drm/nouveau/bios: add parsing of BIT M(v2) +0x03 table")
50e216d6e7c3 ("drm/nouveau/bios: add parsing of pmu image tables")
5444204036b2 ("drm/nouveau: switch to new-style timer macros")
7bb6d4428d3d ("drm/nouveau: move the (far too many...) different s/r paths 
to the same place")
8d5e3af15c79 ("drm/nouveau/device: Add support for GK208B, resolves bug 
86935")
8d85e06b5e04 ("drm/nouveau/bios: add pci data structure parsing")
989aa5b76ad2 ("drm/nouveau/nvif: namespace of nvkm accessors (no binary 
change)")
a01ca78c8f11 ("drm/nouveau/nvif: simplify and tidy library interfaces")
ad281ecf1c7d ("PCI: Add DMA alias quirk for Microsemi Switchtec NTB")
ad4a36263535 ("drm/nouveau/bios: split out shadow methods")
b71a1344ec20 ("drm/nouveau/bios: add NPDE parsing")
ba6e34e61271 ("drm/gm204/devinit: initial implementation")
be83cd4ef9a2 ("drm/nouveau: finalise nvkm namespace switch (no binary 
change)")
c39f472e9f14 ("drm/nouveau: remove symlinks, move core/ to nvkm/ (no code 
changes)")
cb8bb9cedb60 ("drm/nouveau/tmr: cosmetic changes")
d38ceaf99ed0 ("drm/amdgpu: add core driver (v4)")
f3867f439fd6 ("drm/nouveau/clk: rename from clock (no binary change)")
f8a8546194d7 

[Nouveau] [Bug 106391] Noveau fails to compile when using meson and LLVM without RTTI

2019-02-15 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=106391

Dylan Baker  changed:

   What|Removed |Added

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

--- Comment #1 from Dylan Baker  ---
This should be fixed now, please re-open if it's not.

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

Re: [Nouveau] [PATCH] pci/quirks: Add quirk to reset nvgpu at boot for the Lenovo ThinkPad P50

2019-02-15 Thread Bjorn Helgaas
Hi Lyude,

On Tue, Feb 12, 2019 at 05:02:30PM -0500, Lyude Paul wrote:
> On a very specific subset of ThinkPad P50 SKUs, particularly ones that
> come with a Quadro M1000M chip instead of the M2000M variant, the BIOS
> seems to have a very nasty habit of not always resetting the secondary
> Nvidia GPU between full reboots if the laptop is configured in Hybrid
> Graphics mode. The reason for this happening is unknown, but the
> following steps and possibly a good bit of patience will reproduce the
> issue:
> 
> 1. Boot up the laptop normally in Hybrid graphics mode
> 2. Make sure nouveau is loaded and that the GPU is awake
> 2. Allow the nvidia GPU to runtime suspend itself after being idle
> 3. Reboot the machine, the more sudden the better (e.g sysrq-b may help)
> 4. If nouveau loads up properly, reboot the machine again and go back to
> step 2 until you reproduce the issue
> 
> This results in some very strange behavior: the GPU will
> quite literally be left in exactly the same state it was in when the
> previously booted kernel started the reboot. This has all sorts of bad
> sideaffects: for starters, this completely breaks nouveau starting with a
> mysterious EVO channel failure that happens well before we've actually
> used the EVO channel for anything:

There are a lot of moving parts here that are probably obvious to you
but not to me.  I need help untangling this a bit so I'm comfortable
that we got to the root cause and that we're doing something logical
as opposed to something that just happens to make things work.  I
really don't know enough to even ask the right questions...

Is there a bug report for this?  Bugzilla.kernel.org would be ideal,
including "lspci -vvxxx" and dmidecode for the system.

Is this running a current BIOS?  The date in your log below looks
pretty recent, so I assume it is current.

I assume "hybrid graphics" means you have two GPUs.  Do you select
hybrid graphics mode in the BIOS?

I assume when you say the Nvidia GPU doesn't get reset on a full
reboot, you're talking about a "warm reboot", and that if you actually
remove the power and do a cold reboot, there's no problem?

I assume Nvidia GPU being active means you are using the performance
GPU.  Does that mean the integrated GPU is completely unused and Linux
does nothing at all with it?  Is Linux doing any switching between
them?  If so, how?  I am not 100% confident in the code I've seen that
does the switching.

> nouveau :01:00.0: disp: chid 0 mthd  data 0400 1000
> 0002
> 
> Later on, this causes us to timeout trying to bring up the GR ctx:
> 
> [ cut here ]
> nouveau :01:00.0: timeout
> WARNING: CPU: 0 PID: 12 at
> drivers/gpu/drm/nouveau/nvkm/engine/gr/ctxgf100.c:1547
> gf100_grctx_generate+0x7b2/0x850 [nouveau]
> Modules linked in: nouveau mxm_wmi i915 crc32c_intel ttm i2c_algo_bit
> serio_raw drm_kms_helper syscopyarea sysfillrect sysimgblt fb_sys_fops
> xhci_pci drm xhci_hcd i2c_core wmi video
> CPU: 0 PID: 12 Comm: kworker/0:1 Not tainted 5.0.0-rc5Lyude-Test+ #29
> Hardware name: LENOVO 20EQS64N0B/20EQS64N0B, BIOS N1EET82W (1.55 )
> 12/18/2018
> Workqueue: events_long drm_dp_mst_link_probe_work [drm_kms_helper]
> RIP: 0010:gf100_grctx_generate+0x7b2/0x850 [nouveau]
> Code: 85 d2 75 04 48 8b 57 10 48 89 95 28 ff ff ff e8 b4 37 0e e1 48 8b
> 95 28 ff ff ff 48 c7 c7 b1 97 57 a0 48 89 c6 e8 5a 38 c0 e0 <0f> 0b e9
> b9 fd ff ff 48 8b 85 60 ff ff ff 48 8b 40 10 48 8b 78 10
> RSP: 0018:c90b77f0 EFLAGS: 00010286
> RAX:  RBX: 71af8000 RCX: 
> RDX: 7f41dfe0 RSI: 7f415698 RDI: 7f415698
> RBP: c90b78c8 R08:  R09: 
> R10:  R11:  R12: 72118000
> R13:  R14: a0551420 R15: c90b7818
> FS:  () GS:7f40()
> knlGS:
> CS:  0010 DS:  ES:  CR0: 80050033
> CR2: 5644d0556ca8 CR3: 02214006 CR4: 003606f0
> DR0:  DR1:  DR2: 
> DR3:  DR6: fffe0ff0 DR7: 0400
> Call Trace:
>  gf100_gr_init_ctxctl+0x27b/0x2d0 [nouveau]
>  gf100_gr_init+0x5bd/0x5e0 [nouveau]
>  gf100_gr_init_+0x61/0x70 [nouveau]
>  nvkm_gr_init+0x1d/0x20 [nouveau]
>  nvkm_engine_init+0xcb/0x210 [nouveau]
>  nvkm_subdev_init+0xd6/0x230 [nouveau]
>  nvkm_engine_ref.part.0+0x52/0x70 [nouveau]
>  nvkm_engine_ref+0x13/0x20 [nouveau]
>  nvkm_ioctl_new+0x12c/0x260 [nouveau]
>  ? nvkm_fifo_chan_child_del+0xa0/0xa0 [nouveau]
>  ? gf100_gr_dtor+0xe0/0xe0 [nouveau]
>  nvkm_ioctl+0xe2/0x180 [nouveau]
>  nvkm_client_ioctl+0x12/0x20 [nouveau]
>  nvif_object_ioctl+0x47/0x50 [nouveau]
>  nvif_object_init+0xc8/0x120 [nouveau]
>  nvc0_fbcon_accel_init+0x5c/0x960 [nouveau]
>  nouveau_fbcon_create+0x5a5/0x5d0 [nouveau]
>  ? drm_setup_crtcs+0x27b/0xcb0 [drm_kms_helper]
>  ? __lock_is_held+0x5e/0xa0