[SRU] [B/D/Unstable/OEM-B/OEM-OSP1-B] [PATCH 0/1] Unhide Nvidia HDA audio controller

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

[SRU] [B/D/Unstable/OEM-B/OEM-OSP1-B] [PATCH 0/1] Unhide Nvidia HDA audio controller

Kai-Heng Feng
BugLink: https://bugs.launchpad.net/bugs/1836308

[Impact]
Nvidia HDA audio controller comes with Nvidia graphics cannot be found
by PCI subsystem.

[Fix]
Write bit 25 at graphics' config space offset 0x488 to enable the HDA
controller.

[Test]
Nvidia HDA controller is not listed under lspci.
After applying the fix lspci can find Nvidia HDA controller.

[Regression Potential]
Low. This fix doesn't bring any functional change other then exposing
HDA controller at hardware level.

Lukas Wunner (1):
  PCI: Enable NVIDIA HDA controllers

 drivers/pci/quirks.c    | 30 ++++++++++++++++++++++++++++++
 include/linux/pci_ids.h |  1 +
 2 files changed, 31 insertions(+)

--
2.17.1


--
kernel-team mailing list
[hidden email]
https://lists.ubuntu.com/mailman/listinfo/kernel-team
Reply | Threaded
Open this post in threaded view
|

[B/OEM-B] [PATCH 1/1] PCI: Enable NVIDIA HDA controllers

Kai-Heng Feng
From: Lukas Wunner <[hidden email]>

BugLink: https://bugs.launchpad.net/bugs/1836308

Many NVIDIA GPUs can be configured as either a single-function video device
or a multi-function device with video at function 0 and an HDA audio
controller at function 1.  The HDA controller can be enabled or disabled by
a bit in the function 0 config space.

Some BIOSes leave the HDA disabled, which means the HDMI connector from the
NVIDIA GPU may not work.  Sometimes the BIOS enables the HDA if an HDMI
cable is connected at boot time, but that doesn't handle hotplug cases.

Enable the HDA controller on device enumeration and resume and re-read the
header type, which tells us whether the GPU is a multi-function device.

This quirk is limited to NVIDIA PCI devices with the VGA Controller device
class.  This is expected to correspond to product configurations where the
NVIDIA GPU has connectors attached.  Other products where the device class
is 3D Controller are expected to correspond to configurations where the
NVIDIA GPU is dedicated (dGPU) and has no connectors.  See original post
(URL below) for more details.

This commit takes inspiration from an earlier patch by Daniel Drake.

Link: https://lore.kernel.org/r/20190708051744.24039-1-drake@...
Link: https://devtalk.nvidia.com/default/topic/1024022
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=75985
Signed-off-by: Lukas Wunner <[hidden email]>
Signed-off-by: Daniel Drake <[hidden email]>
[bhelgaas: commit log, log message, return early if already enabled]
Signed-off-by: Bjorn Helgaas <[hidden email]>
Cc: Aaron Plattner <[hidden email]>
Cc: Peter Wu <[hidden email]>
Cc: Ilia Mirkin <[hidden email]>
Cc: Karol Herbst <[hidden email]>
Cc: Maik Freudenberg <[hidden email]>
(backported from commit b678f90a1a6f8899542ea7bb190e268fb2d6ea0d git://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci.git pci/misc)
Signed-off-by: Kai-Heng Feng <[hidden email]>
---
 drivers/pci/quirks.c    | 30 ++++++++++++++++++++++++++++++
 include/linux/pci_ids.h |  1 +
 2 files changed, 31 insertions(+)

diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c
index 0c5c1915b408..4c5ada1d43bf 100644
--- a/drivers/pci/quirks.c
+++ b/drivers/pci/quirks.c
@@ -4896,3 +4896,33 @@ static void quirk_fsl_no_msi(struct pci_dev *pdev)
  pdev->no_msi = 1;
 }
 DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_FREESCALE, PCI_ANY_ID, quirk_fsl_no_msi);
