mbox series

[00/42] PCI: aardvark: Various driver fixes

Message ID 20210506153153.30454-1-pali@kernel.org (mailing list archive)
Headers show
Series PCI: aardvark: Various driver fixes | expand

Message

Pali Rohár May 6, 2021, 3:31 p.m. UTC
This patch series fixes various issues in pci-aardvark.c driver
(PCIe controller on Marvell Armada 3700 SoC) used on Espressobin
and Turris Mox.

First patch fixes kernel panic (or TF-A panic depending on used
firmware) during execution of PIO transfer and I would suggest to
include this fix into v5.13 release to prevent future kernel panics.

Other patches then fixes PIO issues, PCIe link training, initialization
of PCIe controller, accessing PCIe Root Bridge/Port registers, handling
of interrupts (including ERR and PME), setup of Multi-MSI interrupts,
adding support for masking MSI interrupts, adding support for more than
32 MSI interrupts with MSI-X support, and adding support for AER.

Note that there are still some unresolved issues with PCIe on A3720.
I asked Marvell for PCIe documentation or explanations but I have not
received anything (yet).

Patch "Fix checking for PIO status" is taken from the Marvell github fork
and adapted for inclusion into mainline kernel:
https://github.com/MarvellEmbeddedProcessors/linux-marvell/commit/84444d22023c

Whole patch series is available also in my git branch pci-aardvark:
https://git.kernel.org/pub/scm/linux/kernel/git/pali/linux.git/log/?h=pci-aardvark

If you have Espressobin, Turris Mox or other A3720 board with PCIe
please test this patch series with your favourite PCIe card if
everything is working fine.

Evan Wang (1):
  PCI: aardvark: Fix checking for PIO status

Pali Rohár (39):
  PCI: aardvark: Fix kernel panic during PIO transfer
  PCI: aardvark: Fix checking for PIO Non-posted Request
  PCI: aardvark: Increase polling delay to 1.5s while waiting for PIO
    response
  PCI: pci-bridge-emul: Add PCIe Root Capabilities Register
  PCI: aardvark: Fix reporting CRS Software Visibility on emulated
    bridge
  PCI: aardvark: Fix link training
  PCI: Add PCI_EXP_DEVCTL_PAYLOAD_* macros
  PCI: aardvark: Fix PCIe Max Payload Size setting
  PCI: aardvark: Implement workaround for the readback value of VEND_ID
  PCI: aardvark: Do not touch status bits of masked interrupts in
    interrupt handler
  PCI: aardvark: Check for virq mapping when processing INTx IRQ
  PCI: aardvark: Remove irq_mask_ack callback for INTx interrupts
  PCI: aardvark: Don't mask irq when mapping
  PCI: aardvark: Change name of INTx irq_chip to advk-INT
  PCI: aardvark: Remove unneeded goto
  PCI: aardvark: Fix support for MSI interrupts
  PCI: aardvark: Correctly clear and unmask all MSI interrupts
  PCI: aardvark: Fix setting MSI address
  PCI: aardvark: Add support for more than 32 MSI interrupts
  PCI: aardvark: Add support for masking MSI interrupts
  PCI: aardvark: Enable MSI-X support
  PCI: aardvark: Fix support for ERR interrupt on emulated bridge
  PCI: aardvark: Fix support for PME on emulated bridge
  PCI: aardvark: Fix support for PME requester on emulated bridge
  PCI: aardvark: Fix support for bus mastering and PCI_COMMAND on
    emulated bridge
  PCI: aardvark: Disable bus mastering and mask all interrupts when
    unbinding driver
  PCI: aardvark: Free config space for emulated root bridge when
    unbinding driver to fix memory leak
  PCI: aardvark: Reset PCIe card and disable PHY when unbinding driver
  PCI: aardvark: Rewrite irq code to chained irq handler
  PCI: aardvark: Use separate INTA interrupt for emulated root bridge
  PCI: pci-bridge-emul: Add description for class_revision field
  PCI: pci-bridge-emul: Add definitions for missing capabilities
    registers
  PCI: aardvark: Add support for DEVCAP2, DEVCTL2, LNKCAP2 and LNKCTL2
    registers on emulated bridge
  PCI: aardvark: Add support for PCI_BRIDGE_CTL_BUS_RESET on emulated
    bridge
  PCI: aardvark: Replace custom PCIE_CORE_ERR_CAPCTL_* macros by
    linux/pci_regs.h macros
  PCI: aardvark: Replace custom PCIE_CORE_INT_* macros by linux
    PCI_INTERRUPT_* values
  PCI: aardvark: Cleanup some register macros
  PCI: aardvark: Add comments for OB_WIN_ENABLE and ADDR_WIN_DISABLE
  PCI: aardvark: Add support for Advanced Error Reporting registers on
    emulated bridge

