~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/arch/riscv/errata/andes/errata.c

Version: ~ [ linux-6.11-rc3 ] ~ [ linux-6.10.4 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.45 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.104 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.164 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.223 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.281 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.319 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.9 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 // SPDX-License-Identifier: GPL-2.0-only
  2 /*
  3  * Erratas to be applied for Andes CPU cores
  4  *
  5  *  Copyright (C) 2023 Renesas Electronics Corporation.
  6  *
  7  * Author: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
  8  */
  9 
 10 #include <linux/memory.h>
 11 #include <linux/module.h>
 12 
 13 #include <asm/alternative.h>
 14 #include <asm/cacheflush.h>
 15 #include <asm/errata_list.h>
 16 #include <asm/patch.h>
 17 #include <asm/processor.h>
 18 #include <asm/sbi.h>
 19 #include <asm/vendorid_list.h>
 20 #include <asm/vendor_extensions.h>
 21 
 22 #define ANDES_AX45MP_MARCHID            0x8000000000008a45UL
 23 #define ANDES_AX45MP_MIMPID             0x500UL
 24 #define ANDES_SBI_EXT_ANDES             0x0900031E
 25 
 26 #define ANDES_SBI_EXT_IOCP_SW_WORKAROUND        1
 27 
 28 static long ax45mp_iocp_sw_workaround(void)
 29 {
 30         struct sbiret ret;
 31 
 32         /*
 33          * ANDES_SBI_EXT_IOCP_SW_WORKAROUND SBI EXT checks if the IOCP is missing and
 34          * cache is controllable only then CMO will be applied to the platform.
 35          */
 36         ret = sbi_ecall(ANDES_SBI_EXT_ANDES, ANDES_SBI_EXT_IOCP_SW_WORKAROUND,
 37                         0, 0, 0, 0, 0, 0);
 38 
 39         return ret.error ? 0 : ret.value;
 40 }
 41 
 42 static void errata_probe_iocp(unsigned int stage, unsigned long arch_id, unsigned long impid)
 43 {
 44         static bool done;
 45 
 46         if (!IS_ENABLED(CONFIG_ERRATA_ANDES_CMO))
 47                 return;
 48 
 49         if (done)
 50                 return;
 51 
 52         done = true;
 53 
 54         if (arch_id != ANDES_AX45MP_MARCHID || impid != ANDES_AX45MP_MIMPID)
 55                 return;
 56 
 57         if (!ax45mp_iocp_sw_workaround())
 58                 return;
 59 
 60         /* Set this just to make core cbo code happy */
 61         riscv_cbom_block_size = 1;
 62         riscv_noncoherent_supported();
 63 }
 64 
 65 void __init_or_module andes_errata_patch_func(struct alt_entry *begin, struct alt_entry *end,
 66                                               unsigned long archid, unsigned long impid,
 67                                               unsigned int stage)
 68 {
 69         BUILD_BUG_ON(ERRATA_ANDES_NUMBER >= RISCV_VENDOR_EXT_ALTERNATIVES_BASE);
 70 
 71         if (stage == RISCV_ALTERNATIVES_BOOT)
 72                 errata_probe_iocp(stage, archid, impid);
 73 
 74         /* we have nothing to patch here ATM so just return back */
 75 }
 76 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php