Commit 672ff5e3 authored by Guennadi Liakhovetski's avatar Guennadi Liakhovetski Committed by Mark Brown

ASoC: SOF: Intel: hda: add a parameter to disable MSI

Enabling MSI on HDA can fail, in which case the legacy PCI IRQ mode
will be used. To make testing this mode easier add an "enable_msi"
module parameter, which is only enabled if debugging is enabled too.
Signed-off-by: default avatarGuennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
Signed-off-by: default avatarPierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20190722141402.7194-17-pierre-louis.bossart@linux.intel.comSigned-off-by: default avatarMark Brown <broonie@kernel.org>
parent dc7a36f1
...@@ -46,6 +46,12 @@ struct hda_dsp_msg_code { ...@@ -46,6 +46,12 @@ struct hda_dsp_msg_code {
const char *msg; const char *msg;
}; };
static bool hda_use_msi = IS_ENABLED(CONFIG_PCI);
#if IS_ENABLED(CONFIG_SND_SOC_SOF_DEBUG)
module_param_named(use_msi, hda_use_msi, bool, 0444);
MODULE_PARM_DESC(use_msi, "SOF HDA use PCI MSI mode");
#endif
static const struct hda_dsp_msg_code hda_dsp_rom_msg[] = { static const struct hda_dsp_msg_code hda_dsp_rom_msg[] = {
{HDA_DSP_ROM_FW_MANIFEST_LOADED, "status: manifest loaded"}, {HDA_DSP_ROM_FW_MANIFEST_LOADED, "status: manifest loaded"},
{HDA_DSP_ROM_FW_FW_LOADED, "status: fw loaded"}, {HDA_DSP_ROM_FW_FW_LOADED, "status: fw loaded"},
...@@ -529,11 +535,18 @@ int hda_dsp_probe(struct snd_sof_dev *sdev) ...@@ -529,11 +535,18 @@ int hda_dsp_probe(struct snd_sof_dev *sdev)
* register our IRQ * register our IRQ
* let's try to enable msi firstly * let's try to enable msi firstly
* if it fails, use legacy interrupt mode * if it fails, use legacy interrupt mode
* TODO: support interrupt mode selection with kernel parameter * TODO: support msi multiple vectors
* support msi multiple vectors
*/ */
ret = pci_alloc_irq_vectors(pci, 1, 1, PCI_IRQ_MSI); if (hda_use_msi && !pci_alloc_irq_vectors(pci, 1, 1, PCI_IRQ_MSI)) {
if (ret < 0) { dev_info(sdev->dev, "use msi interrupt mode\n");
hdev->irq = pci_irq_vector(pci, 0);
/* ipc irq number is the same of hda irq */
sdev->ipc_irq = hdev->irq;
/* initialised to "false" by kzalloc() */
sdev->msi_enabled = true;
}
if (!sdev->msi_enabled) {
dev_info(sdev->dev, "use legacy interrupt mode\n"); dev_info(sdev->dev, "use legacy interrupt mode\n");
/* /*
* in IO-APIC mode, hda->irq and ipc_irq are using the same * in IO-APIC mode, hda->irq and ipc_irq are using the same
...@@ -541,13 +554,6 @@ int hda_dsp_probe(struct snd_sof_dev *sdev) ...@@ -541,13 +554,6 @@ int hda_dsp_probe(struct snd_sof_dev *sdev)
*/ */
hdev->irq = pci->irq; hdev->irq = pci->irq;
sdev->ipc_irq = pci->irq; sdev->ipc_irq = pci->irq;
sdev->msi_enabled = 0;
} else {
dev_info(sdev->dev, "use msi interrupt mode\n");
hdev->irq = pci_irq_vector(pci, 0);
/* ipc irq number is the same of hda irq */
sdev->ipc_irq = hdev->irq;
sdev->msi_enabled = 1;
} }
dev_dbg(sdev->dev, "using HDA IRQ %d\n", hdev->irq); dev_dbg(sdev->dev, "using HDA IRQ %d\n", hdev->irq);
......
...@@ -435,7 +435,7 @@ struct snd_sof_dev { ...@@ -435,7 +435,7 @@ struct snd_sof_dev {
u32 dtrace_error; u32 dtrace_error;
u32 dtrace_draining; u32 dtrace_draining;
u32 msi_enabled; bool msi_enabled;
void *private; /* core does not touch this */ void *private; /* core does not touch this */
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment