[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <a5597b19-eca8-10b0-1fe4-8f6e1d1d1adf@collabora.com>
Date: Fri, 9 Jun 2023 09:29:36 +0200
From: AngeloGioacchino Del Regno
<angelogioacchino.delregno@...labora.com>
To: Bjorn Helgaas <helgaas@...nel.org>
Cc: ryder.lee@...iatek.com, jianjun.wang@...iatek.com,
lpieralisi@...nel.org, kw@...ux.com, robh@...nel.org,
bhelgaas@...gle.com, p.zabel@...gutronix.de,
matthias.bgg@...il.com, linux-pci@...r.kernel.org,
linux-mediatek@...ts.infradead.org, linux-kernel@...r.kernel.org,
linux-arm-kernel@...ts.infradead.org
Subject: Re: [PATCH 1/2] PCI: mediatek-gen3: Stop acquiring spinlocks in
{suspend,resume}_noirq
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
Powered by blists - more mailing lists