Skip to contentSkip to conversation

ALSA: hda: intel: Switch to pci_alloc_irq_vectors API

PATCH Applied Heiner Kallweit 3 participants 4 messages Oct 31, 2024 – Nov 4, 2024

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

PATCH 1/1 ALSA: hda: intel: Switch to pci_alloc_irq_vectors API

Switch from legacy pci_msi_enable()/pci_intx() API to the pci_alloc_irq_vectors API.

---
 sound/pci/hda/hda_intel.c | 21 ++++++++++++---------
 1 file changed, 12 insertions(+), 9 deletions(-)
sound/pci/hda/hda_intel.c +12 -9
index 9fc5e6c5d..fc329b6a7 100644
@@ -773,6 +773,14 @@ static void azx_clear_irq_pending(struct azx *chip)
 static int azx_acquire_irq(struct azx *chip, int do_disconnect)
 {
 	struct hdac_bus *bus = azx_bus(chip);
+	int ret;
+
+	if (!chip->msi || pci_alloc_irq_vectors(chip->pci, 1, 1, PCI_IRQ_MSI) < 0) {
+		ret = pci_alloc_irq_vectors(chip->pci, 1, 1, PCI_IRQ_INTX);
+		if (ret < 0)
+			return ret;
+		chip->msi = 0;
+	}
 
 	if (request_irq(chip->pci->irq, azx_interrupt,
 			chip->msi ? 0 : IRQF_SHARED,
@@ -786,7 +794,6 @@ static int azx_acquire_irq(struct azx *chip, int do_disconnect)
 	}
 	bus->irq = chip->pci->irq;
 	chip->card->sync_irq = bus->irq;
-	pci_intx(chip->pci, !chip->msi);
 	return 0;
 }
 
@@ -1879,13 +1886,9 @@ static int azx_first_init(struct azx *chip)
 		chip->gts_present = true;
 #endif
 
-	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 (chip->msi && chip->driver_caps & AZX_DCAPS_NO_MSI64) {
+		dev_dbg(card->dev, "Disabling 64bit MSI\n");
+		pci->no_64bit_msi = true;
 	}
 
 	pci_set_master(pci);
@@ -2037,7 +2040,7 @@ static int disable_msi_reset_irq(struct azx *chip)
 	free_irq(bus->irq, chip);
 	bus->irq = -1;
 	chip->card->sync_irq = -1;
-	pci_disable_msi(chip->pci);
+	pci_free_irq_vectors(chip->pci);
 	chip->msi = 0;
 	err = azx_acquire_irq(chip, 1);
 	if (err < 0)
Signature · 1 line
2.47.0
#1 lore raw
Quoted 5 lines · Heiner Kallweit

Switch from legacy pci_msi_enable()/pci_intx() API to the pci_alloc_irq_vectors API.

So, this change looks conflicting with the pcim_intx() cleanup patch set from Philipp. I think we can take this one and drop the corresponding one from Philipp's patch set.

Bjorn, Philipp, does it sound OK?

thanks,

Takashi

Quoted 60 lines
---
 sound/pci/hda/hda_intel.c | 21 ++++++++++++---------
 1 file changed, 12 insertions(+), 9 deletions(-)
sound/pci/hda/hda_intel.c +12 -9
index 9fc5e6c5d..fc329b6a7 100644
@@ -773,6 +773,14 @@ static void azx_clear_irq_pending(struct azx *chip)
 static int azx_acquire_irq(struct azx *chip, int do_disconnect)
 {
 	struct hdac_bus *bus = azx_bus(chip);
+	int ret;
+
+	if (!chip->msi || pci_alloc_irq_vectors(chip->pci, 1, 1, PCI_IRQ_MSI) < 0) {
+		ret = pci_alloc_irq_vectors(chip->pci, 1, 1, PCI_IRQ_INTX);
+		if (ret < 0)
+			return ret;
+		chip->msi = 0;
+	}
 
 	if (request_irq(chip->pci->irq, azx_interrupt,
 			chip->msi ? 0 : IRQF_SHARED,
@@ -786,7 +794,6 @@ static int azx_acquire_irq(struct azx *chip, int do_disconnect)
 	}
 	bus->irq = chip->pci->irq;
 	chip->card->sync_irq = bus->irq;
-	pci_intx(chip->pci, !chip->msi);
 	return 0;
 }
 
@@ -1879,13 +1886,9 @@ static int azx_first_init(struct azx *chip)
 		chip->gts_present = true;
 #endif
 
-	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 (chip->msi && chip->driver_caps & AZX_DCAPS_NO_MSI64) {
+		dev_dbg(card->dev, "Disabling 64bit MSI\n");
+		pci->no_64bit_msi = true;
 	}
 
 	pci_set_master(pci);
@@ -2037,7 +2040,7 @@ static int disable_msi_reset_irq(struct azx *chip)
 	free_irq(bus->irq, chip);
 	bus->irq = -1;
 	chip->card->sync_irq = -1;
-	pci_disable_msi(chip->pci);
+	pci_free_irq_vectors(chip->pci);
 	chip->msi = 0;
 	err = azx_acquire_irq(chip, 1);
 	if (err < 0)
Signature · 1 line
2.47.0
#2 lore raw
Quoted 6 lines · Takashi Iwai
Quoted 4 lines · Heiner Kallweit

Switch from legacy pci_msi_enable()/pci_intx() API to the pci_alloc_irq_vectors API.

Quoted 7 lines
Quoted 1 line

So, this change looks conflicting with the pcim_intx() cleanup patch set from Philipp.  I think we can take this one and drop the corresponding one from Philipp's patch set.

Bjorn, Philipp, does it sound OK?

Yes, that will be trivial to do. I'll just drop my hda_intel patch and that's it.

Thanks,
P.

Quoted 73 lines

thanks,

Takashi

Quoted 66 lines

---
 sound/pci/hda/hda_intel.c | 21 ++++++++++++---------

 1 file changed, 12 insertions(+), 9 deletions(-)
sound/pci/hda/hda_intel.c +8 -0
index 9fc5e6c5d..fc329b6a7 100644
@@ -773,6 +773,14 @@ static void azx_clear_irq_pending(struct azx
 *chip)
  static int azx_acquire_irq(struct azx *chip, int do_disconnect)
  {
  	struct hdac_bus *bus = azx_bus(chip);
+	int ret;
+
+	if (!chip->msi || pci_alloc_irq_vectors(chip->pci, 1, 1,
 PCI_IRQ_MSI) < 0) {
+		ret = pci_alloc_irq_vectors(chip->pci, 1, 1,
 PCI_IRQ_INTX);
+		if (ret < 0)
+			return ret;
+		chip->msi = 0;
+	}


  if (request_irq(chip->pci->irq, azx_interrupt, chip->msi ? 0 : IRQF_SHARED,

sound/pci/hda/hda_intel.c +0 -1
@@ -786,7 +794,6 @@ static int azx_acquire_irq(struct azx *chip,
 int do_disconnect)
  	}
  	bus->irq = chip->pci->irq;
  	chip->card->sync_irq = bus->irq;
-	pci_intx(chip->pci, !chip->msi);
  	return 0;
  }

sound/pci/hda/hda_intel.c +0 -0
@@ -1879,13 +1886,9 @@ static int azx_first_init(struct azx *chip)
  		chip->gts_present = true;
  #endif

sound/pci/hda/hda_intel.c +0 -3
-	if (chip->msi) {
-		if (chip->driver_caps & AZX_DCAPS_NO_MSI64) {
-			dev_dbg(card->dev, "Disabling 64bit

MSI\n");

sound/pci/hda/hda_intel.c +3 -4
-			pci->no_64bit_msi = true;
-		}
-		if (pci_enable_msi(pci) < 0)
-			chip->msi = 0;
+	if (chip->msi && chip->driver_caps & AZX_DCAPS_NO_MSI64) {
+		dev_dbg(card->dev, "Disabling 64bit MSI\n");
+		pci->no_64bit_msi = true;

  }

  pci_set_master(pci);

sound/pci/hda/hda_intel.c +1 -1
@@ -2037,7 +2040,7 @@ static int disable_msi_reset_irq(struct azx
 *chip)
  	free_irq(bus->irq, chip);
  	bus->irq = -1;
  	chip->card->sync_irq = -1;
-	pci_disable_msi(chip->pci);
+	pci_free_irq_vectors(chip->pci);
  	chip->msi = 0;
  	err = azx_acquire_irq(chip, 1);

  if (err < 0)

Signature · 1 line
2.47.0