Skip to contentSkip to conversation

sound/radeon: Move 64-bit MSI quirk from arch to driver

PATCH In review Benjamin Herrenschmidt 4 participants 7 messages Oct 2, 2014 – Oct 3, 2014

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH v2 3/4 sound/radeon: Move 64-bit MSI quirk from arch to driver

A number of radeon cards have a HW limitation causing them to be unable to generate the full 64-bit of address bits for MSIs. This breaks MSIs on some platforms such as POWER machines.

We used to have a powerpc specific quirk to address that on a single card, but this doesn't scale very well, this is better put under control of the drivers who know precisely what a given HW revision can do.

This moves the setting of the quirk flag to the audio driver.

While recent ASICs have that problem fixed, they don't seem to be listed in the PCI IDs of the current driver, so let's quirk all the ATI HDMI for now. The consequences are nil on x86 anyway.

---
 arch/powerpc/kernel/pci_64.c |  6 ------
 sound/pci/hda/hda_intel.c    | 10 ++++++++--
 sound/pci/hda/hda_priv.h     |  1 +
 3 files changed, 9 insertions(+), 8 deletions(-)
arch/powerpc/kernel/pci_64.c +0 -6
index 5330f6d..b15194e 100644
@@ -266,9 +266,3 @@ int pcibus_to_node(struct pci_bus *bus)
 }
 EXPORT_SYMBOL(pcibus_to_node);
 #endif
-
-static void quirk_radeon_32bit_msi(struct pci_dev *dev)
-{
-	dev->no_64bit_msi = true;
-}
-DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ATI, 0xaa68, quirk_radeon_32bit_msi);
sound/pci/hda/hda_intel.c +8 -2
index aa302fb..f91ba7f 100644
@@ -296,7 +296,8 @@ enum {
 
 /* quirks for ATI/AMD HDMI */
 #define AZX_DCAPS_PRESET_ATI_HDMI \
-	(AZX_DCAPS_NO_TCSEL | AZX_DCAPS_SYNC_WRITE | AZX_DCAPS_POSFIX_LPIB)
+	(AZX_DCAPS_NO_TCSEL | AZX_DCAPS_SYNC_WRITE | AZX_DCAPS_POSFIX_LPIB|\
+	 AZX_DCAPS_NO_MSI64)
 
 /* quirks for Nvidia */
 #define AZX_DCAPS_PRESET_NVIDIA \
@@ -1505,9 +1506,14 @@ static int azx_first_init(struct azx *chip)
 		return -ENXIO;
 	}
 
-	if (chip->msi)
+	if (chip->msi) {
+		if (chip->driver_caps & AZX_DCAPS_NO_MSI64) {
+			dev_dbg(card->dev, "Disabling 64bit MSI\n");
+			pci->no_64bit_msi = true;
+		}
 		if (pci_enable_msi(pci) < 0)
 			chip->msi = 0;
+	}
 
 	if (azx_acquire_irq(chip, 0) < 0)
 		return -EBUSY;
sound/pci/hda/hda_priv.h +1 -0
index 949cd43..5016014 100644
@@ -171,6 +171,7 @@ enum { SDI0, SDI1, SDI2, SDI3, SDO0, SDO1, SDO2, SDO3 };
 #define AZX_DCAPS_PM_RUNTIME	(1 << 26)	/* runtime PM support */
 #define AZX_DCAPS_I915_POWERWELL (1 << 27)	/* HSW i915 powerwell support */
 #define AZX_DCAPS_CORBRP_SELF_CLEAR (1 << 28)	/* CORBRP clears itself after reset */
+#define AZX_DCAPS_NO_MSI64      (1 << 29)	/* Stick to 32-bit MSIs */
 
 /* HD Audio class code */
 #define PCI_CLASS_MULTIMEDIA_HD_AUDIO	0x0403
#1 lore raw

Hi Ben,

