322-v6.11-mips-bmips-enable-RAC-on-BMIPS4350.patch 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. From 04f38d1a4db017f17e82442727b91ce03dd72759 Mon Sep 17 00:00:00 2001
  2. From: =?UTF-8?q?Daniel=20Gonz=C3=A1lez=20Cabanelas?= <[email protected]>
  3. Date: Thu, 20 Jun 2024 17:26:45 +0200
  4. Subject: [PATCH 4/4] mips: bmips: enable RAC on BMIPS4350
  5. MIME-Version: 1.0
  6. Content-Type: text/plain; charset=UTF-8
  7. Content-Transfer-Encoding: 8bit
  8. The data RAC is left disabled by the bootloader in some SoCs, at least in
  9. the core it boots from.
  10. Enabling this feature increases the performance up to +30% depending on the
  11. task.
  12. Signed-off-by: Daniel González Cabanelas <[email protected]>
  13. Signed-off-by: Álvaro Fernández Rojas <[email protected]>
  14. [ rework code and reduce code duplication ]
  15. Acked-by: Florian Fainelli <[email protected]>
  16. Signed-off-by: Christian Marangi <[email protected]>
  17. Signed-off-by: Thomas Bogendoerfer <[email protected]>
  18. ---
  19. arch/mips/kernel/smp-bmips.c | 18 ++++++++++++++++++
  20. 1 file changed, 18 insertions(+)
  21. --- a/arch/mips/kernel/smp-bmips.c
  22. +++ b/arch/mips/kernel/smp-bmips.c
  23. @@ -592,6 +592,7 @@ asmlinkage void __weak plat_wired_tlb_se
  24. void bmips_cpu_setup(void)
  25. {
  26. void __iomem __maybe_unused *cbr = bmips_cbr_addr;
  27. + u32 __maybe_unused rac_addr;
  28. u32 __maybe_unused cfg;
  29. switch (current_cpu_type()) {
  30. @@ -620,6 +621,23 @@ void bmips_cpu_setup(void)
  31. __raw_readl(cbr + BMIPS_RAC_ADDRESS_RANGE);
  32. break;
  33. + case CPU_BMIPS4350:
  34. + rac_addr = BMIPS_RAC_CONFIG_1;
  35. +
  36. + if (!(read_c0_brcm_cmt_local() & (1 << 31)))
  37. + rac_addr = BMIPS_RAC_CONFIG;
  38. +
  39. + /* Enable data RAC */
  40. + cfg = __raw_readl(cbr + rac_addr);
  41. + __raw_writel(cfg | 0xf, cbr + rac_addr);
  42. + __raw_readl(cbr + rac_addr);
  43. +
  44. + /* Flush stale data out of the readahead cache */
  45. + cfg = __raw_readl(cbr + BMIPS_RAC_CONFIG);
  46. + __raw_writel(cfg | 0x100, cbr + BMIPS_RAC_CONFIG);
  47. + __raw_readl(cbr + BMIPS_RAC_CONFIG);
  48. + break;
  49. +
  50. case CPU_BMIPS4380:
  51. /* CBG workaround for early BMIPS4380 CPUs */
  52. switch (read_c0_prid()) {