Russell King (2):
  PCI: pci-bridge-emul: re-arrange register tests
  PCI: pci-bridge-emul: add support for PCIe extended capabilities

 drivers/pci/controller/pci-aardvark.c | 980 +++++++++++++++++++-------
 drivers/pci/pci-bridge-emul.c         | 149 ++--
 drivers/pci/pci-bridge-emul.h         |  17 +-
 include/uapi/linux/pci_regs.h         |   6 +
 4 files changed, 850 insertions(+), 302 deletions(-)

Comments

Lorenzo Pieralisi June 3, 2021, 3:16 p.m. UTC | #1
On Thu, May 06, 2021 at 05:31:11PM +0200, Pali Rohár wrote:
> This patch series fixes various issues in pci-aardvark.c driver
> (PCIe controller on Marvell Armada 3700 SoC) used on Espressobin
> and Turris Mox.
> 
> First patch fixes kernel panic (or TF-A panic depending on used
> firmware) during execution of PIO transfer and I would suggest to
> include this fix into v5.13 release to prevent future kernel panics.
> 
> Other patches then fixes PIO issues, PCIe link training, initialization
> of PCIe controller, accessing PCIe Root Bridge/Port registers, handling
> of interrupts (including ERR and PME), setup of Multi-MSI interrupts,
> adding support for masking MSI interrupts, adding support for more than
> 32 MSI interrupts with MSI-X support, and adding support for AER.
> 
> Note that there are still some unresolved issues with PCIe on A3720.
> I asked Marvell for PCIe documentation or explanations but I have not
> received anything (yet).
> 
> Patch "Fix checking for PIO status" is taken from the Marvell github fork
> and adapted for inclusion into mainline kernel:
> https://github.com/MarvellEmbeddedProcessors/linux-marvell/commit/84444d22023c
> 
> Whole patch series is available also in my git branch pci-aardvark:
> https://git.kernel.org/pub/scm/linux/kernel/git/pali/linux.git/log/?h=pci-aardvark
> 
> If you have Espressobin, Turris Mox or other A3720 board with PCIe
> please test this patch series with your favourite PCIe card if
> everything is working fine.
> 
> Evan Wang (1):
>   PCI: aardvark: Fix checking for PIO status
> 
> Pali Rohár (39):
>   PCI: aardvark: Fix kernel panic during PIO transfer
>   PCI: aardvark: Fix checking for PIO Non-posted Request
>   PCI: aardvark: Increase polling delay to 1.5s while waiting for PIO
>     response
>   PCI: pci-bridge-emul: Add PCIe Root Capabilities Register
>   PCI: aardvark: Fix reporting CRS Software Visibility on emulated
>     bridge
>   PCI: aardvark: Fix link training
>   PCI: Add PCI_EXP_DEVCTL_PAYLOAD_* macros
>   PCI: aardvark: Fix PCIe Max Payload Size setting
>   PCI: aardvark: Implement workaround for the readback value of VEND_ID
>   PCI: aardvark: Do not touch status bits of masked interrupts in
>     interrupt handler
>   PCI: aardvark: Check for virq mapping when processing INTx IRQ
>   PCI: aardvark: Remove irq_mask_ack callback for INTx interrupts
>   PCI: aardvark: Don't mask irq when mapping
>   PCI: aardvark: Change name of INTx irq_chip to advk-INT
>   PCI: aardvark: Remove unneeded goto
>   PCI: aardvark: Fix support for MSI interrupts
>   PCI: aardvark: Correctly clear and unmask all MSI interrupts
>   PCI: aardvark: Fix setting MSI address
>   PCI: aardvark: Add support for more than 32 MSI interrupts
>   PCI: aardvark: Add support for masking MSI interrupts
>   PCI: aardvark: Enable MSI-X support
>   PCI: aardvark: Fix support for ERR interrupt on emulated bridge
>   PCI: aardvark: Fix support for PME on emulated bridge
>   PCI: aardvark: Fix support for PME requester on emulated bridge
>   PCI: aardvark: Fix support for bus mastering and PCI_COMMAND on
>     emulated bridge
>   PCI: aardvark: Disable bus mastering and mask all interrupts when
>     unbinding driver
>   PCI: aardvark: Free config space for emulated root bridge when
>     unbinding driver to fix memory leak
>   PCI: aardvark: Reset PCIe card and disable PHY when unbinding driver
>   PCI: aardvark: Rewrite irq code to chained irq handler
>   PCI: aardvark: Use separate INTA interrupt for emulated root bridge
>   PCI: pci-bridge-emul: Add description for class_revision field
>   PCI: pci-bridge-emul: Add definitions for missing capabilities
>     registers
>   PCI: aardvark: Add support for DEVCAP2, DEVCTL2, LNKCAP2 and LNKCTL2
>     registers on emulated bridge
>   PCI: aardvark: Add support for PCI_BRIDGE_CTL_BUS_RESET on emulated
>     bridge
>   PCI: aardvark: Replace custom PCIE_CORE_ERR_CAPCTL_* macros by
>     linux/pci_regs.h macros
>   PCI: aardvark: Replace custom PCIE_CORE_INT_* macros by linux
>     PCI_INTERRUPT_* values
>   PCI: aardvark: Cleanup some register macros
>   PCI: aardvark: Add comments for OB_WIN_ENABLE and ADDR_WIN_DISABLE
>   PCI: aardvark: Add support for Advanced Error Reporting registers on
>     emulated bridge
> 
> Russell King (2):
>   PCI: pci-bridge-emul: re-arrange register tests
>   PCI: pci-bridge-emul: add support for PCIe extended capabilities
> 
>  drivers/pci/controller/pci-aardvark.c | 980 +++++++++++++++++++-------
>  drivers/pci/pci-bridge-emul.c         | 149 ++--
>  drivers/pci/pci-bridge-emul.h         |  17 +-
>  include/uapi/linux/pci_regs.h         |   6 +
>  4 files changed, 850 insertions(+), 302 deletions(-)

