045-ARM-BCM5301X-Add-back-handler-ignoring-external-impr.patch 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. From 09f3510fb70a46c8921f2cf4a90dbcae460a6820 Mon Sep 17 00:00:00 2001
  2. From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl>
  3. Date: Sat, 29 Oct 2016 13:12:29 +0200
  4. Subject: [PATCH] ARM: BCM5301X: Add back handler ignoring external imprecise
  5. aborts
  6. MIME-Version: 1.0
  7. Content-Type: text/plain; charset=UTF-8
  8. Content-Transfer-Encoding: 8bit
  9. Since early BCM5301X days we got abort handler that was removed by
  10. commit 937b12306ea79 ("ARM: BCM5301X: remove workaround imprecise abort
  11. fault handler"). It assumed we need to deal only with pending aborts
  12. left by the bootloader. Unfortunately this isn't true for BCM5301X.
  13. When probing PCI config space (device enumeration) it is expected to
  14. have master aborts on the PCI bus. Most bridges don't forward (or they
  15. allow disabling it) these errors onto the AXI/AMBA bus but not the
  16. Northstar (BCM5301X) one.
  17. iProc PCIe controller on Northstar seems to be some older one, without
  18. a control register for errors forwarding. It means we need to workaround
  19. this at platform level. All newer platforms are not affected by this
  20. issue.
  21. Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
  22. Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
  23. ---
  24. arch/arm/mach-bcm/bcm_5301x.c | 28 ++++++++++++++++++++++++++++
  25. 1 file changed, 28 insertions(+)
  26. --- a/arch/arm/mach-bcm/bcm_5301x.c
  27. +++ b/arch/arm/mach-bcm/bcm_5301x.c
  28. @@ -9,14 +9,42 @@
  29. #include <asm/hardware/cache-l2x0.h>
  30. #include <asm/mach/arch.h>
  31. +#include <asm/siginfo.h>
  32. +#include <asm/signal.h>
  33. +
  34. +#define FSR_EXTERNAL (1 << 12)
  35. +#define FSR_READ (0 << 10)
  36. +#define FSR_IMPRECISE 0x0406
  37. static const char *const bcm5301x_dt_compat[] __initconst = {
  38. "brcm,bcm4708",
  39. NULL,
  40. };
  41. +static int bcm5301x_abort_handler(unsigned long addr, unsigned int fsr,
  42. + struct pt_regs *regs)
  43. +{
  44. + /*
  45. + * We want to ignore aborts forwarded from the PCIe bus that are
  46. + * expected and shouldn't really be passed by the PCIe controller.
  47. + * The biggest disadvantage is the same FSR code may be reported when
  48. + * reading non-existing APB register and we shouldn't ignore that.
  49. + */
  50. + if (fsr == (FSR_EXTERNAL | FSR_READ | FSR_IMPRECISE))
  51. + return 0;
  52. +
  53. + return 1;
  54. +}
  55. +
  56. +static void __init bcm5301x_init_early(void)
  57. +{
  58. + hook_fault_code(16 + 6, bcm5301x_abort_handler, SIGBUS, BUS_OBJERR,
  59. + "imprecise external abort");
  60. +}
  61. +
  62. DT_MACHINE_START(BCM5301X, "BCM5301X")
  63. .l2c_aux_val = 0,
  64. .l2c_aux_mask = ~0,
  65. .dt_compat = bcm5301x_dt_compat,
  66. + .init_early = bcm5301x_init_early,
  67. MACHINE_END