[PATCH 1/2] PCI: mediatek-gen3: Stop acquiring spinlocks in {suspend,resume}_noirq
Bjorn Helgaas
helgaas at kernel.org
Thu Jun 8 10:15:07 PDT 2023
On Thu, May 04, 2023 at 01:35:08PM +0200, AngeloGioacchino Del Regno wrote:
> In mtk_pcie_suspend_noirq() and mtk_pcie_resume_noirq() we are,
> respectively, disabling and enabling generation of interrupts and
> then saving and restoring the enabled interrupts register: since
> we're using noirq PM callbacks, that can be safely done without
> holding any spin lock.
Tangent: it's annoying that pcie-mediatek.c and pcie-mediatek-gen3.c
use identical "mtk_pcie_suspend_noirq()" names. That makes browsing
harder than it needs to be. But I see that you refer to
mediatek-gen3.
> +++ b/drivers/pci/controller/pcie-mediatek-gen3.c
> @@ -963,8 +963,6 @@ static void mtk_pcie_irq_save(struct mtk_gen3_pcie *pcie)
> {
> int i;
>
> - raw_spin_lock(&pcie->irq_lock);
> -
> pcie->saved_irq_state = readl_relaxed(pcie->base + PCIE_INT_ENABLE_REG);
>
> for (i = 0; i < PCIE_MSI_SET_NUM; i++) {
> @@ -973,16 +971,12 @@ static void mtk_pcie_irq_save(struct mtk_gen3_pcie *pcie)
> msi_set->saved_irq_state = readl_relaxed(msi_set->base +
> PCIE_MSI_SET_ENABLE_OFFSET);
> }
> -
> - raw_spin_unlock(&pcie->irq_lock);
> }
Jianjun added mtk_pcie_irq_save() and mtk_pcie_irq_restore() with
d537dc125f07 ("PCI: mediatek-gen3: Add system PM support").
I suggest looking at other drivers and structuring mediatek-gen3
similarly, including using similar function names. No other drivers
have a .*_pcie_irq_save() function. Several have .*_pcie_host_init(),
and some of those do include some IRQ setup.
Bjorn
More information about the linux-arm-kernel
mailing list