PCI: imx6: fix imprecise abort handler
Subsystems (2)
PATCH 1/1 PCI: imx6: fix imprecise abort handler
An imprecise abort is triggered when a port behind a switch is accessed and no device is present. At enumeration, imprecise aborts are not enabled thus this ends up getting deferred until the kernel has completed init. At that point we must not adjust PC - the handler must do nothing, but a handler must exist.
This fixes random crashes that occur right after freeing init. This is against linux-pci/host-imx6.
--- drivers/pci/host/pci-imx6.c | 6 ------ 1 file changed, 6 deletions(-)
drivers/pci/host/pci-imx6.c +0 -6
@@ -200,12 +200,6 @@ static int pcie_phy_write(void __iomem *dbi_base, int addr, int data)static int imx6q_pcie_abort_handler (unsigned long addr,unsigned int fsr,struct pt_regs *regs) { -/* -* If it was an imprecise abort, then we need to correct the -* return address to be _after_ the instruction. -*/ -if (fsr & (1 <<10 )) - regs->ARM_pc +=4 ;return 0 ; }
Signature · 1 line
1.7.9.5
PATCH 1/1 PCI: imx6: fix imprecise abort handler
Dear Tim Harvey,
Quoted 6 lines
An imprecise abort is triggered when a port behind a switch is accessed and no device is present. At enumeration, imprecise aborts are not enabled thus this ends up getting deferred until the kernel has completed init. At that point we must not adjust PC - the handler must do nothing, but a handler must exist.
Quoted 6 lines
This fixes random crashes that occur right after freeing init. This is against linux-pci/host-imx6.
Acked-by Marek Vasut <[email protected]>Tested-by Marek Vasut <[email protected]>Signed-off-by Tim Harvey <[email protected]>
Expanding CC a bit, let's have more eyes on this.
Quoted 10 lines
--- drivers/pci/host/pci-imx6.c | 6 ------ 1 file changed, 6 deletions(-)drivers/pci/host/pci-imx6.c +0
-0@@ -200,12 +200,6 @@ static int pcie_phy_write(void __iomem *dbi_base, int addr, int data) static int imx6q_pcie_abort_handler(unsigned long addr,
drivers/pci/host/pci-imx6.c static int pcie_phy_write(void __iomem *dbi_base, int · line 204
Quoted 10 lines
drivers/pci/host/pci-imx6.c +0
-6unsigned int fsr, struct pt_regs *regs) { -/* -* If it was an imprecise abort, then we need to correct the -* return address to be _after_ the instruction. -*/ -if (fsr & (1 <<10 )) - regs->ARM_pc +=4 ;return 0 ; }
Best regards,
Marek Vasut
PATCH 1/1 PCI: imx6: fix imprecise abort handler
Quoted 8 lines · Marek Vasut
Dear Tim Harvey,
Quoted 6 lines
An imprecise abort is triggered when a port behind a switch is accessed and no device is present. At enumeration, imprecise aborts are not enabled thus this ends up getting deferred until the kernel has completed init. At that point we must not adjust PC - the handler must do nothing, but a handler must exist.
Quoted 9 lines
Quoted 6 lines
This fixes random crashes that occur right after freeing init. This is against linux-pci/host-imx6.
Acked-by Marek Vasut <[email protected]>Tested-by Marek Vasut <[email protected]>Signed-off-by Tim Harvey <[email protected]>Expanding CC a bit, let's have more eyes on this.
A message that is not in the archive (sent off-list or not yet received): CAHM4w1nyXCuTya+TR7Rxiw0ojmwZHwz9iUmz=cG8z_8h2wKhSw@mail.gmail.com
Bjorn Helgaas
maintainerPATCH 1/1 PCI: imx6: fix imprecise abort handler
Quoted 65 lines · Pratyush Anand
Hi,
Quoted 6 lines · Marek Vasut
Dear Tim Harvey,
Quoted 3 lines
An imprecise abort is triggered when a port behind a switch is accessed and no device is present. At enumeration, imprecise aborts are not enabled
I do not know the complete history. But I do not understand, why imprecise aborts are not enabled during kernel enumeration.
What happens when PCIe switch is already connected before boot?pci_common_initwill try to read vendor/product ID for a non-existing function during kernel enumeration itself, which should result in imprecise external abort. In fact, I had observed with my system that if a switch is connected to PCIe RC, then abort occurs during kernel initialization itself. So a proper handling was needed. We calledhook_fault_codefrom asubsys_initpcie_init(or similar) function, which insured that abort handler is called whenever, software tries to read vendor/product id of a non-existing functionQuoted 19 lines
Quoted 6 lines
thus this ends up getting deferred until the kernel has completed init. At
that point we must not adjust PC - the handler must do nothing, but a handler must exist.Quoted 6 lines
This fixes random crashes that occur right after freeing init. This is against linux-pci/host-imx6.
Acked-by Marek Vasut <[email protected]>Tested-by Marek Vasut <[email protected]>Signed-off-by Tim Harvey <[email protected]>Expanding CC a bit, let's have more eyes on this.
Quoted 4 lines
--- drivers/pci/host/pci-imx6.c | 6 ------ 1 file changed, 6 deletions(-)Quoted 15 lines
Quoted 9 lines
drivers/pci/host/pci-imx6.c +0
-0@@ -200,12 +200,6 @@ static int pcie_phy_write(void __iomem *dbi_base,int
addr, int data) static int imx6q_pcie_abort_handler(unsigned long addr,
unsigned int fsr, structpt_regs*regs)
{drivers/pci/host/pci-imx6.c static int pcie_phy_write(void __iomem *dbi_base, int addr, int data) · line 208
Quoted 6 lines
drivers/pci/host/pci-imx6.c +0
-6-/* -* If it was an imprecise abort, then we need to correct the -* return address to be _after_ the instruction. -*/ -if (fsr & (1 <<10 )) - regs->ARM_pc +=4 ;Just for knowledge, is there any case other than read of IDs which might cause imprecise abort? If not, then this handler can be modified a bit to insure
that it does not handle any unintended imprecise abort.
Quoted 6 lines
Regards
PratyushQuoted 3 lines
Quoted 3 lines
return 0;}
I'm sort of dubious about imx6q_pcie_abort_handler() to begin with -- it seems like it assumes that imprecise aborts are either enabled or disabled. Isn't there some way it can *check* whether that's the case, so it won't break if those aborts are enabled at a different point in the future?
For now, I'll apply this to my pci/host-imx6 branch for v3.13, but let me know if you want to tweak it somehow.
Bjorn
PATCH 1/1 PCI: imx6: fix imprecise abort handler
Dear Bjorn Helgaas,
Quoted 74 lines
On Mon, Oct 21, 2013 at 2:16 AM, Pratyush Anand
Quoted 71 lines · <[email protected]> wrote:
Hi,
Quoted 5 lines · Marek Vasut
Dear Tim Harvey,
Quoted 3 lines
An imprecise abort is triggered when a port behind a switch is accessed and no device is present. At enumeration, imprecise aborts are not enabled
I do not know the complete history. But I do not understand, why imprecise aborts are not enabled during kernel enumeration. What happens when PCIe switch is already connected before boot?
pci_common_initwill try to read vendor/product ID for a non-existing function during kernel enumeration itself, which should result in imprecise external abort. In fact, I had observed with my system that if a switch is connected to PCIe RC, then abort occurs during kernel initialization itself. So a proper handling was needed. We calledhook_fault_codefrom
asubsys_initpcie_init(or similar) function, which insured that abort handler is called whenever, software tries to read vendor/product id of a non-existing functionQuoted 30 lines
Quoted 11 lines
thus this ends up getting deferred until the kernel has completed init. At
that point we must not adjust PC - the handler must do nothing, but a handler must exist.This fixes random crashes that occur right after freeing init. This is against linux-pci/host-imx6.
Acked-by Marek Vasut <[email protected]>Tested-by Marek Vasut <[email protected]>Signed-off-by Tim Harvey <[email protected]>Expanding CC a bit, let's have more eyes on this.
Quoted 16 lines
---
drivers/pci/host/pci-imx6.c | 6 ------ 1 file changed, 6 deletions(-)drivers/pci/host/pci-imx6.c +0
-0@@ -200,12 +200,6 @@ static int pcie_phy_write(void __iomem *dbi_base,int
addr, int data) static int imx6q_pcie_abort_handler(unsigned long addr,unsigned int fsr, struct
pt_regs*regs)Quoted 8 lines
drivers/pci/host/pci-imx6.c static int pcie_phy_write(void __iomem *dbi_base, int addr, int data) · line 208
Quoted 8 lines
{
drivers/pci/host/pci-imx6.c +0
-6-/* -* If it was an imprecise abort, then we need to correct the -* return address to be _after_ the instruction. -*/ -if (fsr & (1 <<10 )) - regs->ARM_pc +=4 ;Just for knowledge, is there any case other than read of IDs which might cause imprecise abort? If not, then this handler can be modified a bit to insure
that it does not handle any unintended imprecise abort.Regards
PratyushQuoted 2 lines
Quoted 2 lines
return 0;
Quoted 7 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
}
I'm sort of dubious about
imx6q_pcie_abort_handler()to begin with -- it seems like it assumes that imprecise aborts are either enabled or disabled. Isn't there some way it can *check* whether that's the case, so it won't break if those aborts are enabled at a different point in the future?
The best way here would be to find a way to prevent the DWC controller from generating data abort on missing device _at_all_ and just make the read from that portion of config space be 0xffffffff or zeroes . I didn't find any configuration bit that would be able to do it though :( Richard, can you maybe check with FSL if such an option exists on the controller?
Quoted 4 lines
For now, I'll apply this to my pci/host-imx6 branch for v3.13, but let me know if you want to tweak it somehow.
Bjorn
PATCH 1/1 PCI: imx6: fix imprecise abort handler
Hi Marek:
Quoted 91 lines
-----Original Message-----
From: Marek Vasut [mailto:marex at denx.de]
Sent: Wednesday, October 30, 2013 10:55 PM
To: Bjorn Helgaas
Cc: Pratyush Anand; Tim Harvey; linux-pci at vger.kernel.org; linux-arm- kernel at lists.infradead.org; Sascha Hauer; Zhu Richard-R65037; Shawn Guo; Jingoo Han; Pratyush Anand; Troy Kisky
Subject: Re: [PATCH] PCI: imx6: fix imprecise abort handlerDear Bjorn Helgaas,
Quoted 72 lines
On Mon, Oct 21, 2013 at 2:16 AM, Pratyush Anand
Quoted 69 lines · <[email protected]> wrote:
Hi,
Quoted 5 lines · Marek Vasut
Dear Tim Harvey,
Quoted 3 lines
An imprecise abort is triggered when a port behind a switch is accessed and no device is present. At enumeration, imprecise aborts are not enabled
I do not know the complete history. But I do not understand, why imprecise aborts are not enabled during kernel enumeration. What happens when PCIe switch is already connected before boot?
pci_common_initwill try to read vendor/product ID for a non-existing function during kernel enumeration itself, which should result in imprecise external abort. In fact, I had observed with my system that if a switch is connected to PCIe RC, then abort occurs during kernel initialization itself. So a proper handling was needed. We calledhook_fault_codefrom asubsys_initpcie_init(or similar) function, which insured that abort handler is called whenever, software tries to read vendor/product id of a non-existing functionQuoted 28 lines
Quoted 10 lines
thus this ends up getting deferred until the kernel has completed init. At that point we must not adjust PC - the handler must do nothing, but a handler must exist.
This fixes random crashes that occur right after freeing init. This is against linux-pci/host-imx6.
Acked-by Marek Vasut <[email protected]>Tested-by Marek Vasut <[email protected]>Signed-off-by Tim Harvey <[email protected]>Expanding CC a bit, let's have more eyes on this.
Quoted 15 lines
---
drivers/pci/host/pci-imx6.c | 6 ------ 1 file changed, 6 deletions(-)(quoted diff) +0
-0
b/drivers/pci/host/pci-imx6.cindex 966bac6..90fce05 100644drivers/pci/host/pci-imx6.c +0
-0@@ -200,12 +200,6 @@ static int pcie_phy_write(void __iomem *dbi_base, int addr, int data) static intimx6q_pcie_abort_handler (unsigned long addr,unsigned int fsr,struct pt_regs *regs)Quoted 8 lines
drivers/pci/host/pci-imx6.c static int pcie_phy_write(void __iomem *dbi_base, int addr, int data) · line 208
Quoted 8 lines
drivers/pci/host/pci-imx6.c +0
-6{ -/* -* If it was an imprecise abort, then we need to correct the -* return address to be _after_ the instruction. -*/ -if (fsr & (1 <<10 )) - regs->ARM_pc +=4 ;Just for knowledge, is there any case other than read of IDs which might cause imprecise abort? If not, then this handler can be modified a bit to insure that it does not handle any unintended imprecise abort.
Regards
PratyushQuoted 2 lines
Quoted 2 lines
return 0;Quoted 7 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
}
I'm sort of dubious about
imx6q_pcie_abort_handler()to begin with -- it seems like it assumes that imprecise aborts are either enabled or disabled. Isn't there some way it can *check* whether that's the case, so it won't break if those aborts are enabled at a different point in the future?
Quoted 6 lines
The best way here would be to find a way to prevent the DWC controller from generating data abort on missing device _at_all_ and just make the read from that portion of config space be
0xffffffffor zeroes . I didn't find any configuration bit that would be able to do it though :( Richard, can you maybe check with FSL if such an option exists on the controller?
[Richard] Unfortunately, discussed with IC guys, there is no such kind of mechanism.
Quoted 4 lines
Quoted 4 lines
For now, I'll apply this to my pci/host-imx6 branch for v3.13, but let me know if you want to tweak it somehow.
Bjorn
PATCH 1/1 PCI: imx6: fix imprecise abort handler
Hi Richard,
[...]
Quoted 13 lines
Quoted 6 lines
Quoted 5 lines
I'm sort of dubious about
imx6q_pcie_abort_handler()to begin with -- it seems like it assumes that imprecise aborts are either enabled or disabled. Isn't there some way it can *check* whether that's the case, so it won't break if those aborts are enabled at a different point in the future?Quoted 6 lines
The best way here would be to find a way to prevent the DWC controller from generating data abort on missing device _at_all_ and just make the read from that portion of config space be
0xffffffffor zeroes . I didn't find any configuration bit that would be able to do it though :( Richard, can you maybe check with FSL if such an option exists on the controller?
Quoted 2 lines
[Richard] Unfortunately, discussed with IC guys, there is no such kind of mechanism.
Do you know or can you please check if there's at least some mechanism to detect whether the data abort was generated by the DWC PCIe or something else ?
Best regards,
Marek Vasut