May I ask you please to split this series in smaller sets so that
it is easier to merge ?

Let's start with the more urgent fixes that don't involve rework (or
you have not received change requests for since they are simple).

Thanks,
Lorenzo
Pali Rohár June 3, 2021, 5:02 p.m. UTC | #2
On Thursday 03 June 2021 16:16:05 Lorenzo Pieralisi wrote:
> May I ask you please to split this series in smaller sets so that
> it is easier to merge ?

No problem!

> Let's start with the more urgent fixes that don't involve rework (or
> you have not received change requests for since they are simple).

Ok, I will do it.

> Thanks,
> Lorenzo
Simon Glass June 3, 2021, 6:02 p.m. UTC | #3
Hi,

On Thu, 3 Jun 2021 at 09:17, Lorenzo Pieralisi
<lorenzo.pieralisi@arm.com> wrote:
>
> On Thu, May 06, 2021 at 05:31:11PM +0200, Pali Rohár wrote:
> > This patch series fixes various issues in pci-aardvark.c driver
> > (PCIe controller on Marvell Armada 3700 SoC) used on Espressobin
> > and Turris Mox.
> >
> > First patch fixes kernel panic (or TF-A panic depending on used
> > firmware) during execution of PIO transfer and I would suggest to
> > include this fix into v5.13 release to prevent future kernel panics.
> >
> > Other patches then fixes PIO issues, PCIe link training, initialization
> > of PCIe controller, accessing PCIe Root Bridge/Port registers, handling
> > of interrupts (including ERR and PME), setup of Multi-MSI interrupts,
> > adding support for masking MSI interrupts, adding support for more than
> > 32 MSI interrupts with MSI-X support, and adding support for AER.
> >
> > Note that there are still some unresolved issues with PCIe on A3720.
> > I asked Marvell for PCIe documentation or explanations but I have not
> > received anything (yet).
> >
> > Patch "Fix checking for PIO status" is taken from the Marvell github fork
> > and adapted for inclusion into mainline kernel:
> > https://github.com/MarvellEmbeddedProcessors/linux-marvell/commit/84444d22023c
> >
> > Whole patch series is available also in my git branch pci-aardvark:
> > https://git.kernel.org/pub/scm/linux/kernel/git/pali/linux.git/log/?h=pci-aardvark
> >
> > If you have Espressobin, Turris Mox or other A3720 board with PCIe
> > please test this patch series with your favourite PCIe card if
> > everything is working fine.
> >
> > Evan Wang (1):
> >   PCI: aardvark: Fix checking for PIO status
> >
> > Pali Rohár (39):
> >   PCI: aardvark: Fix kernel panic during PIO transfer
> >   PCI: aardvark: Fix checking for PIO Non-posted Request
> >   PCI: aardvark: Increase polling delay to 1.5s while waiting for PIO
> >     response
> >   PCI: pci-bridge-emul: Add PCIe Root Capabilities Register
> >   PCI: aardvark: Fix reporting CRS Software Visibility on emulated
> >     bridge
> >   PCI: aardvark: Fix link training
> >   PCI: Add PCI_EXP_DEVCTL_PAYLOAD_* macros
> >   PCI: aardvark: Fix PCIe Max Payload Size setting
> >   PCI: aardvark: Implement workaround for the readback value of VEND_ID
> >   PCI: aardvark: Do not touch status bits of masked interrupts in
> >     interrupt handler
> >   PCI: aardvark: Check for virq mapping when processing INTx IRQ
> >   PCI: aardvark: Remove irq_mask_ack callback for INTx interrupts
> >   PCI: aardvark: Don't mask irq when mapping
> >   PCI: aardvark: Change name of INTx irq_chip to advk-INT
> >   PCI: aardvark: Remove unneeded goto
> >   PCI: aardvark: Fix support for MSI interrupts
> >   PCI: aardvark: Correctly clear and unmask all MSI interrupts
> >   PCI: aardvark: Fix setting MSI address
> >   PCI: aardvark: Add support for more than 32 MSI interrupts
> >   PCI: aardvark: Add support for masking MSI interrupts
> >   PCI: aardvark: Enable MSI-X support
> >   PCI: aardvark: Fix support for ERR interrupt on emulated bridge
> >   PCI: aardvark: Fix support for PME on emulated bridge
> >   PCI: aardvark: Fix support for PME requester on emulated bridge
> >   PCI: aardvark: Fix support for bus mastering and PCI_COMMAND on
> >     emulated bridge
> >   PCI: aardvark: Disable bus mastering and mask all interrupts when
> >     unbinding driver
> >   PCI: aardvark: Free config space for emulated root bridge when
> >     unbinding driver to fix memory leak
> >   PCI: aardvark: Reset PCIe card and disable PHY when unbinding driver
> >   PCI: aardvark: Rewrite irq code to chained irq handler
> >   PCI: aardvark: Use separate INTA interrupt for emulated root bridge
> >   PCI: pci-bridge-emul: Add description for class_revision field
> >   PCI: pci-bridge-emul: Add definitions for missing capabilities
> >     registers
> >   PCI: aardvark: Add support for DEVCAP2, DEVCTL2, LNKCAP2 and LNKCTL2
> >     registers on emulated bridge
> >   PCI: aardvark: Add support for PCI_BRIDGE_CTL_BUS_RESET on emulated
> >     bridge
> >   PCI: aardvark: Replace custom PCIE_CORE_ERR_CAPCTL_* macros by
> >     linux/pci_regs.h macros
> >   PCI: aardvark: Replace custom PCIE_CORE_INT_* macros by linux
> >     PCI_INTERRUPT_* values
> >   PCI: aardvark: Cleanup some register macros
> >   PCI: aardvark: Add comments for OB_WIN_ENABLE and ADDR_WIN_DISABLE
> >   PCI: aardvark: Add support for Advanced Error Reporting registers on
> >     emulated bridge
> >
> > Russell King (2):
> >   PCI: pci-bridge-emul: re-arrange register tests
> >   PCI: pci-bridge-emul: add support for PCIe extended capabilities
> >
> >  drivers/pci/controller/pci-aardvark.c | 980 +++++++++++++++++++-------
> >  drivers/pci/pci-bridge-emul.c         | 149 ++--
> >  drivers/pci/pci-bridge-emul.h         |  17 +-
> >  include/uapi/linux/pci_regs.h         |   6 +
> >  4 files changed, 850 insertions(+), 302 deletions(-)
>
> May I ask you please to split this series in smaller sets so that
> it is easier to merge ?
>
> Let's start with the more urgent fixes that don't involve rework (or
> you have not received change requests for since they are simple).

