Linux PCI subsystem development
 help / color / mirror / Atom feed
From: Marek Vasut <marek.vasut@mailbox.org>
To: Koichiro Den <den@valinux.co.jp>
Cc: linux-pci@vger.kernel.org,
	"Krzysztof Wilczyński" <kwilczynski@kernel.org>,
	"Bjorn Helgaas" <bhelgaas@google.com>,
	"Geert Uytterhoeven" <geert+renesas@glider.be>,
	"Lorenzo Pieralisi" <lpieralisi@kernel.org>,
	"Magnus Damm" <magnus.damm@gmail.com>,
	"Manivannan Sadhasivam" <mani@kernel.org>,
	"Rob Herring" <robh@kernel.org>,
	"Yoshihiro Shimoda" <yoshihiro.shimoda.uh@renesas.com>,
	linux-kernel@vger.kernel.org, linux-renesas-soc@vger.kernel.org
Subject: Re: [PATCH v2 2/2] PCI: dwc: rcar-gen4: Use .post_deinit to handle dw_pcie_ep_init() failures
Date: Thu, 20 Aug 2026 10:42:28 +0200	[thread overview]
Message-ID: <5be9b098-e183-4401-b1bb-44ce56e96e22@mailbox.org> (raw)
In-Reply-To: <ymct5mjms65qy3hzlgfopzbrhqwdxk473awdqsguaamltchcur@fydxwbqqe6fu>

On 8/20/26 10:11 AM, Koichiro Den wrote:

Hello Den-san,

> On Thu, Aug 20, 2026 at 05:57:56AM +0200, Marek Vasut wrote:
>> Implement .post_deinit() callback in R-Car Gen4 struct dw_pcie_ep_ops {}
>> which asserts reset and stops the clock. This undoes start of clock and
>> deassert of reset performed in .pre_init() in case dw_pcie_ep_init() fails
>> after successful call of .pre_init() callback.
>>
>> The use of .post_deinit() callback correctly handles the clock and reset
>> stop, unlike the call of rcar_gen4_pcie_ep_deinit() in dw_pcie_ep_init()
>> which could not discern at which point the dw_pcie_ep_init() failed and
>> might have attempted to stop clock and assert reset twice, remove it.
>>
>> Since dw_pcie_ep_deinit() also invokes the .post_deinit() callback, drop
>> calls to rcar_gen4_pcie_ep_deinit() in both rcar_gen4_add_dw_pcie_ep()
>> dw_pcie_ep_init_registers() fail path and rcar_gen4_remove_dw_pcie_ep()
>> to avoid duplicate stop of clock and assert of reset, and drop no longer
>> used rcar_gen4_pcie_ep_deinit() entirely.
>>
>> Initialize PCIEDMAINTSTSEN early in rcar_gen4_pcie_ep_pre_init() to 0,
>> to make sure that edma_int bits will never be set in case of failure
> 
> I think s/will never be set/will never be left set/, because .pre_init() writes
> 0xffff before later initialization can fail, and .post_deinit() then sets it
> back to 0. Otherwise LGTM.
> 
> (Again, I did some quick tests on an S4 Spider, covering the normal path and
> several injected failure paths. I don't have V4H hardware, though.)
> Please feel free to pick either or both tags, if that helps.
> 
> Reviewed-by: Koichiro Den <den@valinux.co.jp>
> Tested-by: Koichiro Den <den@valinux.co.jp>

I have updated the commit message and collected the tags, thank you !

-- 
Best regards,
Marek Vasut

  reply	other threads:[~2026-08-20  9:12 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-20  3:57 [PATCH v2 1/2] PCI: dwc: Add .post_deinit counterpart to endpoint .pre_init callback Marek Vasut
2026-08-20  3:57 ` [PATCH v2 2/2] PCI: dwc: rcar-gen4: Use .post_deinit to handle dw_pcie_ep_init() failures Marek Vasut
2026-08-20  4:10   ` sashiko-bot
2026-08-20  8:11   ` Koichiro Den
2026-08-20  8:42     ` Marek Vasut [this message]
2026-08-20  4:06 ` [PATCH v2 1/2] PCI: dwc: Add .post_deinit counterpart to endpoint .pre_init callback sashiko-bot
2026-08-20  8:09 ` Koichiro Den
2026-08-20  8:20   ` Marek Vasut

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5be9b098-e183-4401-b1bb-44ce56e96e22@mailbox.org \
    --to=marek.vasut@mailbox.org \
    --cc=bhelgaas@google.com \
    --cc=den@valinux.co.jp \
    --cc=geert+renesas@glider.be \
    --cc=kwilczynski@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=linux-renesas-soc@vger.kernel.org \
    --cc=lpieralisi@kernel.org \
    --cc=magnus.damm@gmail.com \
    --cc=mani@kernel.org \
    --cc=robh@kernel.org \
    --cc=yoshihiro.shimoda.uh@renesas.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox