Received: by 2002:a05:6a10:17d3:0:0:0:0 with SMTP id hz19csp2381824pxb; Tue, 13 Apr 2021 00:00:45 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz0INDnpqcdZSLkrdtFjF/d91rCfhyEELczPwB8IeNd3UeYPxdE0hqrRhqGpPKe2dAl4mNY X-Received: by 2002:a17:902:c404:b029:ea:f0a9:6060 with SMTP id k4-20020a170902c404b02900eaf0a96060mr10190377plk.9.1618297245338; Tue, 13 Apr 2021 00:00:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1618297245; cv=none; d=google.com; s=arc-20160816; b=EISqg0UeFjchHMfm8ps3rAJc1SG83o7llbJzPNvTZe2yzI6LkeLrYaHJACajVqOPd/ CoY9xWKsArZNIQJrdTj89tmcO2HMLRhsK5HatzGKXb6vpkYeiK0s9MxTafANv2ziUlZp 0fulwzYQ4Gq4XVu1uWZZqrirI7i7w0Wa4zhqCSnAozYAyfLeuhfE3YbOhg5gdfHRwjEI nWdTszzsqrT2U/UzK2DZ0Tou5+Ny1ZuAYByzZhkDI7gVKHALp4SgIZN/+msLf1HNjH93 3O+NRhvVnemH5BOh0cpSIMwrJ1ATPbXrIr481rPaRxtTMtxgiHlIh/sdEqpgZtd9UV8u JoOg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version; bh=V1DKBip1cD3aSFLjp4/QXCXfgqw6DxdHnGOMaVMs/Mk=; b=LV0544YVBNORb5l4i0yyNBxc22nYcxvfTk4pymEEfZhhTJ2lBW+m8n0eHKS06kfRMc 1d4kl+rMnI5OgdDGPucDoTfY+mC4OTfpKapqvaYDyrN1sDk2tmQboKwfiSif/Oznm1wD wtb9oj0ZbM95GnUs59a9IYTzXpegiQYDwxcCFKChVibId1Ev+1VB1TaDbpx3loWfh5gX Z0axig5qpQ279d0II06Xqv+JTXfMBbEZzFtSFyfCyhDWg8zdAh6Wahhgc9UMzopDahmd HwqbaTml2Pz/sR6lwD0+OAjbjPXSJEtV1WJrfjm41Wapfk/LsrxIo0QkSlvjchhBlJbv yXcQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id 66si15862611pfy.284.2021.04.13.00.00.33; Tue, 13 Apr 2021 00:00:45 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237349AbhDLUEO (ORCPT + 99 others); Mon, 12 Apr 2021 16:04:14 -0400 Received: from mail-io1-f46.google.com ([209.85.166.46]:36532 "EHLO mail-io1-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237103AbhDLUEN (ORCPT ); Mon, 12 Apr 2021 16:04:13 -0400 Received: by mail-io1-f46.google.com with SMTP id d5so5307912iof.3; Mon, 12 Apr 2021 13:03:55 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=V1DKBip1cD3aSFLjp4/QXCXfgqw6DxdHnGOMaVMs/Mk=; b=Wxl/CsXMlTrlJjA6dZhUr8xyacdgcncz2+KRG8yA9LpXndOH9nBi5qvJ5gBtPBrp5u hENprIu3eHEaFdgLBasmRFBKlnRuqwtekrkFs6kgVYzvilOXVJ5oA/vagRWrKDMHuCwQ 9OlOAwNW950qF4EppyxjJAoRwXKhymCw9RMRs2M9E8CP/BhLOGr6QtEKMi/rwUCue3o9 cCHP9HMlP8mB5sV8ZGpEB4NIUSUkOCxO1TbSk/rTcIrRl5pLTGePq8kjQYafhNx3Prnq CQODEiVvYFAeUN1h+ulKCUuQq4qj6MKCjwhX/pGq7ZWTPoDkVAa3PHqT8UGJb9MRnwUP qx0Q== X-Gm-Message-State: AOAM530s2YCsSdJT3d26Zw1VzAYwN5NN88MhEz6aoXx7NPbJW/AV8/Ud nEpOTxR+VNzoObjX5takoToT2hxfoxylkb4KyCk= X-Received: by 2002:a6b:ec08:: with SMTP id c8mr23006489ioh.55.1618257834792; Mon, 12 Apr 2021 13:03:54 -0700 (PDT) MIME-Version: 1.0 References: <20210410192314.GB16240@wunner.de> <81b2a8c7-5b0b-b8fa-fbed-f164128de7a3@nvidia.com> <8d358110-769d-b984-d2ec-825dc2c3d77a@spliet.org> In-Reply-To: From: Ilia Mirkin Date: Mon, 12 Apr 2021 16:03:43 -0400 Message-ID: Subject: Re: [Nouveau] [PATCH v2] ALSA: hda: Continue to probe when codec probe fails To: Aaron Plattner Cc: Roy Spliet , Lukas Wunner , "moderated list:SOUND" , open list , Kai Vehmanen , Takashi Iwai , nouveau , Pierre-Louis Bossart , tiwai@suse.com, Bjorn Helgaas , Kai-Heng Feng , Alan Stern , Linux PCI , Alex Deucher , Jaroslav Kysela , Mike Rapoport Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Apr 12, 2021 at 4:01 PM Aaron Plattner wrote: > > On 4/12/21 12:36 PM, Roy Spliet wrote: > > Hello Aaron, > > > > Thanks for your insights. A follow-up query and some observations > > in-line. > > > > Op 12-04-2021 om 20:06 schreef Aaron Plattner: > >> On 4/10/21 1:48 PM, Roy Spliet wrote: > >>> Op 10-04-2021 om 20:23 schreef Lukas Wunner: > >>>> On Sat, Apr 10, 2021 at 04:51:27PM +0100, Roy Spliet wrote: > >>>>> Can I ask someone with more > >>>>> technical knowledge of snd_hda_intel and vgaswitcheroo to > >>>>> brainstorm about > >>>>> the possible challenges of nouveau taking matters into its own > >>>>> hand rather > >>>>> than keeping this PCI quirk around? > >>>> > >>>> It sounds to me like the HDA is not powered if no cable is plugged in. > >>>> What is reponsible then for powering it up or down, firmware code on > >>>> the GPU or in the host's BIOS? > >>> > >>> Sometimes the BIOS, but definitely unconditionally the PCI quirk > >>> code: > >>> https://github.com/torvalds/linux/blob/master/drivers/pci/quirks.c#L5289 > >>> > >>> > >>> (CC Aaron Plattner) > >> > >> My basic understanding is that the audio function stops responding > >> whenever the graphics function is powered off. So the requirement > >> here is that the audio driver can't try to talk to the audio function > >> while the graphics function is asleep, and must trigger a graphics > >> function wakeup before trying to communicate with the audio function. > > > > I believe that vgaswitcheroo takes care of this for us. > > > >> I think there are also requirements about the audio function needing > >> to be awake when the graphics driver is updating the ELD, but I'm not > >> sure. > >> > >> This is harder on Windows because the audio driver lives in its own > >> little world doing its own thing but on Linux we can do better. > >> > >>>> Ideally, we should try to find out how to control HDA power from the > >>>> operating system rather than trying to cooperate with whatever > >>>> firmware > >>>> is doing. If we have that capability, the OS should power the HDA up > >>>> and down as it sees fit. > >> > >> After system boot, I don't think there's any firmware involved, but > >> I'm not super familiar with the low-level details and it's possible > >> the situation changed since I last looked at it. > >> > >> I think the problem with having nouveau write this quirk is that the > >> kernel will need to re-probe the PCI device to notice that it has > >> suddenly become a multi-function device with an audio function, and > >> hotplug the audio driver. I originally looked into trying to do that > >> but it was tricky because the PCI subsystem didn't really have a > >> mechanism for a single-function device to become a multi-function > >> device on the fly and it seemed easier to enable it early on during > >> bus enumeration. That way the kernel sees both functions all the time > >> without anything else having to be special about this configuration. > > > > Right, so for a little more context: a while ago I noticed that my > > laptop (lucky me, Asus K501UB) has a 940M with HDA but no codec. Seems > > legit, given how this GPU has no displays attached; they're all hooked > > up to the Intel integrated GPU. That threw off the snd_hda_intel > > mid-probe, and as a result didn't permit runpm, keeping the entire > > GPU, PCIe bus and thus the CPU package awake. A bit of hackerly later > > we decided to continue probing without a codec, and now my laptop is > > happy, but... > > What is the PCI class of the GPU in your system? If it has no display > outputs it's probably 0x302 ("3D Controller") rather than 0x300 ("VGA > Controller"). Looking at the code it looks like this workaround is being > applied to both but maybe it should be restricted to just VGA controllers. That was a comment I had back when the quirk was being implemented, but helpfully there are some of these devices running around which say "3D Controller" but still have displays attached to them. Lukas probably remembers more specifics. -ilia