Is this due to the difficulty / time for reviewing them?

I feel it is a bit tough to ask someone to split a series, when it is
already nicely split into patches. Reordering to put the important
things first seems reasonable. Otherwise perhaps people can just
review what they can?

Regards,
Simon
Pali Rohár June 3, 2021, 6:18 p.m. UTC | #4
On Thursday 03 June 2021 12:02:28 Simon Glass wrote:
> Reordering to put the important things first seems reasonable.

This is already done. Patches are in "logical" order and the first patch
is the most important.
Lorenzo Pieralisi June 4, 2021, 2:05 p.m. UTC | #5
On Thu, Jun 03, 2021 at 12:02:28PM -0600, Simon Glass wrote:
> Hi,
> 
> On Thu, 3 Jun 2021 at 09:17, Lorenzo Pieralisi
> <lorenzo.pieralisi@arm.com> wrote:
> >
> > On Thu, May 06, 2021 at 05:31:11PM +0200, Pali Rohár wrote:
> > > This patch series fixes various issues in pci-aardvark.c driver
> > > (PCIe controller on Marvell Armada 3700 SoC) used on Espressobin
> > > and Turris Mox.
> > >
> > > First patch fixes kernel panic (or TF-A panic depending on used
> > > firmware) during execution of PIO transfer and I would suggest to
> > > include this fix into v5.13 release to prevent future kernel panics.
> > >
> > > Other patches then fixes PIO issues, PCIe link training, initialization
> > > of PCIe controller, accessing PCIe Root Bridge/Port registers, handling
> > > of interrupts (including ERR and PME), setup of Multi-MSI interrupts,
> > > adding support for masking MSI interrupts, adding support for more than
> > > 32 MSI interrupts with MSI-X support, and adding support for AER.
> > >
> > > Note that there are still some unresolved issues with PCIe on A3720.
> > > I asked Marvell for PCIe documentation or explanations but I have not
> > > received anything (yet).
> > >
> > > Patch "Fix checking for PIO status" is taken from the Marvell github fork
> > > and adapted for inclusion into mainline kernel:
> > > https://github.com/MarvellEmbeddedProcessors/linux-marvell/commit/84444d22023c
> > >
> > > Whole patch series is available also in my git branch pci-aardvark:
> > > https://git.kernel.org/pub/scm/linux/kernel/git/pali/linux.git/log/?h=pci-aardvark
> > >
> > > If you have Espressobin, Turris Mox or other A3720 board with PCIe
> > > please test this patch series with your favourite PCIe card if
> > > everything is working fine.
> > >
> > > Evan Wang (1):
> > >   PCI: aardvark: Fix checking for PIO status
> > >
> > > Pali Rohár (39):
> > >   PCI: aardvark: Fix kernel panic during PIO transfer
> > >   PCI: aardvark: Fix checking for PIO Non-posted Request
> > >   PCI: aardvark: Increase polling delay to 1.5s while waiting for PIO
> > >     response
> > >   PCI: pci-bridge-emul: Add PCIe Root Capabilities Register
> > >   PCI: aardvark: Fix reporting CRS Software Visibility on emulated
> > >     bridge
> > >   PCI: aardvark: Fix link training
> > >   PCI: Add PCI_EXP_DEVCTL_PAYLOAD_* macros
> > >   PCI: aardvark: Fix PCIe Max Payload Size setting
> > >   PCI: aardvark: Implement workaround for the readback value of VEND_ID
> > >   PCI: aardvark: Do not touch status bits of masked interrupts in
> > >     interrupt handler
> > >   PCI: aardvark: Check for virq mapping when processing INTx IRQ
> > >   PCI: aardvark: Remove irq_mask_ack callback for INTx interrupts
> > >   PCI: aardvark: Don't mask irq when mapping
> > >   PCI: aardvark: Change name of INTx irq_chip to advk-INT
> > >   PCI: aardvark: Remove unneeded goto
> > >   PCI: aardvark: Fix support for MSI interrupts
> > >   PCI: aardvark: Correctly clear and unmask all MSI interrupts
> > >   PCI: aardvark: Fix setting MSI address
> > >   PCI: aardvark: Add support for more than 32 MSI interrupts
> > >   PCI: aardvark: Add support for masking MSI interrupts
> > >   PCI: aardvark: Enable MSI-X support
> > >   PCI: aardvark: Fix support for ERR interrupt on emulated bridge
> > >   PCI: aardvark: Fix support for PME on emulated bridge
> > >   PCI: aardvark: Fix support for PME requester on emulated bridge
> > >   PCI: aardvark: Fix support for bus mastering and PCI_COMMAND on
> > >     emulated bridge
> > >   PCI: aardvark: Disable bus mastering and mask all interrupts when
> > >     unbinding driver
> > >   PCI: aardvark: Free config space for emulated root bridge when
> > >     unbinding driver to fix memory leak
> > >   PCI: aardvark: Reset PCIe card and disable PHY when unbinding driver
> > >   PCI: aardvark: Rewrite irq code to chained irq handler
> > >   PCI: aardvark: Use separate INTA interrupt for emulated root bridge
> > >   PCI: pci-bridge-emul: Add description for class_revision field
> > >   PCI: pci-bridge-emul: Add definitions for missing capabilities
> > >     registers
> > >   PCI: aardvark: Add support for DEVCAP2, DEVCTL2, LNKCAP2 and LNKCTL2
> > >     registers on emulated bridge
> > >   PCI: aardvark: Add support for PCI_BRIDGE_CTL_BUS_RESET on emulated
> > >     bridge
> > >   PCI: aardvark: Replace custom PCIE_CORE_ERR_CAPCTL_* macros by
> > >     linux/pci_regs.h macros
> > >   PCI: aardvark: Replace custom PCIE_CORE_INT_* macros by linux
> > >     PCI_INTERRUPT_* values
> > >   PCI: aardvark: Cleanup some register macros
> > >   PCI: aardvark: Add comments for OB_WIN_ENABLE and ADDR_WIN_DISABLE
> > >   PCI: aardvark: Add support for Advanced Error Reporting registers on
> > >     emulated bridge
> > >
> > > Russell King (2):
> > >   PCI: pci-bridge-emul: re-arrange register tests
> > >   PCI: pci-bridge-emul: add support for PCIe extended capabilities
> > >
> > >  drivers/pci/controller/pci-aardvark.c | 980 +++++++++++++++++++-------
> > >  drivers/pci/pci-bridge-emul.c         | 149 ++--
> > >  drivers/pci/pci-bridge-emul.h         |  17 +-
> > >  include/uapi/linux/pci_regs.h         |   6 +
> > >  4 files changed, 850 insertions(+), 302 deletions(-)
> >
> > May I ask you please to split this series in smaller sets so that
> > it is easier to merge ?
> >
> > Let's start with the more urgent fixes that don't involve rework (or
> > you have not received change requests for since they are simple).
> 
> Is this due to the difficulty / time for reviewing them?

Yes.

> I feel it is a bit tough to ask someone to split a series, when it is
> already nicely split into patches. Reordering to put the important
> things first seems reasonable. Otherwise perhaps people can just
> review what they can?

Pali maintains this code, what I do is reviewing the bits of code that
are common across all PCI host controllers; it would help me to have
patches that affect common functionality (even if the changes are only
in the aardvark code) and patches that are aardvark specific to be
split, to speed up the merge.

It is easier to deal with small series but if this is just a series
containing various fixes we can leave it as it is and we go through
it one-by-one.

Lorenzo