/* Setup Hyp vector base */
WRITE_SYSREG((vaddr_t)hyp_traps_vector, VBAR_EL2);
+ /* Trap all coprocessor registers (0-13) except cp10 and cp11 for VFP
+ * /!\ All processors except cp10 and cp11 cannot be used in Xen
+ */
+ WRITE_SYSREG((HCPTR_CP_MASK & ~(HCPTR_CP(10) | HCPTR_CP(11))) | HCPTR_TTA,
+ CPTR_EL2);
+
/* Setup hypervisor traps */
WRITE_SYSREG(HCR_PTW|HCR_BSU_INNER|HCR_AMO|HCR_IMO|HCR_VM|HCR_TWI|HCR_TSC|
HCR_TAC, HCR_EL2);
advance_pc(regs, hsr);
}
+static void do_cp(struct cpu_user_regs *regs, union hsr hsr)
+{
+ if ( !check_conditional_instr(regs, hsr) )
+ {
+ advance_pc(regs, hsr);
+ return;
+ }
+
+ inject_undef32_exception(regs);
+}
+
#ifdef CONFIG_ARM_64
static void do_sysreg(struct cpu_user_regs *regs,
union hsr hsr)
goto bad_trap;
do_cp15_64(regs, hsr);
break;
+ case HSR_EC_CP:
+ if ( !is_32bit_domain(current->domain) )
+ goto bad_trap;
+ do_cp(regs, hsr);
+ break;
case HSR_EC_SMC32:
inject_undef32_exception(regs);
break;
#define NSACR p15,0,c1,c1,2 /* Non-Secure Access Control Register */
#define HSCTLR p15,4,c1,c0,0 /* Hyp. System Control Register */
#define HCR p15,4,c1,c1,0 /* Hyp. Configuration Register */
+#define HCPTR p15,4,c1,c1,2 /* Hyp. Coprocessor Trap Register */
/* CP15 CR2: Translation Table Base and Control Registers */
#define TTBCR p15,0,c2,c0,2 /* Translatation Table Base Control Register */
#define CNTV_CVAL_EL0 CNTV_CVAL
#define CONTEXTIDR_EL1 CONTEXTIDR
#define CPACR_EL1 CPACR
+#define CPTR_EL2 HCPTR
#define CSSELR_EL1 CSSELR
#define DACR32_EL2 DACR
#define ESR_EL1 DFSR
#define HCR_SWIO (_AC(1,UL)<<1) /* Set/Way Invalidation Override */
#define HCR_VM (_AC(1,UL)<<0) /* Virtual MMU Enable */
+/* HCPTR Hyp. Coprocessor Trap Register */
+#define HCPTR_TTA ((_AC(1,U)<<20)) /* Trap trace registers */
+#define HCPTR_CP(x) ((_AC(1,U)<<(x))) /* Trap Coprocessor x */
+#define HCPTR_CP_MASK ((_AC(1,U)<<14)-1)
+
#define HSR_EC_UNKNOWN 0x00
#define HSR_EC_WFI_WFE 0x01
#define HSR_EC_CP15_32 0x03
#define HSR_EC_CP15_64 0x04
#define HSR_EC_CP14_32 0x05
#define HSR_EC_CP14_DBG 0x06
-#define HSR_EC_CP 0x07
+#define HSR_EC_CP 0x07 /* HCPTR-trapped access to CP0-CP13 */
#define HSR_EC_CP10 0x08
#define HSR_EC_JAZELLE 0x09
#define HSR_EC_BXJ 0x0a