Thomas Gleixner | 3b20eb2 | 2019-05-29 16:57:35 -0700 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0-only |
Dan Williams | 588ef76 | 2007-02-13 17:12:04 +0100 | [diff] [blame] | 2 | /* |
| 3 | * IOP Coprocessor-6 access handler |
| 4 | * Copyright (c) 2006, Intel Corporation. |
Dan Williams | 588ef76 | 2007-02-13 17:12:04 +0100 | [diff] [blame] | 5 | */ |
| 6 | #include <linux/init.h> |
| 7 | #include <asm/traps.h> |
Linus Walleij | 082763a | 2011-06-20 08:13:00 +0100 | [diff] [blame] | 8 | #include <asm/ptrace.h> |
Dan Williams | 588ef76 | 2007-02-13 17:12:04 +0100 | [diff] [blame] | 9 | |
| 10 | static int cp6_trap(struct pt_regs *regs, unsigned int instr) |
| 11 | { |
| 12 | u32 temp; |
| 13 | |
| 14 | /* enable cp6 access */ |
| 15 | asm volatile ( |
| 16 | "mrc p15, 0, %0, c15, c1, 0\n\t" |
| 17 | "orr %0, %0, #(1 << 6)\n\t" |
| 18 | "mcr p15, 0, %0, c15, c1, 0\n\t" |
| 19 | : "=r"(temp)); |
| 20 | |
| 21 | return 0; |
| 22 | } |
| 23 | |
| 24 | /* permit kernel space cp6 access |
| 25 | * deny user space cp6 access |
| 26 | */ |
| 27 | static struct undef_hook cp6_hook = { |
| 28 | .instr_mask = 0x0f000ff0, |
| 29 | .instr_val = 0x0e000610, |
| 30 | .cpsr_mask = MODE_MASK, |
| 31 | .cpsr_val = SVC_MODE, |
| 32 | .fn = cp6_trap, |
| 33 | }; |
| 34 | |
| 35 | void __init iop_init_cp6_handler(void) |
| 36 | { |
| 37 | register_undef_hook(&cp6_hook); |
| 38 | } |