armv8_deprecated.c 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662
  1. /*
  2. * Copyright (C) 2014 ARM Limited
  3. *
  4. * This program is free software; you can redistribute it and/or modify
  5. * it under the terms of the GNU General Public License version 2 as
  6. * published by the Free Software Foundation.
  7. */
  8. #include <linux/cpu.h>
  9. #include <linux/init.h>
  10. #include <linux/list.h>
  11. #include <linux/perf_event.h>
  12. #include <linux/sched.h>
  13. #include <linux/slab.h>
  14. #include <linux/sysctl.h>
  15. #include <asm/alternative.h>
  16. #include <asm/cpufeature.h>
  17. #include <asm/insn.h>
  18. #include <asm/opcodes.h>
  19. #include <asm/sysreg.h>
  20. #include <asm/system_misc.h>
  21. #include <asm/traps.h>
  22. #include <asm/uaccess.h>
  23. #include <asm/cpufeature.h>
  24. #define CREATE_TRACE_POINTS
  25. #include "trace-events-emulation.h"
  26. /*
  27. * The runtime support for deprecated instruction support can be in one of
  28. * following three states -
  29. *
  30. * 0 = undef
  31. * 1 = emulate (software emulation)
  32. * 2 = hw (supported in hardware)
  33. */
  34. enum insn_emulation_mode {
  35. INSN_UNDEF,
  36. INSN_EMULATE,
  37. INSN_HW,
  38. };
  39. enum legacy_insn_status {
  40. INSN_DEPRECATED,
  41. INSN_OBSOLETE,
  42. };
  43. struct insn_emulation_ops {
  44. const char *name;
  45. enum legacy_insn_status status;
  46. struct undef_hook *hooks;
  47. int (*set_hw_mode)(bool enable);
  48. };
  49. struct insn_emulation {
  50. struct list_head node;
  51. struct insn_emulation_ops *ops;
  52. int current_mode;
  53. int min;
  54. int max;
  55. };
  56. static LIST_HEAD(insn_emulation);
  57. static int nr_insn_emulated;
  58. static DEFINE_RAW_SPINLOCK(insn_emulation_lock);
  59. static void register_emulation_hooks(struct insn_emulation_ops *ops)
  60. {
  61. struct undef_hook *hook;
  62. BUG_ON(!ops->hooks);
  63. for (hook = ops->hooks; hook->instr_mask; hook++)
  64. register_undef_hook(hook);
  65. pr_notice("Registered %s emulation handler\n", ops->name);
  66. }
  67. static void remove_emulation_hooks(struct insn_emulation_ops *ops)
  68. {
  69. struct undef_hook *hook;
  70. BUG_ON(!ops->hooks);
  71. for (hook = ops->hooks; hook->instr_mask; hook++)
  72. unregister_undef_hook(hook);
  73. pr_notice("Removed %s emulation handler\n", ops->name);
  74. }
  75. static void enable_insn_hw_mode(void *data)
  76. {
  77. struct insn_emulation *insn = (struct insn_emulation *)data;
  78. if (insn->ops->set_hw_mode)
  79. insn->ops->set_hw_mode(true);
  80. }
  81. static void disable_insn_hw_mode(void *data)
  82. {
  83. struct insn_emulation *insn = (struct insn_emulation *)data;
  84. if (insn->ops->set_hw_mode)
  85. insn->ops->set_hw_mode(false);
  86. }
  87. /* Run set_hw_mode(mode) on all active CPUs */
  88. static int run_all_cpu_set_hw_mode(struct insn_emulation *insn, bool enable)
  89. {
  90. if (!insn->ops->set_hw_mode)
  91. return -EINVAL;
  92. if (enable)
  93. on_each_cpu(enable_insn_hw_mode, (void *)insn, true);
  94. else
  95. on_each_cpu(disable_insn_hw_mode, (void *)insn, true);
  96. return 0;
  97. }
  98. /*
  99. * Run set_hw_mode for all insns on a starting CPU.
  100. * Returns:
  101. * 0 - If all the hooks ran successfully.
  102. * -EINVAL - At least one hook is not supported by the CPU.
  103. */
  104. static int run_all_insn_set_hw_mode(unsigned long cpu)
  105. {
  106. int rc = 0;
  107. unsigned long flags;
  108. struct insn_emulation *insn;
  109. raw_spin_lock_irqsave(&insn_emulation_lock, flags);
  110. list_for_each_entry(insn, &insn_emulation, node) {
  111. bool enable = (insn->current_mode == INSN_HW);
  112. if (insn->ops->set_hw_mode && insn->ops->set_hw_mode(enable)) {
  113. pr_warn("CPU[%ld] cannot support the emulation of %s",
  114. cpu, insn->ops->name);
  115. rc = -EINVAL;
  116. }
  117. }
  118. raw_spin_unlock_irqrestore(&insn_emulation_lock, flags);
  119. return rc;
  120. }
  121. static int update_insn_emulation_mode(struct insn_emulation *insn,
  122. enum insn_emulation_mode prev)
  123. {
  124. int ret = 0;
  125. switch (prev) {
  126. case INSN_UNDEF: /* Nothing to be done */
  127. break;
  128. case INSN_EMULATE:
  129. remove_emulation_hooks(insn->ops);
  130. break;
  131. case INSN_HW:
  132. if (!run_all_cpu_set_hw_mode(insn, false))
  133. pr_notice("Disabled %s support\n", insn->ops->name);
  134. break;
  135. }
  136. switch (insn->current_mode) {
  137. case INSN_UNDEF:
  138. break;
  139. case INSN_EMULATE:
  140. register_emulation_hooks(insn->ops);
  141. break;
  142. case INSN_HW:
  143. ret = run_all_cpu_set_hw_mode(insn, true);
  144. if (!ret)
  145. pr_notice("Enabled %s support\n", insn->ops->name);
  146. break;
  147. }
  148. return ret;
  149. }
  150. static void register_insn_emulation(struct insn_emulation_ops *ops)
  151. {
  152. unsigned long flags;
  153. struct insn_emulation *insn;
  154. insn = kzalloc(sizeof(*insn), GFP_KERNEL);
  155. insn->ops = ops;
  156. insn->min = INSN_UNDEF;
  157. switch (ops->status) {
  158. case INSN_DEPRECATED:
  159. insn->current_mode = INSN_EMULATE;
  160. /* Disable the HW mode if it was turned on at early boot time */
  161. run_all_cpu_set_hw_mode(insn, false);
  162. insn->max = INSN_HW;
  163. break;
  164. case INSN_OBSOLETE:
  165. insn->current_mode = INSN_UNDEF;
  166. insn->max = INSN_EMULATE;
  167. break;
  168. }
  169. raw_spin_lock_irqsave(&insn_emulation_lock, flags);
  170. list_add(&insn->node, &insn_emulation);
  171. nr_insn_emulated++;
  172. raw_spin_unlock_irqrestore(&insn_emulation_lock, flags);
  173. /* Register any handlers if required */
  174. update_insn_emulation_mode(insn, INSN_UNDEF);
  175. }
  176. static int emulation_proc_handler(struct ctl_table *table, int write,
  177. void __user *buffer, size_t *lenp,
  178. loff_t *ppos)
  179. {
  180. int ret = 0;
  181. struct insn_emulation *insn = (struct insn_emulation *) table->data;
  182. enum insn_emulation_mode prev_mode = insn->current_mode;
  183. table->data = &insn->current_mode;
  184. ret = proc_dointvec_minmax(table, write, buffer, lenp, ppos);
  185. if (ret || !write || prev_mode == insn->current_mode)
  186. goto ret;
  187. ret = update_insn_emulation_mode(insn, prev_mode);
  188. if (ret) {
  189. /* Mode change failed, revert to previous mode. */
  190. insn->current_mode = prev_mode;
  191. update_insn_emulation_mode(insn, INSN_UNDEF);
  192. }
  193. ret:
  194. table->data = insn;
  195. return ret;
  196. }
  197. static struct ctl_table ctl_abi[] = {
  198. {
  199. .procname = "abi",
  200. .mode = 0555,
  201. },
  202. { }
  203. };
  204. static void register_insn_emulation_sysctl(struct ctl_table *table)
  205. {
  206. unsigned long flags;
  207. int i = 0;
  208. struct insn_emulation *insn;
  209. struct ctl_table *insns_sysctl, *sysctl;
  210. insns_sysctl = kzalloc(sizeof(*sysctl) * (nr_insn_emulated + 1),
  211. GFP_KERNEL);
  212. raw_spin_lock_irqsave(&insn_emulation_lock, flags);
  213. list_for_each_entry(insn, &insn_emulation, node) {
  214. sysctl = &insns_sysctl[i];
  215. sysctl->mode = 0644;
  216. sysctl->maxlen = sizeof(int);
  217. sysctl->procname = insn->ops->name;
  218. sysctl->data = insn;
  219. sysctl->extra1 = &insn->min;
  220. sysctl->extra2 = &insn->max;
  221. sysctl->proc_handler = emulation_proc_handler;
  222. i++;
  223. }
  224. raw_spin_unlock_irqrestore(&insn_emulation_lock, flags);
  225. table->child = insns_sysctl;
  226. register_sysctl_table(table);
  227. }
  228. /*
  229. * Implement emulation of the SWP/SWPB instructions using load-exclusive and
  230. * store-exclusive.
  231. *
  232. * Syntax of SWP{B} instruction: SWP{B}<c> <Rt>, <Rt2>, [<Rn>]
  233. * Where: Rt = destination
  234. * Rt2 = source
  235. * Rn = address
  236. */
  237. /*
  238. * Error-checking SWP macros implemented using ldxr{b}/stxr{b}
  239. */
  240. #define __user_swpX_asm(data, addr, res, temp, B) \
  241. __asm__ __volatile__( \
  242. ALTERNATIVE("nop", SET_PSTATE_PAN(0), ARM64_HAS_PAN, \
  243. CONFIG_ARM64_PAN) \
  244. "0: ldxr"B" %w2, [%3]\n" \
  245. "1: stxr"B" %w0, %w1, [%3]\n" \
  246. " cbz %w0, 2f\n" \
  247. " mov %w0, %w4\n" \
  248. " b 3f\n" \
  249. "2:\n" \
  250. " mov %w1, %w2\n" \
  251. "3:\n" \
  252. " .pushsection .fixup,\"ax\"\n" \
  253. " .align 2\n" \
  254. "4: mov %w0, %w5\n" \
  255. " b 3b\n" \
  256. " .popsection" \
  257. " .pushsection __ex_table,\"a\"\n" \
  258. " .align 3\n" \
  259. " .quad 0b, 4b\n" \
  260. " .quad 1b, 4b\n" \
  261. " .popsection\n" \
  262. ALTERNATIVE("nop", SET_PSTATE_PAN(1), ARM64_HAS_PAN, \
  263. CONFIG_ARM64_PAN) \
  264. : "=&r" (res), "+r" (data), "=&r" (temp) \
  265. : "r" ((unsigned long)addr), "i" (-EAGAIN), \
  266. "i" (-EFAULT) \
  267. : "memory")
  268. #define __user_swp_asm(data, addr, res, temp) \
  269. __user_swpX_asm(data, addr, res, temp, "")
  270. #define __user_swpb_asm(data, addr, res, temp) \
  271. __user_swpX_asm(data, addr, res, temp, "b")
  272. /*
  273. * Bit 22 of the instruction encoding distinguishes between
  274. * the SWP and SWPB variants (bit set means SWPB).
  275. */
  276. #define TYPE_SWPB (1 << 22)
  277. /*
  278. * Set up process info to signal segmentation fault - called on access error.
  279. */
  280. static void set_segfault(struct pt_regs *regs, unsigned long addr)
  281. {
  282. siginfo_t info;
  283. down_read(&current->mm->mmap_sem);
  284. if (find_vma(current->mm, addr) == NULL)
  285. info.si_code = SEGV_MAPERR;
  286. else
  287. info.si_code = SEGV_ACCERR;
  288. up_read(&current->mm->mmap_sem);
  289. info.si_signo = SIGSEGV;
  290. info.si_errno = 0;
  291. info.si_addr = (void *) instruction_pointer(regs);
  292. pr_debug("SWP{B} emulation: access caused memory abort!\n");
  293. arm64_notify_die("Illegal memory access", regs, &info, 0);
  294. }
  295. static int emulate_swpX(unsigned int address, unsigned int *data,
  296. unsigned int type)
  297. {
  298. unsigned int res = 0;
  299. if ((type != TYPE_SWPB) && (address & 0x3)) {
  300. /* SWP to unaligned address not permitted */
  301. pr_debug("SWP instruction on unaligned pointer!\n");
  302. return -EFAULT;
  303. }
  304. while (1) {
  305. unsigned long temp;
  306. if (type == TYPE_SWPB)
  307. __user_swpb_asm(*data, address, res, temp);
  308. else
  309. __user_swp_asm(*data, address, res, temp);
  310. if (likely(res != -EAGAIN) || signal_pending(current))
  311. break;
  312. cond_resched();
  313. }
  314. return res;
  315. }
  316. /*
  317. * swp_handler logs the id of calling process, dissects the instruction, sanity
  318. * checks the memory location, calls emulate_swpX for the actual operation and
  319. * deals with fixup/error handling before returning
  320. */
  321. static int swp_handler(struct pt_regs *regs, u32 instr)
  322. {
  323. u32 destreg, data, type, address = 0;
  324. int rn, rt2, res = 0;
  325. perf_sw_event(PERF_COUNT_SW_EMULATION_FAULTS, 1, regs, regs->pc);
  326. type = instr & TYPE_SWPB;
  327. switch (arm_check_condition(instr, regs->pstate)) {
  328. case ARM_OPCODE_CONDTEST_PASS:
  329. break;
  330. case ARM_OPCODE_CONDTEST_FAIL:
  331. /* Condition failed - return to next instruction */
  332. goto ret;
  333. case ARM_OPCODE_CONDTEST_UNCOND:
  334. /* If unconditional encoding - not a SWP, undef */
  335. return -EFAULT;
  336. default:
  337. return -EINVAL;
  338. }
  339. rn = aarch32_insn_extract_reg_num(instr, A32_RN_OFFSET);
  340. rt2 = aarch32_insn_extract_reg_num(instr, A32_RT2_OFFSET);
  341. address = (u32)regs->user_regs.regs[rn];
  342. data = (u32)regs->user_regs.regs[rt2];
  343. destreg = aarch32_insn_extract_reg_num(instr, A32_RT_OFFSET);
  344. pr_debug("addr in r%d->0x%08x, dest is r%d, source in r%d->0x%08x)\n",
  345. rn, address, destreg,
  346. aarch32_insn_extract_reg_num(instr, A32_RT2_OFFSET), data);
  347. /* Check access in reasonable access range for both SWP and SWPB */
  348. if (!access_ok(VERIFY_WRITE, (address & ~3), 4)) {
  349. pr_debug("SWP{B} emulation: access to 0x%08x not allowed!\n",
  350. address);
  351. goto fault;
  352. }
  353. res = emulate_swpX(address, &data, type);
  354. if (res == -EFAULT)
  355. goto fault;
  356. else if (res == 0)
  357. regs->user_regs.regs[destreg] = data;
  358. ret:
  359. if (type == TYPE_SWPB)
  360. trace_instruction_emulation("swpb", regs->pc);
  361. else
  362. trace_instruction_emulation("swp", regs->pc);
  363. pr_warn_ratelimited("\"%s\" (%ld) uses obsolete SWP{B} instruction at 0x%llx\n",
  364. current->comm, (unsigned long)current->pid, regs->pc);
  365. regs->pc += 4;
  366. return 0;
  367. fault:
  368. set_segfault(regs, address);
  369. return 0;
  370. }
  371. /*
  372. * Only emulate SWP/SWPB executed in ARM state/User mode.
  373. * The kernel must be SWP free and SWP{B} does not exist in Thumb.
  374. */
  375. static struct undef_hook swp_hooks[] = {
  376. {
  377. .instr_mask = 0x0fb00ff0,
  378. .instr_val = 0x01000090,
  379. .pstate_mask = COMPAT_PSR_MODE_MASK,
  380. .pstate_val = COMPAT_PSR_MODE_USR,
  381. .fn = swp_handler
  382. },
  383. { }
  384. };
  385. static struct insn_emulation_ops swp_ops = {
  386. .name = "swp",
  387. .status = INSN_OBSOLETE,
  388. .hooks = swp_hooks,
  389. .set_hw_mode = NULL,
  390. };
  391. static int cp15barrier_handler(struct pt_regs *regs, u32 instr)
  392. {
  393. perf_sw_event(PERF_COUNT_SW_EMULATION_FAULTS, 1, regs, regs->pc);
  394. switch (arm_check_condition(instr, regs->pstate)) {
  395. case ARM_OPCODE_CONDTEST_PASS:
  396. break;
  397. case ARM_OPCODE_CONDTEST_FAIL:
  398. /* Condition failed - return to next instruction */
  399. goto ret;
  400. case ARM_OPCODE_CONDTEST_UNCOND:
  401. /* If unconditional encoding - not a barrier instruction */
  402. return -EFAULT;
  403. default:
  404. return -EINVAL;
  405. }
  406. switch (aarch32_insn_mcr_extract_crm(instr)) {
  407. case 10:
  408. /*
  409. * dmb - mcr p15, 0, Rt, c7, c10, 5
  410. * dsb - mcr p15, 0, Rt, c7, c10, 4
  411. */
  412. if (aarch32_insn_mcr_extract_opc2(instr) == 5) {
  413. dmb(sy);
  414. trace_instruction_emulation(
  415. "mcr p15, 0, Rt, c7, c10, 5 ; dmb", regs->pc);
  416. } else {
  417. dsb(sy);
  418. trace_instruction_emulation(
  419. "mcr p15, 0, Rt, c7, c10, 4 ; dsb", regs->pc);
  420. }
  421. break;
  422. case 5:
  423. /*
  424. * isb - mcr p15, 0, Rt, c7, c5, 4
  425. *
  426. * Taking an exception or returning from one acts as an
  427. * instruction barrier. So no explicit barrier needed here.
  428. */
  429. trace_instruction_emulation(
  430. "mcr p15, 0, Rt, c7, c5, 4 ; isb", regs->pc);
  431. break;
  432. }
  433. ret:
  434. pr_warn_ratelimited("\"%s\" (%ld) uses deprecated CP15 Barrier instruction at 0x%llx\n",
  435. current->comm, (unsigned long)current->pid, regs->pc);
  436. regs->pc += 4;
  437. return 0;
  438. }
  439. static int cp15_barrier_set_hw_mode(bool enable)
  440. {
  441. if (enable)
  442. config_sctlr_el1(0, SCTLR_EL1_CP15BEN);
  443. else
  444. config_sctlr_el1(SCTLR_EL1_CP15BEN, 0);
  445. return 0;
  446. }
  447. static struct undef_hook cp15_barrier_hooks[] = {
  448. {
  449. .instr_mask = 0x0fff0fdf,
  450. .instr_val = 0x0e070f9a,
  451. .pstate_mask = COMPAT_PSR_MODE_MASK,
  452. .pstate_val = COMPAT_PSR_MODE_USR,
  453. .fn = cp15barrier_handler,
  454. },
  455. {
  456. .instr_mask = 0x0fff0fff,
  457. .instr_val = 0x0e070f95,
  458. .pstate_mask = COMPAT_PSR_MODE_MASK,
  459. .pstate_val = COMPAT_PSR_MODE_USR,
  460. .fn = cp15barrier_handler,
  461. },
  462. { }
  463. };
  464. static struct insn_emulation_ops cp15_barrier_ops = {
  465. .name = "cp15_barrier",
  466. .status = INSN_DEPRECATED,
  467. .hooks = cp15_barrier_hooks,
  468. .set_hw_mode = cp15_barrier_set_hw_mode,
  469. };
  470. static int setend_set_hw_mode(bool enable)
  471. {
  472. if (!cpu_supports_mixed_endian_el0())
  473. return -EINVAL;
  474. if (enable)
  475. config_sctlr_el1(SCTLR_EL1_SED, 0);
  476. else
  477. config_sctlr_el1(0, SCTLR_EL1_SED);
  478. return 0;
  479. }
  480. static int compat_setend_handler(struct pt_regs *regs, u32 big_endian)
  481. {
  482. char *insn;
  483. perf_sw_event(PERF_COUNT_SW_EMULATION_FAULTS, 1, regs, regs->pc);
  484. if (big_endian) {
  485. insn = "setend be";
  486. regs->pstate |= COMPAT_PSR_E_BIT;
  487. } else {
  488. insn = "setend le";
  489. regs->pstate &= ~COMPAT_PSR_E_BIT;
  490. }
  491. trace_instruction_emulation(insn, regs->pc);
  492. pr_warn_ratelimited("\"%s\" (%ld) uses deprecated setend instruction at 0x%llx\n",
  493. current->comm, (unsigned long)current->pid, regs->pc);
  494. return 0;
  495. }
  496. static int a32_setend_handler(struct pt_regs *regs, u32 instr)
  497. {
  498. int rc = compat_setend_handler(regs, (instr >> 9) & 1);
  499. regs->pc += 4;
  500. return rc;
  501. }
  502. static int t16_setend_handler(struct pt_regs *regs, u32 instr)
  503. {
  504. int rc = compat_setend_handler(regs, (instr >> 3) & 1);
  505. regs->pc += 2;
  506. return rc;
  507. }
  508. static struct undef_hook setend_hooks[] = {
  509. {
  510. .instr_mask = 0xfffffdff,
  511. .instr_val = 0xf1010000,
  512. .pstate_mask = COMPAT_PSR_MODE_MASK,
  513. .pstate_val = COMPAT_PSR_MODE_USR,
  514. .fn = a32_setend_handler,
  515. },
  516. {
  517. /* Thumb mode */
  518. .instr_mask = 0x0000fff7,
  519. .instr_val = 0x0000b650,
  520. .pstate_mask = (COMPAT_PSR_T_BIT | COMPAT_PSR_MODE_MASK),
  521. .pstate_val = (COMPAT_PSR_T_BIT | COMPAT_PSR_MODE_USR),
  522. .fn = t16_setend_handler,
  523. },
  524. {}
  525. };
  526. static struct insn_emulation_ops setend_ops = {
  527. .name = "setend",
  528. .status = INSN_DEPRECATED,
  529. .hooks = setend_hooks,
  530. .set_hw_mode = setend_set_hw_mode,
  531. };
  532. static int insn_cpu_hotplug_notify(struct notifier_block *b,
  533. unsigned long action, void *hcpu)
  534. {
  535. int rc = 0;
  536. if ((action & ~CPU_TASKS_FROZEN) == CPU_STARTING)
  537. rc = run_all_insn_set_hw_mode((unsigned long)hcpu);
  538. return notifier_from_errno(rc);
  539. }
  540. static struct notifier_block insn_cpu_hotplug_notifier = {
  541. .notifier_call = insn_cpu_hotplug_notify,
  542. };
  543. /*
  544. * Invoked as late_initcall, since not needed before init spawned.
  545. */
  546. static int __init armv8_deprecated_init(void)
  547. {
  548. if (IS_ENABLED(CONFIG_SWP_EMULATION))
  549. register_insn_emulation(&swp_ops);
  550. if (IS_ENABLED(CONFIG_CP15_BARRIER_EMULATION))
  551. register_insn_emulation(&cp15_barrier_ops);
  552. if (IS_ENABLED(CONFIG_SETEND_EMULATION)) {
  553. if(system_supports_mixed_endian_el0())
  554. register_insn_emulation(&setend_ops);
  555. else
  556. pr_info("setend instruction emulation is not supported on the system");
  557. }
  558. register_cpu_notifier(&insn_cpu_hotplug_notifier);
  559. register_insn_emulation_sysctl(ctl_abi);
  560. return 0;
  561. }
  562. late_initcall(armv8_deprecated_init);