From 079394921557233a01d429011432ed5e9044e384 Mon Sep 17 00:00:00 2001 From: Dietmar Eggemann Date: Tue, 21 Feb 2012 18:52:14 +0000 Subject: Introduce a trap handler for KFSCB accesses. The function handle_kfscb_abort is called when the virtualizer traps accesses to the KFSCB from Linux. Right now, it only forwards read and write accesses to the memory. Signed-off-by: Dietmar Eggemann --- big-little/Makefile | 2 +- big-little/virtualisor/include/virtualisor.h | 1 + big-little/virtualisor/kfscb_trap_handler.c | 38 ++++++++++++++++++++++++++++ big-little/virtualisor/virt_handle.c | 6 ++++- 4 files changed, 45 insertions(+), 2 deletions(-) create mode 100644 big-little/virtualisor/kfscb_trap_handler.c (limited to 'big-little') diff --git a/big-little/Makefile b/big-little/Makefile index 799da58..716f526 100755 --- a/big-little/Makefile +++ b/big-little/Makefile @@ -103,7 +103,7 @@ VIRTUALISOR_ASFLAGS += --pd "CMOP_DEBUG SETL {$(CMOP_DEBUG)}" vpath %.c virtualisor virtualisor/cpus/a15 virtualisor/cpus/a7 VIRTUALISOR_OBJS += virt_handle.o virt_setup.o virt_context.o cache_geom.o mem_trap.o vgic_trap_handler.o \ - a7.o a15.o + kfscb_trap_handler.o a7.o a15.o ############################################################################################################### diff --git a/big-little/virtualisor/include/virtualisor.h b/big-little/virtualisor/include/virtualisor.h index f097d39..1bcd5e2 100644 --- a/big-little/virtualisor/include/virtualisor.h +++ b/big-little/virtualisor/include/virtualisor.h @@ -75,6 +75,7 @@ extern void SaveVirtualisor(unsigned); extern void RestoreVirtualisor(unsigned); extern void HandleVirtualisor(gp_regs *); extern void handle_vgic_distif_abort(unsigned, unsigned *, unsigned); +extern void handle_kfscb_abort(unsigned, unsigned *, unsigned); extern unsigned find_sibling_cpu(void); extern virt_descriptor virt_desc_section$$Base; extern unsigned virt_desc_section$$Length; diff --git a/big-little/virtualisor/kfscb_trap_handler.c b/big-little/virtualisor/kfscb_trap_handler.c new file mode 100644 index 0000000..f6c61f1 --- /dev/null +++ b/big-little/virtualisor/kfscb_trap_handler.c @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2012, ARM Limited. All rights reserved. + * + * Redistribution and use in source and binary forms, with + * or without modification, are permitted provided that the + * following conditions are met: + * + * Redistributions of source code must retain the above + * copyright notice, this list of conditions and the + * following disclaimer. + * + * Redistributions in binary form must reproduce the + * above copyright notice, this list of conditions and + * the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * Neither the name of ARM nor the names of its + * contributors may be used to endorse or promote products + * derived from this software without specific prior written + * permission. + */ + +#include "misc.h" + +/* + * Whether A15 or A7, the KFSCB accesses are virtualised in exactly the same + * manner. + */ +void handle_kfscb_abort(unsigned pa, unsigned *data, unsigned write) +{ + if (write) { + write32(pa, *data); + } else { + *data = read32(pa); + } + + return; +} diff --git a/big-little/virtualisor/virt_handle.c b/big-little/virtualisor/virt_handle.c index a247534..56de995 100644 --- a/big-little/virtualisor/virt_handle.c +++ b/big-little/virtualisor/virt_handle.c @@ -529,10 +529,14 @@ void trap_dabort_handle(unsigned hsr, gp_regs * regs) data = ®s->r[(hsr >> 16) & 0xf]; write = (hsr >> 6) & 0x1; - /* Only distributor accesses are virtualised at the moment */ + /* distributor access */ if ((pa & ~0xfff) == GIC_ID_PHY_BASE) { handle_vgic_distif_abort(pa, data, write); } + /* KFSCB access */ + else if ((pa & ~0xfff) == KFSCB_BASE) { + handle_kfscb_abort(pa, data, write); + } return; } -- cgit v1.2.3