[PATCH 1/2] PCI: mediatek-gen3: Stop acquiring spinlocks in {suspend,resume}_noirq
AngeloGioacchino Del Regno
angelogioacchino.delregno at collabora.com
Fri Jun 9 00:29:36 PDT 2023
Il 08/06/23 19:15, Bjorn Helgaas ha scritto:
> 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
Hello Bjorn,
thanks for the feedback!
Yes, I of course refer to the Gen3 driver... I'll check other drivers and
will try to improve the consistency of this one with the others as soon as
I have some bandwidth to perform the job.
Thanks again,
Angelo
More information about the Linux-mediatek
mailing list