+
+/*
+ * Enable the NVIDIA GPU integrated HDA controller if the BIOS left it
+ * disabled.  https://devtalk.nvidia.com/default/topic/1024022
+ */
+static void quirk_nvidia_hda(struct pci_dev *gpu)
+{
+ u8 hdr_type;
+ u32 val;
+
+ /* There was no integrated HDA controller before MCP89 */
+ if (gpu->device < PCI_DEVICE_ID_NVIDIA_GEFORCE_320M)
+ return;
+
+ /* Bit 25 at offset 0x488 enables the HDA controller */
+ pci_read_config_dword(gpu, 0x488, &val);
+ if (val & BIT(25))
+ return;
+
+ pci_info(gpu, "Enabling HDA controller\n");
+ pci_write_config_dword(gpu, 0x488, val | BIT(25));
+
+ /* The GPU becomes a multi-function device when the HDA is enabled */
+ pci_read_config_byte(gpu, PCI_HEADER_TYPE, &hdr_type);
+ gpu->multifunction = !!(hdr_type & 0x80);
+}
+DECLARE_PCI_FIXUP_CLASS_HEADER(PCI_VENDOR_ID_NVIDIA, PCI_ANY_ID,
+       PCI_BASE_CLASS_DISPLAY, 16, quirk_nvidia_hda);
+DECLARE_PCI_FIXUP_CLASS_RESUME_EARLY(PCI_VENDOR_ID_NVIDIA, PCI_ANY_ID,
+       PCI_BASE_CLASS_DISPLAY, 16, quirk_nvidia_hda);
diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h
index 0a6cfa98dfc1..5d8a3aa846c3 100644
--- a/include/linux/pci_ids.h
+++ b/include/linux/pci_ids.h
@@ -1327,6 +1327,7 @@
 #define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP78S_SMBUS    0x0752
 #define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP77_IDE       0x0759
 #define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP73_SMBUS     0x07D8
+#define PCI_DEVICE_ID_NVIDIA_GEFORCE_320M           0x08A0
 #define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP79_SMBUS     0x0AA2
 #define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP89_SATA    0x0D85
 
--
2.17.1


--
kernel-team mailing list
[hidden email]
https://lists.ubuntu.com/mailman/listinfo/kernel-team
Reply | Threaded
Open this post in threaded view
|

[D/Unstable/OEM-OSP1-B] [PATCH 1/1] PCI: Enable NVIDIA HDA controllers

Kai-Heng Feng
In reply to this post by Kai-Heng Feng
From: Lukas Wunner <[hidden email]>

BugLink: https://bugs.launchpad.net/bugs/1836308

Many NVIDIA GPUs can be configured as either a single-function video device
or a multi-function device with video at function 0 and an HDA audio
controller at function 1.  The HDA controller can be enabled or disabled by
a bit in the function 0 config space.

Some BIOSes leave the HDA disabled, which means the HDMI connector from the
NVIDIA GPU may not work.  Sometimes the BIOS enables the HDA if an HDMI
cable is connected at boot time, but that doesn't handle hotplug cases.

Enable the HDA controller on device enumeration and resume and re-read the
header type, which tells us whether the GPU is a multi-function device.

This quirk is limited to NVIDIA PCI devices with the VGA Controller device
class.  This is expected to correspond to product configurations where the
NVIDIA GPU has connectors attached.  Other products where the device class
is 3D Controller are expected to correspond to configurations where the
NVIDIA GPU is dedicated (dGPU) and has no connectors.  See original post
(URL below) for more details.

This commit takes inspiration from an earlier patch by Daniel Drake.