Quoted 16 lines · On Thu, 02 Oct 2014 10:34:42 +1000 Benjamin Herrenschmidt…
sound/pci/hda/hda_intel.c +2 -1
index aa302fb..f91ba7f 100644
@@ -296,7 +296,8 @@ enum {
 
 /* quirks for ATI/AMD HDMI */
 #define AZX_DCAPS_PRESET_ATI_HDMI \
-	(AZX_DCAPS_NO_TCSEL | AZX_DCAPS_SYNC_WRITE | AZX_DCAPS_POSFIX_LPIB)
+	(AZX_DCAPS_NO_TCSEL | AZX_DCAPS_SYNC_WRITE | AZX_DCAPS_POSFIX_LPIB|\
+	 AZX_DCAPS_NO_MSI64)
 
 /* quirks for Nvidia */
 #define AZX_DCAPS_PRESET_NVIDIA \

sound/pci/hda/hda_intel.c static int azx_first_init(struct azx *chip) · line 1512

Quoted 8 lines
sound/pci/hda/hda_intel.c +4 -1
@@ -1505,9 +1506,14 @@ static int azx_first_init(struct azx *chip)
 		return -ENXIO;
 	}
 
-	if (chip->msi)
+	if (chip->msi) {
+		if (chip->driver_caps & AZX_DCAPS_NO_MSI64) {
+			dev_dbg(card->dev, "Disabling 64bit MSI\n");
+			pci->no_64bit_msi = true;

You get the idea :-)

Signature · 2 lines
Cheers,
Stephen Rothwell                    [email protected]
#2 lore raw
In reply to Benjamin Herrenschmidt
Quoted 10 lines · Benjamin Herrenschmidt

A number of radeon cards have a HW limitation causing them to be unable to generate the full 64-bit of address bits for MSIs. This breaks MSIs on some platforms such as POWER machines.

We used to have a powerpc specific quirk to address that on a single card, but this doesn't scale very well, this is better put under control of the drivers who know precisely what a given HW revision can do.

Quoted 8 lines

This moves the setting of the quirk flag to the audio driver.

While recent ASICs have that problem fixed, they don't seem to be listed in the PCI IDs of the current driver, so let's quirk all the ATI HDMI for now. The consequences are nil on x86 anyway.

The attached updated patch only flags the affected asics.

Alex

Quoted 59 lines
---
 arch/powerpc/kernel/pci_64.c |  6 ------
 sound/pci/hda/hda_intel.c    | 10 ++++++++--
 sound/pci/hda/hda_priv.h     |  1 +
 3 files changed, 9 insertions(+), 8 deletions(-)
arch/powerpc/kernel/pci_64.c +0 -6
index 5330f6d..b15194e 100644
@@ -266,9 +266,3 @@ int pcibus_to_node(struct pci_bus *bus)
 }
 EXPORT_SYMBOL(pcibus_to_node);
 #endif
-
-static void quirk_radeon_32bit_msi(struct pci_dev *dev)
-{
-       dev->no_64bit_msi = true;
-}
-DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ATI, 0xaa68, quirk_radeon_32bit_msi);
sound/pci/hda/hda_intel.c +8 -2
index aa302fb..f91ba7f 100644
@@ -296,7 +296,8 @@ enum {
 
 /* quirks for ATI/AMD HDMI */
 #define AZX_DCAPS_PRESET_ATI_HDMI \
-       (AZX_DCAPS_NO_TCSEL | AZX_DCAPS_SYNC_WRITE | AZX_DCAPS_POSFIX_LPIB)
+       (AZX_DCAPS_NO_TCSEL | AZX_DCAPS_SYNC_WRITE | AZX_DCAPS_POSFIX_LPIB|\
+        AZX_DCAPS_NO_MSI64)
 
 /* quirks for Nvidia */
 #define AZX_DCAPS_PRESET_NVIDIA \
@@ -1505,9 +1506,14 @@ static int azx_first_init(struct azx *chip)
                return -ENXIO;
        }
 
