On Mon, 20 Jun 2022 11:26:52 +0200, Kai Vehmanen wrote:
Hi,
On Mon, 20 Jun 2022, Takashi Iwai wrote:
we've got a regression report about Intel HDMI. It seems that the recent change to skip the component binding (commit c9db8a30d9f0) throws away the devices incorrectly on IvyBridge. I guess the similar issue could happen on older chips. The bug report is found at https://bugzilla.opensuse.org/show_bug.cgi?id=1200611
we'll check. We actually have IVB (and older), in the i915 CI and I can see the binding check working correctly there (with 5.19-rc2). But obviously something goes wrong in the reporter's case, so needs more debug.
So this looks like a bug due to the use of pci_get_class(). Since there is no pci_get_base_class(), we likely need to open-code the search, e.g. something like below.
Takashi
-- 8< -- From: Takashi Iwai tiwai@suse.de Subject: [PATCH] ALSA: hda: Fix discovery of i915 graphics PCI device
It's been reported that the recent fix for skipping the component-binding with D-GPU caused a regression on some systems; it resulted in the completely missing component binding with i915 GPU.
The problem was the use of pci_get_class() function. It matches with the full PCI class bits, while we want to match only partially the PCI base class bits. So, when a system has an i915 graphics device with the PCI class 0380, it won't hit because we're looking for only the PCI class 0300.
This patch fixes i915_gfx_present() to look up each PCI device and match with PCI base class explicitly instead of pci_get_class().
Fixes: c9db8a30d9f0 ("ALSA: hda/i915 - skip acomp init if no matching display") Link: https://bugzilla.opensuse.org/show_bug.cgi?id=1200611 Cc: stable@vger.kernel.org Signed-off-by: Takashi Iwai tiwai@suse.de --- sound/hda/hdac_i915.c | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-)
diff --git a/sound/hda/hdac_i915.c b/sound/hda/hdac_i915.c index 3f35972e1cf7..161a9711cd63 100644 --- a/sound/hda/hdac_i915.c +++ b/sound/hda/hdac_i915.c @@ -119,21 +119,18 @@ static int i915_component_master_match(struct device *dev, int subcomponent, /* check whether Intel graphics is present and reachable */ static int i915_gfx_present(struct pci_dev *hdac_pci) { - unsigned int class = PCI_BASE_CLASS_DISPLAY << 16; struct pci_dev *display_dev = NULL; - bool match = false;
- do { - display_dev = pci_get_class(class, display_dev); - - if (display_dev && display_dev->vendor == PCI_VENDOR_ID_INTEL && + for_each_pci_dev(display_dev) { + if (display_dev->vendor == PCI_VENDOR_ID_INTEL && + (display_dev->class >> 16) == PCI_BASE_CLASS_DISPLAY && connectivity_check(display_dev, hdac_pci)) { pci_dev_put(display_dev); - match = true; + return true; } - } while (!match && display_dev); + }
- return match; + return false; }
/**