mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Hans Zhang <hans.zhang@cixtech.com>
To: Rob Herring <robh@kernel.org>
Cc: bhelgaas@google.com, lpieralisi@kernel.org, kw@linux.com,
	manivannan.sadhasivam@linaro.org, krzk+dt@kernel.org,
	conor+dt@kernel.org, linux-pci@vger.kernel.org,
	devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
	Manikandan K Pillai <mpillai@cadence.com>
Subject: Re: [PATCH v3 5/6] PCI: cadence: Add callback functions for RP and EP controller
Date: Sat, 12 Apr 2025 23:45:03 +0800	[thread overview]
Message-ID: <07457d00-82bb-4096-ba07-6cc7b7d118e3@cixtech.com> (raw)
In-Reply-To: <20250411202420.GA3793660-robh@kernel.org>



On 2025/4/12 04:24, Rob Herring wrote:
>> +void __iomem *cdns_pci_hpa_map_bus(struct pci_bus *bus, unsigned int devfn,
>> +                                int where)
>> +{
>> +     struct pci_host_bridge *bridge = pci_find_host_bridge(bus);
>> +     struct cdns_pcie_rc *rc = pci_host_bridge_priv(bridge);
>> +     struct cdns_pcie *pcie = &rc->pcie;
>> +     unsigned int busn = bus->number;
>> +     u32 addr0, desc0, desc1, ctrl0;
>> +     u32 regval;
>> +
>> +     if (pci_is_root_bus(bus)) {
>> +             /*
>> +              * Only the root port (devfn == 0) is connected to this bus.
>> +              * All other PCI devices are behind some bridge hence on another
>> +              * bus.
>> +              */
>> +             if (devfn)
>> +                     return NULL;
>> +
>> +             return pcie->reg_base + (where & 0xfff);
>> +     }
>> +
>> +     /*
>> +      * Clear AXI link-down status
>> +      */
> 
> That is an odd thing to do in map_bus. Also, it is completely racy
> because...
> 
>> +     regval = cdns_pcie_hpa_readl(pcie, REG_BANK_AXI_SLAVE, CDNS_PCIE_HPA_AT_LINKDOWN);
>> +     cdns_pcie_hpa_writel(pcie, REG_BANK_AXI_SLAVE, CDNS_PCIE_HPA_AT_LINKDOWN,
>> +                          (regval & GENMASK(0, 0)));
>> +
> 
> What if the link goes down again here.
> 

Hi Rob,

Thanks your for reply. Compared to Synopsys PCIe IP, Cadence PCIe IP has 
one more register - CDNS_PCIE_HPA_AT_LINKDOWN.  When the PCIe link 
appears link down, the register -CDNS_PCIE_HPA_AT_LINKDOWN bit0 is set 
to 1.  Then, ECAM cannot access config space. You need to clear 
CDNS_PCIE_HPA_AT_LINKDOWN bit0 to continue the access.

In my opinion, this is where Cadence PCIe IP doesn't make sense.  As 
Cadence users, we had no choice, and the chip had already been posted to 
silicon.

Therefore, when we design the second-generation SOC, we will design an 
SPI interrupt. When link down occurs, an SPI interrupt is generated. We 
set CDNS_PCIE_HPA_AT_LINKDOWN bit0 to 0 in the interrupt function.

If there are other reasons, please Manikandan add.



In addition, by the way, ECAM is not accessible when the link is down. 
For example, if the RP is set to hot reset, the hot reset cannot be 
unreset. In this case, you need to use the APB to unreset. We mentioned 
an RTL bug to Cadence that we currently can't fix with our first or 
second generation chips. Cadence has not released RTL patch to us so far.

This software workaround approach will also later appear in the Cixtech 
PCIe controller series patch.


Best regards,
Hans

  reply	other threads:[~2025-04-12 15:45 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-11 10:36 [PATCH v3 0/6] Enhance the PCIe controller driver hans.zhang
2025-04-11 10:36 ` [PATCH v3 1/6] dt-bindings: pci: cadence: Extend compatible for new RP configuration hans.zhang
2025-04-11 19:56   ` Rob Herring
2025-04-14  3:05     ` Manikandan Karunakaran Pillai
2025-04-11 10:36 ` [PATCH v3 2/6] dt-bindings: pci: cadence: Extend compatible for new EP configurations hans.zhang
2025-04-11 10:36 ` [PATCH v3 3/6] PCI: cadence: Add header support for PCIe HPA controller hans.zhang
2025-04-11 20:31   ` Rob Herring
2025-04-12 15:19     ` Hans Zhang
2025-04-11 10:36 ` [PATCH v3 4/6] PCI: cadence: Add support for PCIe Endpoint " hans.zhang
2025-04-11 10:36 ` [PATCH v3 5/6] PCI: cadence: Add callback functions for RP and EP controller hans.zhang
2025-04-11 20:24   ` Rob Herring
2025-04-12 15:45     ` Hans Zhang [this message]
2025-04-12 16:02       ` Hans Zhang
2025-04-14  3:52     ` Manikandan Karunakaran Pillai
2025-04-24  2:58       ` Rob Herring
2025-04-24  3:53         ` Manikandan Karunakaran Pillai
2025-04-24 15:07           ` Rob Herring
2025-04-14  4:13   ` kernel test robot
2025-04-14  7:47   ` kernel test robot
2025-04-14  9:20   ` kernel test robot
2025-04-11 10:36 ` [PATCH v3 6/6] PCI: cadence: Update support for TI J721e boards hans.zhang
2025-04-11 20:25   ` Rob Herring
2025-04-14  3:12     ` Manikandan Karunakaran Pillai

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=07457d00-82bb-4096-ba07-6cc7b7d118e3@cixtech.com \
    --to=hans.zhang@cixtech.com \
    --cc=bhelgaas@google.com \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=krzk+dt@kernel.org \
    --cc=kw@linux.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=lpieralisi@kernel.org \
    --cc=manivannan.sadhasivam@linaro.org \
    --cc=mpillai@cadence.com \
    --cc=robh@kernel.org \
    /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

all inboxes | Powered by JetHome®