2021-02-20 03:04:21

by Richard Zhu

[permalink] [raw]
Subject: [PATCH] PCI: imx6: Limit DBI register length for imx6qp PCIe

Changes from v1 to v2:
- Add reviewed by Lucas and Krzysztof.
- Refine the subject and commit refer to Krzysztof comments.

drivers/pci/controller/dwc/pci-imx6.c | 1 +
1 file changed, 1 insertion(+)

[PATCH v2] PCI: imx6: Limit DBI register length for imx6qp PCIe


2021-02-20 03:05:11

by Richard Zhu

[permalink] [raw]
Subject: [PATCH v2] PCI: imx6: Limit DBI register length for imx6qp PCIe

Define the length of the DBI registers and limit config space to its
length. This makes sure that the kernel does not access registers beyond
that point that otherwise would lead to an abort on the i.MX 6QuadPlus.

See commit 075af61c19cd ("PCI: imx6: Limit DBI register length") that
resolves a similar issue on the i.MX 6Quad PCIe.

Signed-off-by: Richard Zhu <[email protected]>
Reviewed-by: Lucas Stach <[email protected]>
Reviewed-by: Krzysztof Wilczyński <[email protected]>
---
drivers/pci/controller/dwc/pci-imx6.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/drivers/pci/controller/dwc/pci-imx6.c b/drivers/pci/controller/dwc/pci-imx6.c
index 0cf1333c0440..853ea8e82952 100644
--- a/drivers/pci/controller/dwc/pci-imx6.c
+++ b/drivers/pci/controller/dwc/pci-imx6.c
@@ -1175,6 +1175,7 @@ static const struct imx6_pcie_drvdata drvdata[] = {
.variant = IMX6QP,
.flags = IMX6_PCIE_FLAG_IMX6_PHY |
IMX6_PCIE_FLAG_IMX6_SPEED_CHANGE,
+ .dbi_length = 0x200,
},
[IMX7D] = {
.variant = IMX7D,
--
2.17.1

2021-06-21 14:25:15

by Lorenzo Pieralisi

[permalink] [raw]
Subject: Re: [PATCH v2] PCI: imx6: Limit DBI register length for imx6qp PCIe

On Sat, Feb 20, 2021 at 10:49:48AM +0800, Richard Zhu wrote:
> Define the length of the DBI registers and limit config space to its
> length. This makes sure that the kernel does not access registers beyond
> that point that otherwise would lead to an abort on the i.MX 6QuadPlus.
>
> See commit 075af61c19cd ("PCI: imx6: Limit DBI register length") that
> resolves a similar issue on the i.MX 6Quad PCIe.
>
> Signed-off-by: Richard Zhu <[email protected]>
> Reviewed-by: Lucas Stach <[email protected]>
> Reviewed-by: Krzysztof Wilczyński <[email protected]>
> ---
> drivers/pci/controller/dwc/pci-imx6.c | 1 +
> 1 file changed, 1 insertion(+)

I'd like to merge this patch since I believe it is still required,
please let me know if that's not the case.

Lorenzo

> diff --git a/drivers/pci/controller/dwc/pci-imx6.c b/drivers/pci/controller/dwc/pci-imx6.c
> index 0cf1333c0440..853ea8e82952 100644
> --- a/drivers/pci/controller/dwc/pci-imx6.c
> +++ b/drivers/pci/controller/dwc/pci-imx6.c
> @@ -1175,6 +1175,7 @@ static const struct imx6_pcie_drvdata drvdata[] = {
> .variant = IMX6QP,
> .flags = IMX6_PCIE_FLAG_IMX6_PHY |
> IMX6_PCIE_FLAG_IMX6_SPEED_CHANGE,
> + .dbi_length = 0x200,
> },
> [IMX7D] = {
> .variant = IMX7D,
> --
> 2.17.1
>

2021-06-22 00:45:36

by Richard Zhu

[permalink] [raw]
Subject: RE: [PATCH v2] PCI: imx6: Limit DBI register length for imx6qp PCIe

> -----Original Message-----
> From: Lorenzo Pieralisi <[email protected]>
> Sent: Monday, June 21, 2021 10:24 PM
> To: Richard Zhu <[email protected]>
> Cc: [email protected]; [email protected]; [email protected];
> [email protected]; [email protected]; dl-linux-imx
> <[email protected]>; [email protected];
> [email protected]; [email protected]
> Subject: Re: [PATCH v2] PCI: imx6: Limit DBI register length for imx6qp PCIe
>
> On Sat, Feb 20, 2021 at 10:49:48AM +0800, Richard Zhu wrote:
> > Define the length of the DBI registers and limit config space to its
> > length. This makes sure that the kernel does not access registers
> > beyond that point that otherwise would lead to an abort on the i.MX
> 6QuadPlus.
> >
> > See commit 075af61c19cd ("PCI: imx6: Limit DBI register length") that
> > resolves a similar issue on the i.MX 6Quad PCIe.
> >
> > Signed-off-by: Richard Zhu <[email protected]>
> > Reviewed-by: Lucas Stach <[email protected]>
> > Reviewed-by: Krzysztof Wilczyński <[email protected]>
> > ---
> > drivers/pci/controller/dwc/pci-imx6.c | 1 +
> > 1 file changed, 1 insertion(+)
>
> I'd like to merge this patch since I believe it is still required, please let me
> know if that's not the case.
Hi Lorenzo:
Thanks for merging this patch.

Best Regards
Richard Zhu
>
> Lorenzo
>
> > diff --git a/drivers/pci/controller/dwc/pci-imx6.c
> > b/drivers/pci/controller/dwc/pci-imx6.c
> > index 0cf1333c0440..853ea8e82952 100644
> > --- a/drivers/pci/controller/dwc/pci-imx6.c
> > +++ b/drivers/pci/controller/dwc/pci-imx6.c
> > @@ -1175,6 +1175,7 @@ static const struct imx6_pcie_drvdata drvdata[] =
> {
> > .variant = IMX6QP,
> > .flags = IMX6_PCIE_FLAG_IMX6_PHY |
> > IMX6_PCIE_FLAG_IMX6_SPEED_CHANGE,
> > + .dbi_length = 0x200,
> > },
> > [IMX7D] = {
> > .variant = IMX7D,
> > --
> > 2.17.1
> >

2021-06-22 09:30:32

by Lorenzo Pieralisi

[permalink] [raw]
Subject: Re: [PATCH] PCI: imx6: Limit DBI register length for imx6qp PCIe

On Sat, 20 Feb 2021 10:49:47 +0800, Richard Zhu wrote:
> Changes from v1 to v2:
> - Add reviewed by Lucas and Krzysztof.
> - Refine the subject and commit refer to Krzysztof comments.
>
> drivers/pci/controller/dwc/pci-imx6.c | 1 +
> 1 file changed, 1 insertion(+)
>
> [...]

Applied to pci/imx6, thanks!

[1/1] PCI: imx6: Limit DBI register length for imx6qp PCIe
https://git.kernel.org/lpieralisi/pci/c/36ff5224f1

Thanks,
Lorenzo