Commit
2a31b5378c6db9c4a8d399e5d10d32cd4b732bef
ASoC: amd: yc: disable MSI on resume
BIOS/firmware may re-enable MSI in PCI config space during system
resume even though this driver only uses legacy INTx interrupts. If MSI
is left enabled with stale address and data registers, the device can
write interrupts to a bogus address and cause an IOMMU IO_PAGE_FAULT.
Clear the MSI Enable bit before reinitializing ACP hardware on system
resume. Keep runtime resume separate because firmware does not restore
PCI configuration on that path.
Fixes: c8212df7bc0f ("ASoC: amd: add acp6x pci driver pm ops")
Reported-by: Marek Borůvka <boruvka.marek@gmail.com>
Closes: https://bugzilla.kernel.org/show_bug.cgi?id=222119
Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
Link: https://patch.msgid.link/20261013125425.3541206-1-mario.limonciello@amd.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Mario Limonciello <mario.limonciello@amd.com> · 2026-10-13 12:54 UTC · committed by Mark Brown
1 file changed,
+36
−2
modified sound/soc/amd/yc/pci-acp6x.c
| @@ -301,7 +301,7 @@ static int snd_acp6x_suspend(struct device *dev) | |||
| 301 | 301 | return ret; | |
| 302 | 302 | } | |
| 303 | 303 | ||
| 304 | - | static int snd_acp6x_resume(struct device *dev) | |
| 304 | + | static int snd_acp6x_runtime_resume(struct device *dev) | |
| 305 | 305 | { | |
| 306 | 306 | struct acp6x_dev_data *adata; | |
| 307 | 307 | int ret; | |
| @@ -313,8 +313,42 @@ static int snd_acp6x_resume(struct device *dev) | |||
| 313 | 313 | return ret; | |
| 314 | 314 | } | |
| 315 | 315 | ||
| 316 | + | static void acp6x_disable_msi_on_resume(struct pci_dev *pdev) | |
| 317 | + | { | |
| 318 | + | u16 control; | |
| 319 | + | ||
| 320 | + | if (!pdev->msi_cap) | |
| 321 | + | return; | |
| 322 | + | ||
| 323 | + | pci_read_config_word(pdev, pdev->msi_cap + PCI_MSI_FLAGS, &control); | |
| 324 | + | if (control & PCI_MSI_FLAGS_ENABLE) { | |
| 325 | + | dev_warn(&pdev->dev, | |
| 326 | + | "ACP: MSI unexpectedly enabled after resume (flags=0x%04x), disabling\n", | |
| 327 | + | control); | |
| 328 | + | control &= ~PCI_MSI_FLAGS_ENABLE; | |
| 329 | + | pci_write_config_word(pdev, pdev->msi_cap + PCI_MSI_FLAGS, control); | |
| 330 | + | } | |
| 331 | + | } | |
| 332 | + | ||
| 333 | + | static int snd_acp6x_resume(struct device *dev) | |
| 334 | + | { | |
| 335 | + | struct pci_dev *pdev = to_pci_dev(dev); | |
| 336 | + | ||
| 337 | + | /* | |
| 338 | + | * BIOS/firmware may re-enable MSI in PCI config space during | |
| 339 | + | * system resume even though this driver only uses legacy INTx | |
| 340 | + | * interrupts. If MSI is left enabled with stale address/data | |
| 341 | + | * registers, the device will write interrupts to a bogus address | |
| 342 | + | * causing IOMMU IO_PAGE_FAULT and interrupt delivery failure. | |
| 343 | + | * Explicitly clear the MSI Enable bit before reinitializing | |
| 344 | + | * the ACP hardware. | |
| 345 | + | */ | |
| 346 | + | acp6x_disable_msi_on_resume(pdev); | |
| 347 | + | return snd_acp6x_runtime_resume(dev); | |
| 348 | + | } | |
| 349 | + | ||
| 316 | 350 | static const struct dev_pm_ops acp6x_pm = { | |
| 317 | - | RUNTIME_PM_OPS(snd_acp6x_suspend, snd_acp6x_resume, NULL) | |
| 351 | + | RUNTIME_PM_OPS(snd_acp6x_suspend, snd_acp6x_runtime_resume, NULL) | |
| 318 | 352 | SYSTEM_SLEEP_PM_OPS(snd_acp6x_suspend, snd_acp6x_resume) | |
| 319 | 353 | }; | |
| 320 | 354 | ||