[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAFBinCDgpNMfF-DnZSLAd7Ps66OKnUdpDmi7OE2O0bctOwwvCg@mail.gmail.com>
Date: Tue, 27 Aug 2019 22:51:12 +0200
From: Martin Blumenstingl <martin.blumenstingl@...glemail.com>
To: Dilip Kota <eswara.kota@...ux.intel.com>
Cc: "Chuan Hua, Lei" <chuanhua.lei@...ux.intel.com>,
andriy.shevchenko@...el.com, cheol.yong.kim@...el.com,
devicetree@...r.kernel.org, gustavo.pimentel@...opsys.com,
hch@...radead.org, jingoohan1@...il.com,
linux-kernel@...r.kernel.org, linux-pci@...r.kernel.org,
qi-ming.wu@...el.com
Subject: Re: [PATCH v2 3/3] dwc: PCI: intel: Intel PCIe RC controller driver
Hi Dilip,
On Tue, Aug 27, 2019 at 10:47 AM Dilip Kota <eswara.kota@...ux.intel.com> wrote:
[...]
> >
> >
> >> now I am wondering:
> >> - if we don't have to disable the interrupt line (once it is enabled),
> >> why can't we enable all of these interrupts at initialization time
> >> (instead of doing it on-demand)?
> > Good point! we even can remote map_irq patch, directly call
> >
> > of_irq_parse_and_map_pci as other drivers do.
>
> Irrespective of disabling, imo interrupts(A/B/C/D) should be enabled
> when they are requested; which happens during map_irq() call.
with an integrated interrupt controller (which I decided to use in my
experiment because I could not find a .unmap_irq callback) this would
be the case:
- of_irq_parse_and_map_pci finds our APP interrupt
- this will enable the interrupt in the PCIe controller's APP register first
- then it will enable the interrupt in the parent interrupt controller
- when the PCIe card then frees the IRQ line again we will disable
both interrupts (the APP interrupt as well as the parent interrupt)
I don't see why of_irq_parse_and_map_pci + custom code to enable the
APP interrupt in .map_irq (without any .unmap_irq callback) is better
than always enabling it
[...]
> >>> This is needed. In the old driver, we fixed this by fixup. The original
> >>> comment as follows,
> >>>
> >>> /*
> >>> * The root complex has a hardwired class of
> >>> PCI_CLASS_NETWORK_OTHER or
> >>> * PCI_CLASS_BRIDGE_HOST, when it is operating as a root complex this
> >>> * needs to be switched to * PCI_CLASS_BRIDGE_PCI
> >>> */
> >> that would be a good comment to add if you really need it
> >> can you please look at dw_pcie_setup_rc (from
> >> pcie-designware-host.c), it does:
> >> /* Enable write permission for the DBI read-only register */
> >> dw_pcie_dbi_ro_wr_en(pci);
> >> /* Program correct class for RC */
> >> dw_pcie_wr_own_conf(pp, PCI_CLASS_DEVICE, 2, PCI_CLASS_BRIDGE_PCI);
> >> /* Better disable write permission right after the update */
> >> dw_pcie_dbi_ro_wr_dis(pci);
> >>
> >> so my understanding is that there is a functional requirement to set
> >> the class to PCI_CLASS_BRIDGE_PCI
> >> however, that requirement is already covered by pcie-designware-host.c
> > I will task Dilip to check if we can use dwc one.
> dw_pcie_setup_rc () cannot be called here because, it is not doing
> PCI_CLASS_BRIDGE_PCI set alone, it is configuring many other things.
I am surprised to see that dw_pcie_setup_rc() is not used at all in your driver
it sets up BARs, bus numbers, interrupt pins, the command register, etc.
with my limited knowledge I assumed that these ("many other things")
are all mandatory so everything works correctly
what problems do you experience when you use dw_pcie_setup_rc()?
also it seems that virtually every PCIe driver based on the DWC
controller uses it:
$ grep -R dw_pcie_setup_rc drivers/pci/controller/dwc/ | wc -l
20
Martin
Powered by blists - more mailing lists