Commit 9d8c4181 authored by Inochi Amaoto's avatar Inochi Amaoto Committed by Thomas Gleixner
Browse files

irqchip/sg2042-msi: Fix broken affinity setting



When using NVME on SG2044, the NVME drvier always complains about "I/O tag
XXX (XXX) QID XX timeout, completion polled", which is caused by the broken
affinity setting mechanism of the sg2042-msi driver.

The PLIC driver can only the set the affinity when enabled, but the
sg2042-msi driver invokes the affinity setter in disabled state, which
causes the change to be lost.

Cure this by implementing the irq_startup()/shutdown() callbacks, which
allow to startup (enabled) the underlying PLIC first.

Fixes: e96b93a9 ("irqchip/sg2042-msi: Add the Sophgo SG2044 MSI interrupt controller")
Reported-by: default avatarHan Gao <rabenda.cn@gmail.com>
Suggested-by: default avatarThomas Gleixner <tglx@linutronix.de>
Signed-off-by: default avatarInochi Amaoto <inochiama@gmail.com>
Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
Tested-by: Chen Wang <unicorn_wang@outlook.com> # Pioneerbox
Reviewed-by: default avatarChen Wang <unicorn_wang@outlook.com>
Link: https://lore.kernel.org/all/20250813232835.43458-4-inochiama@gmail.com
parent 54f45a30
Loading
Loading
Loading
Loading
+13 −5
Original line number Diff line number Diff line
@@ -85,6 +85,8 @@ static void sg2042_msi_irq_compose_msi_msg(struct irq_data *d, struct msi_msg *m

static const struct irq_chip sg2042_msi_middle_irq_chip = {
	.name			= "SG2042 MSI",
	.irq_startup		= irq_chip_startup_parent,
	.irq_shutdown		= irq_chip_shutdown_parent,
	.irq_ack		= sg2042_msi_irq_ack,
	.irq_mask		= irq_chip_mask_parent,
	.irq_unmask		= irq_chip_unmask_parent,
@@ -114,6 +116,8 @@ static void sg2044_msi_irq_compose_msi_msg(struct irq_data *d, struct msi_msg *m

static struct irq_chip sg2044_msi_middle_irq_chip = {
	.name			= "SG2044 MSI",
	.irq_startup		= irq_chip_startup_parent,
	.irq_shutdown		= irq_chip_shutdown_parent,
	.irq_ack		= sg2044_msi_irq_ack,
	.irq_mask		= irq_chip_mask_parent,
	.irq_unmask		= irq_chip_unmask_parent,
@@ -186,7 +190,9 @@ static const struct irq_domain_ops sg204x_msi_middle_domain_ops = {
};

#define SG2042_MSI_FLAGS_REQUIRED (MSI_FLAG_USE_DEF_DOM_OPS |		\
				   MSI_FLAG_USE_DEF_CHIP_OPS)
				   MSI_FLAG_USE_DEF_CHIP_OPS |		\
				   MSI_FLAG_PCI_MSI_MASK_PARENT |	\
				   MSI_FLAG_PCI_MSI_STARTUP_PARENT)

#define SG2042_MSI_FLAGS_SUPPORTED MSI_GENERIC_FLAGS_MASK

@@ -201,7 +207,9 @@ static const struct msi_parent_ops sg2042_msi_parent_ops = {
};

#define SG2044_MSI_FLAGS_REQUIRED (MSI_FLAG_USE_DEF_DOM_OPS |		\
				   MSI_FLAG_USE_DEF_CHIP_OPS)
				   MSI_FLAG_USE_DEF_CHIP_OPS |		\
				   MSI_FLAG_PCI_MSI_MASK_PARENT |	\
				   MSI_FLAG_PCI_MSI_STARTUP_PARENT)

#define SG2044_MSI_FLAGS_SUPPORTED (MSI_GENERIC_FLAGS_MASK |		\
				    MSI_FLAG_PCI_MSIX)