Link: https://lore.kernel.org/r/20190708051744.24039-1-drake@...
Link: https://devtalk.nvidia.com/default/topic/1024022
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=75985
Signed-off-by: Lukas Wunner <[hidden email]>
Signed-off-by: Daniel Drake <[hidden email]>
[bhelgaas: commit log, log message, return early if already enabled]
Signed-off-by: Bjorn Helgaas <[hidden email]>
Cc: Aaron Plattner <[hidden email]>
Cc: Peter Wu <[hidden email]>
Cc: Ilia Mirkin <[hidden email]>
Cc: Karol Herbst <[hidden email]>
Cc: Maik Freudenberg <[hidden email]>
(backported from commit b678f90a1a6f8899542ea7bb190e268fb2d6ea0d git://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci.git pci/misc)
Signed-off-by: Kai-Heng Feng <[hidden email]>
---
 drivers/pci/quirks.c    | 30 ++++++++++++++++++++++++++++++
 include/linux/pci_ids.h |  1 +
 2 files changed, 31 insertions(+)

diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c
index da6ce46ce3f0..6140de200ae6 100644
--- a/drivers/pci/quirks.c
+++ b/drivers/pci/quirks.c
@@ -5010,6 +5010,36 @@ DECLARE_PCI_FIXUP_CLASS_FINAL(PCI_VENDOR_ID_AMD, PCI_ANY_ID,
 DECLARE_PCI_FIXUP_CLASS_FINAL(PCI_VENDOR_ID_NVIDIA, PCI_ANY_ID,
       PCI_CLASS_MULTIMEDIA_HD_AUDIO, 8, quirk_gpu_hda);
 
+/*
+ * Enable the NVIDIA GPU integrated HDA controller if the BIOS left it
+ * disabled.  https://devtalk.nvidia.com/default/topic/1024022
+ */
+static void quirk_nvidia_hda(struct pci_dev *gpu)
+{
+ u8 hdr_type;
+ u32 val;
+
+ /* There was no integrated HDA controller before MCP89 */
+ if (gpu->device < PCI_DEVICE_ID_NVIDIA_GEFORCE_320M)
+ return;
+
+ /* Bit 25 at offset 0x488 enables the HDA controller */
+ pci_read_config_dword(gpu, 0x488, &val);
+ if (val & BIT(25))
+ return;
+
+ pci_info(gpu, "Enabling HDA controller\n");
+ pci_write_config_dword(gpu, 0x488, val | BIT(25));
+
+ /* The GPU becomes a multi-function device when the HDA is enabled */
+ pci_read_config_byte(gpu, PCI_HEADER_TYPE, &hdr_type);
+ gpu->multifunction = !!(hdr_type & 0x80);
+}
+DECLARE_PCI_FIXUP_CLASS_HEADER(PCI_VENDOR_ID_NVIDIA, PCI_ANY_ID,
+       PCI_BASE_CLASS_DISPLAY, 16, quirk_nvidia_hda);
+DECLARE_PCI_FIXUP_CLASS_RESUME_EARLY(PCI_VENDOR_ID_NVIDIA, PCI_ANY_ID,
+       PCI_BASE_CLASS_DISPLAY, 16, quirk_nvidia_hda);
+
 /*
  * Some IDT switches incorrectly flag an ACS Source Validation error on
  * completions for config read requests even though PCIe r4.0, sec
diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h
index 44e07bd7e7ee..d88bf2eabdb9 100644
--- a/include/linux/pci_ids.h
+++ b/include/linux/pci_ids.h
@@ -1336,6 +1336,7 @@
 #define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP78S_SMBUS    0x0752
 #define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP77_IDE       0x0759
 #define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP73_SMBUS     0x07D8
+#define PCI_DEVICE_ID_NVIDIA_GEFORCE_320M           0x08A0
 #define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP79_SMBUS     0x0AA2
 #define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP89_SATA    0x0D85
 
--
2.17.1


--
kernel-team mailing list
[hidden email]
https://lists.ubuntu.com/mailman/listinfo/kernel-team
Reply | Threaded
Open this post in threaded view
|

Re: [SRU] [B/D/Unstable/OEM-B/OEM-OSP1-B] [PATCH 0/1] Unhide Nvidia HDA audio controller

Timo Aaltonen-6
In reply to this post by Kai-Heng Feng
On 12.7.2019 9.34, Kai-Heng Feng wrote:
> BugLink: https://bugs.launchpad.net/bugs/1836308
>
> [Impact]
> Nvidia HDA audio controller comes with Nvidia graphics cannot be found
> by PCI subsystem.
>
> [Fix]
> Write bit 25 at graphics' config space offset 0x488 to enable the HDA
> controller.

applied to osp1 oem-next, thanks


--
t

--
kernel-team mailing list
[hidden email]
https://lists.ubuntu.com/mailman/listinfo/kernel-team
Reply | Threaded
Open this post in threaded view
|

APPLIED[OEM-OSP1-B] Re: [SRU] [B/D/Unstable/OEM-B/OEM-OSP1-B] [PATCH 0/1] Unhide Nvidia HDA audio controller

Timo Aaltonen-6
On 12.7.2019 10.26, Timo Aaltonen wrote:

> On 12.7.2019 9.34, Kai-Heng Feng wrote:
>> BugLink: https://bugs.launchpad.net/bugs/1836308
>>
>> [Impact]
>> Nvidia HDA audio controller comes with Nvidia graphics cannot be found
>> by PCI subsystem.
>>
>> [Fix]
>> Write bit 25 at graphics' config space offset 0x488 to enable the HDA
>> controller.
>
> applied to osp1 oem-next, thanks
>
>


--
t

--
kernel-team mailing list
[hidden email]
https://lists.ubuntu.com/mailman/listinfo/kernel-team
Reply | Threaded
Open this post in threaded view
|

ACK / APPLIED[E]: [SRU] [B/D/Unstable/OEM-B/OEM-OSP1-B] [PATCH 0/1] Unhide Nvidia HDA audio controller

Seth Forshee
In reply to this post by Kai-Heng Feng
On Fri, Jul 12, 2019 at 02:34:29PM +0800, Kai-Heng Feng wrote:

> BugLink: https://bugs.launchpad.net/bugs/1836308
>
> [Impact]
> Nvidia HDA audio controller comes with Nvidia graphics cannot be found
> by PCI subsystem.
>
> [Fix]
> Write bit 25 at graphics' config space offset 0x488 to enable the HDA
> controller.
>
> [Test]
> Nvidia HDA controller is not listed under lspci.
> After applying the fix lspci can find Nvidia HDA controller.
>
> [Regression Potential]
> Low. This fix doesn't bring any functional change other then exposing
> HDA controller at hardware level.

Scope limited to specific hardware, making its way upstream.

Acked-by: Seth Forshee <[hidden email]>

Applied to eoan/master-next, thanks!

--
kernel-team mailing list
[hidden email]
https://lists.ubuntu.com/mailman/listinfo/kernel-team
Reply | Threaded
Open this post in threaded view
|

ACK/Cmnt: [SRU] [B/D/Unstable/OEM-B/OEM-OSP1-B] [PATCH 0/1] Unhide Nvidia HDA audio controller

Stefan Bader-2
In reply to this post by Kai-Heng Feng
On 12.07.19 08:34, Kai-Heng Feng wrote:

> BugLink: https://bugs.launchpad.net/bugs/1836308
>
> [Impact]
> Nvidia HDA audio controller comes with Nvidia graphics cannot be found
> by PCI subsystem.
>
> [Fix]
> Write bit 25 at graphics' config space offset 0x488 to enable the HDA
> controller.
>
> [Test]
> Nvidia HDA controller is not listed under lspci.
> After applying the fix lspci can find Nvidia HDA controller.
>
> [Regression Potential]
> Low. This fix doesn't bring any functional change other then exposing
> HDA controller at hardware level.
Not sure I fully concur. The change causes a write to pci config space based on
vendor being NVidia and the device id being higher that some number. This
assumes that the ids were always used sanely and none of the things out there
acting odd if that bit is poked. It probably is rare but I am prepared to expect
the unexpected. :)

-Stefan
>
> Lukas Wunner (1):
>   PCI: Enable NVIDIA HDA controllers
>
>  drivers/pci/quirks.c    | 30 ++++++++++++++++++++++++++++++
>  include/linux/pci_ids.h |  1 +
>  2 files changed, 31 insertions(+)
>
Acked-by: Stefan Bader <[hidden email]>


--
kernel-team mailing list
[hidden email]
https://lists.ubuntu.com/mailman/listinfo/kernel-team

signature.asc (849 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

APPLIED(B,D): [SRU] [B/D/Unstable/OEM-B/OEM-OSP1-B] [PATCH 0/1] Unhide Nvidia HDA audio controller

Khaled Elmously
In reply to this post by Kai-Heng Feng
On 2019-07-12 14:34:29 , Kai-Heng Feng wrote:

> BugLink: https://bugs.launchpad.net/bugs/1836308
>
> [Impact]
> Nvidia HDA audio controller comes with Nvidia graphics cannot be found
> by PCI subsystem.
>
> [Fix]
> Write bit 25 at graphics' config space offset 0x488 to enable the HDA
> controller.
>
> [Test]
> Nvidia HDA controller is not listed under lspci.
> After applying the fix lspci can find Nvidia HDA controller.
>
> [Regression Potential]
> Low. This fix doesn't bring any functional change other then exposing
> HDA controller at hardware level.
>
> Lukas Wunner (1):
>   PCI: Enable NVIDIA HDA controllers
>
>  drivers/pci/quirks.c    | 30 ++++++++++++++++++++++++++++++
>  include/linux/pci_ids.h |  1 +
>  2 files changed, 31 insertions(+)
>
> --
> 2.17.1
>
>
> --
> kernel-team mailing list
> [hidden email]
> https://lists.ubuntu.com/mailman/listinfo/kernel-team

--
kernel-team mailing list
[hidden email]
https://lists.ubuntu.com/mailman/listinfo/kernel-team