Re: [PATCH 2/5] PCI: endpoint: Introduce 'epc_deinit' event and notify the EPF drivers
From: Bjorn Helgaas
Date: Tue Jun 11 2024 - 18:06:56 EST
On Thu, Jun 06, 2024 at 12:56:35PM +0530, Manivannan Sadhasivam wrote:
> As like the 'epc_init' event, that is used to signal the EPF drivers about
> the EPC initialization, let's introduce 'epc_deinit' event that is used to
> signal EPC deinitialization.
>
> The EPC deinitialization applies only when any sort of fundamental reset
> is supported by the endpoint controller as per the PCIe spec.
>
> Reference: PCIe Base spec v5.0, sections 4.2.4.9.1 and 6.6.1.
PCIe r6.0, sec 4.2.5.9.1 and 6.6.1.
(Not 4.2.4.9.1, which no longer exists in r6.x)
> Currently, some EPC drivers like pcie-qcom-ep and pcie-tegra194 support
> PERST# as the fundamental reset. So the 'deinit' event will be notified to
> the EPF drivers when PERST# assert happens in the above mentioned EPC
> drivers.
>
> The EPF drivers, on receiving the event through the epc_deinit() callback
> should reset the EPF state machine and also cleanup any configuration that
> got affected by the fundamental reset like BAR, DMA etc...
>
> This change also warrants skipping the cleanups in unbind() if already done
> in epc_deinit().
>
> Reviewed-by: Niklas Cassel <cassel@xxxxxxxxxx>
> Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@xxxxxxxxxx>