-       if (chip->msi)
+       if (chip->msi) {
+               if (chip->driver_caps & AZX_DCAPS_NO_MSI64) {
+                       dev_dbg(card->dev, "Disabling 64bit MSI\n");
+                       pci->no_64bit_msi = true;
+               }
                if (pci_enable_msi(pci) < 0)
                        chip->msi = 0;
+       }
 
        if (azx_acquire_irq(chip, 0) < 0)
                return -EBUSY;
sound/pci/hda/hda_priv.h +0 -0
index 949cd43..5016014 100644

sound/pci/hda/hda_priv.h enum { SDI0, SDI1, SDI2, SDI3, SDO0, SDO1, SDO2, SDO3 }; · line 177

Quoted 7 lines
sound/pci/hda/hda_priv.h +1 -0
@@ -171,6 +171,7 @@ enum { SDI0, SDI1, SDI2, SDI3, SDO0, SDO1, SDO2, SDO3 };
 #define AZX_DCAPS_PM_RUNTIME   (1 << 26)       /* runtime PM support */
 #define AZX_DCAPS_I915_POWERWELL (1 << 27)     /* HSW i915 powerwell support */
 #define AZX_DCAPS_CORBRP_SELF_CLEAR (1 << 28)  /* CORBRP clears itself after reset */
+#define AZX_DCAPS_NO_MSI64      (1 << 29)      /* Stick to 32-bit MSIs */
 
 /* HD Audio class code */
 #define PCI_CLASS_MULTIMEDIA_HD_AUDIO  0x0403

From 412fce0929558602a43a41feab051c4cf73c7142 Mon Sep 17 00:00:00 2001
From: Benjamin Herrenschmidt <[email protected]>
Date: Thu, 2 Oct 2014 10:34:42 +1000
Subject: [PATCH] sound/radeon: Move 64-bit MSI quirk from arch to driver (v2)

A number of radeon cards have a HW limitation causing them to be unable to generate the full 64-bit of address bits for MSIs. This breaks MSIs on some platforms such as POWER machines.

We used to have a powerpc specific quirk to address that on a single card, but this doesn't scale very well, this is better put under control of the drivers who know precisely what a given HW revision can do.

This moves the setting of the quirk flag to the audio driver.

While recent ASICs have that problem fixed, they don't seem to be listed in the PCI IDs of the current driver, so let's quirk all the ATI HDMI for now. The consequences are nil on x86 anyway.

v2: Alex Deucher: only quirk the affected asics

---
 arch/powerpc/kernel/pci_64.c |  6 ---
 sound/pci/hda/hda_intel.c    | 96 +++++++++++++++++++++++++++++++-------------
 sound/pci/hda/hda_priv.h     |  1 +
 3 files changed, 69 insertions(+), 34 deletions(-)
arch/powerpc/kernel/pci_64.c +0 -6
index 5330f6d..b15194e 100644
@@ -266,9 +266,3 @@ int pcibus_to_node(struct pci_bus *bus)
 }
 EXPORT_SYMBOL(pcibus_to_node);
 #endif
-
-static void quirk_radeon_32bit_msi(struct pci_dev *dev)
-{
-	dev->no_64bit_msi = true;
-}
-DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ATI, 0xaa68, quirk_radeon_32bit_msi);
sound/pci/hda/hda_intel.c +68 -28

135 lines not on this page · raw message

sound/pci/hda/hda_priv.h +1 -0
index 949cd43..5016014 100644
@@ -171,6 +171,7 @@ enum { SDI0, SDI1, SDI2, SDI3, SDO0, SDO1, SDO2, SDO3 };
 #define AZX_DCAPS_PM_RUNTIME	(1 << 26)	/* runtime PM support */
 #define AZX_DCAPS_I915_POWERWELL (1 << 27)	/* HSW i915 powerwell support */
 #define AZX_DCAPS_CORBRP_SELF_CLEAR (1 << 28)	/* CORBRP clears itself after reset */
+#define AZX_DCAPS_NO_MSI64      (1 << 29)	/* Stick to 32-bit MSIs */
 
 /* HD Audio class code */
 #define PCI_CLASS_MULTIMEDIA_HD_AUDIO	0x0403
Signature · 1 line
1.8.3.1
Reviewed-by
#3 lore raw

At Wed, 1 Oct 2014 22:13:38 -0400,

Quoted 15 lines · Alex Deucher
Quoted 12 lines · Benjamin Herrenschmidt

A number of radeon cards have a HW limitation causing them to be unable to generate the full 64-bit of address bits for MSIs. This breaks MSIs on some platforms such as POWER machines.

We used to have a powerpc specific quirk to address that on a single card, but this doesn't scale very well, this is better put under control of the drivers who know precisely what a given HW revision can do.

This moves the setting of the quirk flag to the audio driver.

Quoted 8 lines
Quoted 6 lines

While recent ASICs have that problem fixed, they don't seem to be listed in the PCI IDs of the current driver, so let's quirk all the ATI HDMI for now. The consequences are nil on x86 anyway.

The attached updated patch only flags the affected asics.

Alex's patch looks more comprehensive. For either patch,

thanks,

Takashi

Quoted 69 lines

Alex

Quoted 66 lines
---
 arch/powerpc/kernel/pci_64.c |  6 ------
 sound/pci/hda/hda_intel.c    | 10 ++++++++--
 sound/pci/hda/hda_priv.h     |  1 +
 3 files changed, 9 insertions(+), 8 deletions(-)
arch/powerpc/kernel/pci_64.c +0 -6
index 5330f6d..b15194e 100644
@@ -266,9 +266,3 @@ int pcibus_to_node(struct pci_bus *bus)
 }
 EXPORT_SYMBOL(pcibus_to_node);
 #endif
-
-static void quirk_radeon_32bit_msi(struct pci_dev *dev)
-{
-       dev->no_64bit_msi = true;
-}
-DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ATI, 0xaa68, quirk_radeon_32bit_msi);
sound/pci/hda/hda_intel.c +8 -2
index aa302fb..f91ba7f 100644
@@ -296,7 +296,8 @@ enum {
 
 /* quirks for ATI/AMD HDMI */
 #define AZX_DCAPS_PRESET_ATI_HDMI \
-       (AZX_DCAPS_NO_TCSEL | AZX_DCAPS_SYNC_WRITE | AZX_DCAPS_POSFIX_LPIB)
+       (AZX_DCAPS_NO_TCSEL | AZX_DCAPS_SYNC_WRITE | AZX_DCAPS_POSFIX_LPIB|\
+        AZX_DCAPS_NO_MSI64)
 
 /* quirks for Nvidia */
 #define AZX_DCAPS_PRESET_NVIDIA \
@@ -1505,9 +1506,14 @@ static int azx_first_init(struct azx *chip)
                return -ENXIO;
        }
 
-       if (chip->msi)
+       if (chip->msi) {
+               if (chip->driver_caps & AZX_DCAPS_NO_MSI64) {
+                       dev_dbg(card->dev, "Disabling 64bit MSI\n");
+                       pci->no_64bit_msi = true;
+               }
                if (pci_enable_msi(pci) < 0)
                        chip->msi = 0;
+       }
 
        if (azx_acquire_irq(chip, 0) < 0)
                return -EBUSY;
sound/pci/hda/hda_priv.h +1 -0
index 949cd43..5016014 100644
@@ -171,6 +171,7 @@ enum { SDI0, SDI1, SDI2, SDI3, SDO0, SDO1, SDO2, SDO3 };
 #define AZX_DCAPS_PM_RUNTIME   (1 << 26)       /* runtime PM support */
 #define AZX_DCAPS_I915_POWERWELL (1 << 27)     /* HSW i915 powerwell support */
 #define AZX_DCAPS_CORBRP_SELF_CLEAR (1 << 28)  /* CORBRP clears itself after reset */
+#define AZX_DCAPS_NO_MSI64      (1 << 29)      /* Stick to 32-bit MSIs */
 
 /* HD Audio class code */
 #define PCI_CLASS_MULTIMEDIA_HD_AUDIO  0x0403
#4 lore raw
Quoted 5 lines · Takashi Iwai
Quoted 1 line

The attached updated patch only flags the affected asics.

Alex's patch looks more comprehensive. For either patch,

Absolutely. I'll give it a spin tomorrow to be 100% sure. From there, it will need the previous patch moving the quirk so I'm thinking of merging it via Bjorn or my tree unless objection...

Cheers,
Ben.

Quoted 74 lines

thanks,

Takashi

Quoted 69 lines

Alex

Quoted 66 lines
---
 arch/powerpc/kernel/pci_64.c |  6 ------
 sound/pci/hda/hda_intel.c    | 10 ++++++++--
 sound/pci/hda/hda_priv.h     |  1 +
 3 files changed, 9 insertions(+), 8 deletions(-)
arch/powerpc/kernel/pci_64.c +0 -6
index 5330f6d..b15194e 100644
@@ -266,9 +266,3 @@ int pcibus_to_node(struct pci_bus *bus)
 }
 EXPORT_SYMBOL(pcibus_to_node);
 #endif
-
-static void quirk_radeon_32bit_msi(struct pci_dev *dev)
-{
-       dev->no_64bit_msi = true;
-}
-DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ATI, 0xaa68, quirk_radeon_32bit_msi);
sound/pci/hda/hda_intel.c +8 -2
index aa302fb..f91ba7f 100644
@@ -296,7 +296,8 @@ enum {
 
 /* quirks for ATI/AMD HDMI */
 #define AZX_DCAPS_PRESET_ATI_HDMI \
-       (AZX_DCAPS_NO_TCSEL | AZX_DCAPS_SYNC_WRITE | AZX_DCAPS_POSFIX_LPIB)
+       (AZX_DCAPS_NO_TCSEL | AZX_DCAPS_SYNC_WRITE | AZX_DCAPS_POSFIX_LPIB|\
+        AZX_DCAPS_NO_MSI64)
 
 /* quirks for Nvidia */
 #define AZX_DCAPS_PRESET_NVIDIA \
@@ -1505,9 +1506,14 @@ static int azx_first_init(struct azx *chip)
                return -ENXIO;
        }
 
-       if (chip->msi)
+       if (chip->msi) {
+               if (chip->driver_caps & AZX_DCAPS_NO_MSI64) {
+                       dev_dbg(card->dev, "Disabling 64bit MSI\n");
+                       pci->no_64bit_msi = true;
+               }
                if (pci_enable_msi(pci) < 0)
                        chip->msi = 0;
+       }
 
        if (azx_acquire_irq(chip, 0) < 0)
                return -EBUSY;
sound/pci/hda/hda_priv.h +1 -0
index 949cd43..5016014 100644
@@ -171,6 +171,7 @@ enum { SDI0, SDI1, SDI2, SDI3, SDO0, SDO1, SDO2, SDO3 };
 #define AZX_DCAPS_PM_RUNTIME   (1 << 26)       /* runtime PM support */
 #define AZX_DCAPS_I915_POWERWELL (1 << 27)     /* HSW i915 powerwell support */
 #define AZX_DCAPS_CORBRP_SELF_CLEAR (1 << 28)  /* CORBRP clears itself after reset */
+#define AZX_DCAPS_NO_MSI64      (1 << 29)      /* Stick to 32-bit MSIs */
 
 /* HD Audio class code */
 #define PCI_CLASS_MULTIMEDIA_HD_AUDIO  0x0403
#5 lore raw
In reply to Alex Deucher
Quoted 1 line · Alex Deucher

The attached updated patch only flags the affected asics.

I need formal (email :-) permission to add your s-o-b (and From: while at it since you wrote most of it) for this patch. I'll then include it in my new series.

Cheers,
Ben.

#6 lore raw
Quoted 7 lines · Benjamin Herrenschmidt
Quoted 1 line · Alex Deucher

The attached updated patch only flags the affected asics.

I need formal (email :-) permission to add your s-o-b (and From: while at it since you wrote most of it) for this patch. I'll then include it in my new series.